refactor: Move saml auth providers endpoint to admin namespace

This commit is contained in:
Faruk AYDIN
2024-02-19 22:18:15 +01:00
parent 6fe9a548ad
commit 679d0808a9
6 changed files with 56 additions and 53 deletions

View File

@@ -7,7 +7,7 @@ const authorizationList = {
action: 'read',
subject: 'User',
},
'/api/v1/saml-auth-providers/': {
'GET /api/v1/admin/saml-auth-providers/': {
action: 'read',
subject: 'SamlAuthProvider',
},
@@ -24,3 +24,13 @@ export const authorizeUser = async (request, response, next) => {
return response.status(403).end();
}
};
export const authorizeAdmin = async (request, response, next) => {
const role = await request.currentUser.$relatedQuery('role');
if (role?.isAdmin) {
next();
} else {
return response.status(403).end();
}
};