|
4 | 4 | createMemberRole, |
5 | 5 | createPersonalAccessToken, |
6 | 6 | readProjectInfo, |
| 7 | + updateMe, |
7 | 8 | updateMemberRole, |
8 | 9 | } from 'testkit/flow'; |
9 | 10 | import { ResourceAssignmentModeType } from 'testkit/gql/graphql'; |
@@ -3370,6 +3371,52 @@ test.concurrent('user cannot login via OIDC if SCIM user provisioning is require |
3370 | 3371 | invariant(signInUpResult.type === 'success', 'Expected sign in/up to succeed.'); |
3371 | 3372 | }); |
3372 | 3373 |
|
| 3374 | +test.concurrent.only( |
| 3375 | + 'provisioned user cannot update their profile via GraphQL', |
| 3376 | + async ({ expect }) => { |
| 3377 | + const seed = initSeed(); |
| 3378 | + const owner = await seed.createOwner(); |
| 3379 | + const org = await owner.createOrg(); |
| 3380 | + const oidc = await org.createOIDCIntegration(); |
| 3381 | + const oidcMock = await oidc.createMockServerAndUpdateIntegrationEndpoints(); |
| 3382 | + const domain = await oidc.registerFakeDomain(); |
| 3383 | + const accessToken = await org.createOrganizationAccessToken({ |
| 3384 | + permissions: ['member:describe', 'member:modify'], |
| 3385 | + resources: { mode: ResourceAssignmentModeType.Granular }, |
| 3386 | + }); |
| 3387 | + const scim = createScimTestkit({ |
| 3388 | + baseUrl, |
| 3389 | + headers: { |
| 3390 | + 'Content-Type': 'application/scim+json', |
| 3391 | + Authorization: `Bearer ${accessToken.privateAccessKey}`, |
| 3392 | + }, |
| 3393 | + }); |
| 3394 | + const email = `profile@${domain}`; |
| 3395 | + const externalId = crypto.randomUUID(); |
| 3396 | + |
| 3397 | + const scimUser = await scim.createUser({ |
| 3398 | + externalId, |
| 3399 | + emails: [{ primary: true, type: 'work', value: email }], |
| 3400 | + userName: email, |
| 3401 | + }); |
| 3402 | + |
| 3403 | + oidcMock.setUser({ email, userIdClaim: externalId }); |
| 3404 | + const auth = await oidcMock.runGetAuthorizationUrl(); |
| 3405 | + const signInResult = await oidcMock.runSignInUp({ state: auth.state }); |
| 3406 | + invariant(signInResult.type === 'success', 'Expected sign in to succeed.'); |
| 3407 | + |
| 3408 | + const result = await updateMe( |
| 3409 | + { |
| 3410 | + displayName: 'updated-display-name', |
| 3411 | + fullName: 'Updated Full Name', |
| 3412 | + }, |
| 3413 | + signInResult.accessToken, |
| 3414 | + ).then(r => r.expectNoGraphQLErrors()); |
| 3415 | + expect(result.updateMe.ok).toEqual(null); |
| 3416 | + expect(result.updateMe.error?.message).toEqual('Provisioned users can not be modified.'); |
| 3417 | + }, |
| 3418 | +); |
| 3419 | + |
3373 | 3420 | test.concurrent( |
3374 | 3421 | 'organization admin can still sign in via non-oidc method even if login through the identity provider is enforced', |
3375 | 3422 | async () => { |
|
0 commit comments