Compare commits
1 Commits
AUT-860
...
update-sam
Author | SHA1 | Date | |
---|---|---|---|
![]() |
934a525898 |
@@ -26,6 +26,7 @@ import updateStep from './mutations/update-step';
|
||||
import updateUser from './mutations/update-user.ee';
|
||||
import verifyConnection from './mutations/verify-connection';
|
||||
import createSamlAuthProvider from './mutations/create-saml-auth-provider.ee';
|
||||
import updateSamlAuthProvider from './mutations/update-saml-auth-provider.ee';
|
||||
|
||||
const mutationResolvers = {
|
||||
createConnection,
|
||||
@@ -56,6 +57,7 @@ const mutationResolvers = {
|
||||
updateStep,
|
||||
verifyConnection,
|
||||
createSamlAuthProvider,
|
||||
updateSamlAuthProvider,
|
||||
};
|
||||
|
||||
export default mutationResolvers;
|
||||
|
@@ -0,0 +1,45 @@
|
||||
import type { SamlConfig } from '@node-saml/passport-saml';
|
||||
import SamlAuthProvider from '../../models/saml-auth-provider.ee';
|
||||
import Context from '../../types/express/context';
|
||||
|
||||
type Params = {
|
||||
input: {
|
||||
name: string;
|
||||
certificate: string;
|
||||
signatureAlgorithm: SamlConfig['signatureAlgorithm'];
|
||||
issuer: string;
|
||||
entryPoint: string;
|
||||
firstnameAttributeName: string;
|
||||
surnameAttributeName: string;
|
||||
emailAttributeName: string;
|
||||
roleAttributeName: string;
|
||||
defaultRoleId: string;
|
||||
active: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
const updateSamlAuthProvider = async (
|
||||
_parent: unknown,
|
||||
params: Params,
|
||||
context: Context
|
||||
) => {
|
||||
context.currentUser.can('update', 'SamlAuthProvider');
|
||||
|
||||
const samlAuthProviderPayload: Partial<SamlAuthProvider> = {
|
||||
...params.input,
|
||||
};
|
||||
|
||||
const existingSamlAuthProvider = await SamlAuthProvider.query()
|
||||
.limit(1)
|
||||
.first()
|
||||
.throwIfNotFound();
|
||||
|
||||
const samlAuthProvider = await SamlAuthProvider.query().patchAndFetchById(
|
||||
existingSamlAuthProvider.id,
|
||||
samlAuthProviderPayload
|
||||
);
|
||||
|
||||
return samlAuthProvider;
|
||||
};
|
||||
|
||||
export default updateSamlAuthProvider;
|
@@ -79,6 +79,7 @@ type Mutation {
|
||||
updateUser(input: UpdateUserInput): User
|
||||
verifyConnection(input: VerifyConnectionInput): Connection
|
||||
createSamlAuthProvider(input: CreateSamlAuthProviderInput): SamlAuthProvider
|
||||
updateSamlAuthProvider(input: UpdateSamlAuthProviderInput): SamlAuthProvider
|
||||
}
|
||||
|
||||
"""
|
||||
@@ -349,6 +350,20 @@ input CreateSamlAuthProviderInput {
|
||||
active: Boolean!
|
||||
}
|
||||
|
||||
input UpdateSamlAuthProviderInput {
|
||||
name: String!
|
||||
certificate: String!
|
||||
signatureAlgorithm: String!
|
||||
issuer: String!
|
||||
entryPoint: String!
|
||||
firstnameAttributeName: String!
|
||||
surnameAttributeName: String!
|
||||
emailAttributeName: String!
|
||||
roleAttributeName: String!
|
||||
defaultRoleId: String!
|
||||
active: Boolean!
|
||||
}
|
||||
|
||||
input DeleteConnectionInput {
|
||||
id: String!
|
||||
}
|
||||
|
Reference in New Issue
Block a user