File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed
Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,12 @@ createScimUserGroup domain token scimUserGroup = do
9797 body <- make scimUserGroup
9898 submit " POST" $ req & addJSON body . addHeader " Authorization" (" Bearer " <> token)
9999
100+ updateScimUserGroup :: (HasCallStack , MakesValue domain , MakesValue scimUserGroup ) => domain -> String -> String -> scimUserGroup -> App Response
101+ updateScimUserGroup domain token groupId scimUserGroup = do
102+ req <- baseRequest domain Spar Versioned $ joinHttpPath [" scim" , " v2" , " Groups" , groupId]
103+ body <- make scimUserGroup
104+ submit " PUT" $ req & addJSON body . addHeader " Authorization" (" Bearer " <> token)
105+
100106-- | https://staging-nginz-https.zinfra.io/v12/api/swagger-ui/#/default/idp-create
101107createIdp :: (HasCallStack , MakesValue user ) => user -> SAML. IdPMetadata -> App Response
102108createIdp user metadata = do
Original file line number Diff line number Diff line change @@ -386,6 +386,50 @@ testSparScimCreateUserGroup = do
386386
387387-- get group here via resp
388388
389+ testSparScimUpdateUserGroup :: (HasCallStack ) => App ()
390+ testSparScimUpdateUserGroup = do
391+ (owner, _, u1 : u2 : u3 : _) <- createTeam OwnDomain 4
392+ u1Id <- u1 %. " id" >>= asString
393+ u2Id <- u2 %. " id" >>= asString
394+ u3Id <- u3 %. " id" >>= asString
395+ tok <- createScimToken owner def >>= getJSON 200 >>= (%. " token" ) >>= asString
396+ let scimUserGroup =
397+ object
398+ [ " schemas" .= [" urn:ietf:params:scim:schemas:core:2.0:Group" ],
399+ " displayName" .= " My funky group" ,
400+ " members"
401+ .= [ object
402+ [ " value" .= u1Id,
403+ " type" .= " User" ,
404+ " $ref" .= (" http://example.com:8088/scim/v2/Users/" <> u1Id)
405+ ],
406+ object
407+ [ " value" .= u2Id,
408+ " type" .= " User" ,
409+ " $ref" .= (" http://example.com:8088/scim/v2/Users/" <> u2Id)
410+ ]
411+ ]
412+ ]
413+ gid <- createScimUserGroup OwnDomain tok scimUserGroup >>= getJSON 200 >>= (%. " id" ) >>= asString
414+ let scimUserGroupUpdated =
415+ object
416+ [ " schemas" .= [" urn:ietf:params:scim:schemas:core:2.0:Group" ],
417+ " displayName" .= " My even funkier group" ,
418+ " members"
419+ .= [ object
420+ [ " value" .= u2Id,
421+ " type" .= " User" ,
422+ " $ref" .= (" http://example.com:8088/scim/v2/Users/" <> u2Id)
423+ ],
424+ object
425+ [ " value" .= u3Id,
426+ " type" .= " User" ,
427+ " $ref" .= (" http://example.com:8088/scim/v2/Users/" <> u3Id)
428+ ]
429+ ]
430+ ]
431+ updateScimUserGroup OwnDomain tok gid scimUserGroupUpdated >>= assertSuccess
432+
389433----------------------------------------------------------------------
390434-- saml stuff
391435
You can’t perform that action at this time.
0 commit comments