Skip to content

Commit

Permalink
feat: enable project name updates for saml clients
Browse files Browse the repository at this point in the history
  • Loading branch information
NithinKuruba committed Jan 31, 2025
1 parent 4dcad8f commit c8d13dc
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 85 deletions.
1 change: 0 additions & 1 deletion app/schemas-ui/ui-gold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ const getUISchema = ({ integration, formData, isAdmin, teams, schemas }: Props)
projectName: {
'ui:placeholder': 'Project Name',
'ui:classNames': 'short-field-string',
'ui:readonly': !isNew && formData?.protocol === 'saml' && formData?.status !== 'draft',
},
teamId: {
'ui:classNames': 'short-field-string',
Expand Down
41 changes: 0 additions & 41 deletions lambda/__tests__/03.requests-by-users.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,47 +233,6 @@ describe('create/manage integration by authenticated user', () => {
);
expect(updateIntegrationRes.status).toEqual(422);
});

it('should not allow to update project name of a saml integration in submitted state', async () => {
createMockAuth(TEAM_ADMIN_IDIR_USERID_01, TEAM_ADMIN_IDIR_EMAIL_01);
let integrationRes = await createIntegration(
getCreateIntegrationData({
projectName: 'Project name at draft',
}),
);

expect(integrationRes.status).toEqual(200);
integration = integrationRes.body;
expect(integration.status).toEqual('draft');

let updateIntegrationRes = await updateIntegration(
getUpdateIntegrationData({
projectName: 'Project name before submit',
integration,
identityProviders: ['azureidir'],
envs: ['dev', 'test', 'prod'],
protocol: 'saml',
}),
true,
);

expect(updateIntegrationRes.status).toEqual(200);
integration = updateIntegrationRes.body;
expect(integration.status).toEqual('applied');

const projNameAfterApplied = 'Project name after applied';

updateIntegrationRes = await updateIntegration(
getUpdateIntegrationData({
projectName: projNameAfterApplied,
integration,
}),
true,
);
expect(updateIntegrationRes.status).toEqual(200);
integration = updateIntegrationRes.body;
expect(integration.projectName).not.toEqual(projNameAfterApplied);
});
} catch (err) {
console.error('EXCEPTION: ', err);
}
Expand Down
42 changes: 0 additions & 42 deletions lambda/__tests__/04.requests-by-teams.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,46 +194,4 @@ describe('create/manage integrations by authenticated user', () => {
);
expect(updateIntegrationRes.status).toEqual(422);
});

it('should not allow to update project name of a saml integration in submitted state', async () => {
createMockAuth(TEAM_ADMIN_IDIR_USERID_01, TEAM_ADMIN_IDIR_EMAIL_01);
let integrationRes = await createIntegration(
getCreateIntegrationData({
projectName: 'Project name at draft',
teamIntegration: true,
teamId,
}),
);

expect(integrationRes.status).toEqual(200);
integration = integrationRes.body;
expect(integration.status).toEqual('draft');

let updateIntegrationRes = await updateIntegration(
getUpdateIntegrationData({
projectName: 'Project name before submit',
integration,
identityProviders: ['azureidir'],
envs: ['dev', 'test', 'prod'],
protocol: 'saml',
}),
true,
);
expect(updateIntegrationRes.status).toEqual(200);
integration = updateIntegrationRes.body;
expect(integration.status).toEqual('applied');

const projNameAfterApplied = 'Project name after applied';

updateIntegrationRes = await updateIntegration(
getUpdateIntegrationData({
projectName: projNameAfterApplied,
integration,
}),
true,
);
expect(updateIntegrationRes.status).toEqual(200);
integration = updateIntegrationRes.body;
expect(integration.projectName).not.toEqual(projNameAfterApplied);
});
});
1 change: 0 additions & 1 deletion lambda/app/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export const processRequest = (session: Session, data: Integration, isMerged: bo

if (isMerged) {
immutableFields.push('realm');
if (data?.protocol === 'saml') immutableFields.push('projectName');
}

if (!isAdminUser) {
Expand Down

0 comments on commit c8d13dc

Please sign in to comment.