diff --git a/changelog.d/1-api-changes/WPB-28094-do-not-include-apps-in-_get-_teams__tid_members_ b/changelog.d/1-api-changes/WPB-28094-do-not-include-apps-in-_get-_teams__tid_members_ new file mode 100644 index 0000000000..0cdbed7d39 --- /dev/null +++ b/changelog.d/1-api-changes/WPB-28094-do-not-include-apps-in-_get-_teams__tid_members_ @@ -0,0 +1 @@ +Do not include apps in `GET /teams/:tid/members`. diff --git a/integration/test/Test/Apps.hs b/integration/test/Test/Apps.hs index 4428f5e732..4a04b54cff 100644 --- a/integration/test/Test/Apps.hs +++ b/integration/test/Test/Apps.hs @@ -284,14 +284,6 @@ testRetrieveUsersIncludingApps = do ("team", SString), ("type", SString) ] - memberShape = - SObject - [ ("created_at", SString), - ("created_by", SString), - ("legalhold_status", SString), - ("permissions", SObject [("copy", SNumber), ("self", SNumber)]), - ("user", SString) - ] appShape = SObject [ ("category", SString), @@ -344,6 +336,7 @@ testRetrieveUsersIncludingApps = do appId <- appCreated %. "user.id" & asString -- [`GET /teams/:tid/members`](https://staging-nginz-https.zinfra.io/v15/api/swagger-ui/#/default/get-team-members) (route id: "get-team-members") + -- Apps are not team members, so they are not listed here. getTeamMembers owner tid `bindResponse` \resp -> do resp.status `shouldMatchInt` 200 resp.json %. "hasMore" `shouldMatch` False @@ -351,16 +344,15 @@ testRetrieveUsersIncludingApps = do memIds <- (asString . (%. "user")) `mapM` mems memIds `shouldMatchSet` sequence - [ pure appId, - asString $ regular %. "qualified_id.id", + [ asString $ regular %. "qualified_id.id", asString $ owner %. "qualified_id.id" ] -- [`GET /teams/:tid/members/:uid`](https://staging-nginz-https.zinfra.io/v15/api/swagger-ui/#/default/get-team-member) (route id: "get-team-member") + -- Same here: apps cannot be retrieved as team members. getTeamMember owner tid appId `bindResponse` \resp -> do - resp.status `shouldMatchInt` 200 - resp.json %. "user" `shouldMatch` appId - resp.json `shouldMatchShapeLenient` memberShape + resp.status `shouldMatchInt` 404 + resp.json %. "label" `shouldMatch` "no-team-member" -- [`GET /teams/:tid/apps`](https://staging-nginz-https.zinfra.io/v15/api/swagger-ui/#/default/get-apps) (route id: "get-apps") getApps owner tid `bindResponse` \resp -> do diff --git a/integration/test/Test/TeamCollaborators.hs b/integration/test/Test/TeamCollaborators.hs index cf55c3a558..0ad5664161 100644 --- a/integration/test/Test/TeamCollaborators.hs +++ b/integration/test/Test/TeamCollaborators.hs @@ -58,6 +58,22 @@ testCreateTeamCollaborator = do res %. "team" `shouldMatch` team res %. "permissions" `shouldMatch` ["create_team_conversation", "implicit_connection"] + -- Collaborators are not team members, so they don't show up in the team + -- member end-points. + bindResponse (getTeamMembers owner team) $ \resp -> do + resp.status `shouldMatchInt` 200 + mems <- resp.json %. "members" >>= asList + memIds <- (asString . (%. "user")) `mapM` mems + memIds + `shouldMatchSet` sequence + [ asString $ owner %. "qualified_id.id", + asString $ alice %. "qualified_id.id" + ] + + bindResponse (getTeamMember owner team userId) $ \resp -> do + resp.status `shouldMatchInt` 404 + resp.json %. "label" `shouldMatch` "no-team-member" + testTeamCollaboratorEndpointsForbiddenForOtherTeams :: (HasCallStack) => App () testTeamCollaboratorEndpointsForbiddenForOtherTeams = do (owner, _team, _members) <- createTeam OwnDomain 2