Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Do not include apps in `GET /teams/:tid/members`.
18 changes: 5 additions & 13 deletions integration/test/Test/Apps.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -344,23 +336,23 @@ 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
mems <- resp.json %. "members" >>= asList
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
Expand Down
16 changes: 16 additions & 0 deletions integration/test/Test/TeamCollaborators.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down