refactor: Move saml auth providers endpoint to admin namespace
This commit is contained in:
@@ -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();
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user