Compare commits

...

1 Commits

Author SHA1 Message Date
Faruk AYDIN
934a525898 feat: Add updateSamlAuthProvider graphQL mutation 2023-08-07 16:14:42 +02:00
3 changed files with 62 additions and 0 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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!
}