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