feat: add getSamlAuthProviderRoleMappings query (#1229)

This commit is contained in:
Ali BARIN
2023-08-22 14:50:01 +02:00
committed by GitHub
parent 91f3e2c2b4
commit e3830d64e0
3 changed files with 26 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import Context from '../../types/express/context';
import SamlAuthProvider from '../../models/saml-auth-provider.ee';
type Params = {
id: string;
}
const getSamlAuthProviderRoleMappings = async (_parent: unknown, params: Params, context: Context) => {
context.currentUser.can('read', 'SamlAuthProvider');
const samlAuthProvider = await SamlAuthProvider
.query()
.findById(params.id)
.throwIfNotFound();
const roleMappings = await samlAuthProvider
.$relatedQuery('samlAuthProvidersRoleMappings')
.orderBy('remote_role_name', 'asc')
return roleMappings;
};
export default getSamlAuthProviderRoleMappings;