Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability for super admins to see recommendation code #19

Open
Nautman opened this issue Apr 3, 2021 · 2 comments
Open

Add ability for super admins to see recommendation code #19

Nautman opened this issue Apr 3, 2021 · 2 comments

Comments

@Nautman
Copy link
Member

Nautman commented Apr 3, 2021

It would be great if super admins could see the recommendation codes in the /application/:userID/recommendation request. Then they would be able to upload recommendation letters from people that are unable to.

@Nautman
Copy link
Member Author

Nautman commented Mar 30, 2022

For what it's worth, here is the code that should be changed, and my suggestion what it should be changed to.

async function getRecommendations(req: Request, res: Response): Promise<void> {
const userID = req.params.userID;
const recommendations = await req.services.Application.getRecommendationsForApplicant(userID);
const recommendationsReturn = recommendations.map(recommendation => {
return req.services.Application.toRecommendationForUser(recommendation);
});
res.json(recommendationsReturn);
}

const isAdmin = req.user?.type === UserType.Admin || req.user?.type === UserType.SuperAdmin;

const recommendations = await req.services.Application.getRecommendationsForApplicant(userID); 

if(isAdmin) return res.json(recommendations);

...

@Nautman
Copy link
Member Author

Nautman commented Mar 30, 2022

I'd just like to point out that perhaps you only want super admins to be able to see the code since that would effectually let them upload a file - which is not within the description of an admin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant