diff --git a/changelog.d/2-features/WPB-20214 b/changelog.d/2-features/WPB-20214 new file mode 100644 index 0000000000..2c534eef73 --- /dev/null +++ b/changelog.d/2-features/WPB-20214 @@ -0,0 +1,3 @@ +Add `searchable` field to users, users who have it set to `false` won't be found by the public endpoint. +Add `POST /users/:uid/searchable` endpoint where team admin can change it for user. +Add `/teams/:tid/search?searchable=false`, where the query parameter makes it return only non-searchable users. \ No newline at end of file diff --git a/integration/test/API/Brig.hs b/integration/test/API/Brig.hs index 1cb9d53308..216e888492 100644 --- a/integration/test/API/Brig.hs +++ b/integration/test/API/Brig.hs @@ -262,6 +262,11 @@ searchTeamWithSearchTerm user q = searchTeam user [("q", q)] searchTeamAll :: (HasCallStack, MakesValue user) => user -> App Response searchTeamAll user = searchTeam user [("q", ""), ("size", "100"), ("sortby", "created_at"), ("sortorder", "desc")] +setUserSearchable :: (MakesValue user) => user -> String -> Bool -> App Response +setUserSearchable self uid searchable = do + req <- baseRequest self Brig Versioned $ joinHttpPath ["users", uid, "searchable"] + submit "POST" $ addJSON searchable req + getAPIVersion :: (HasCallStack, MakesValue domain) => domain -> App Response getAPIVersion domain = do req <- baseRequest domain Brig Unversioned $ "/api-version" diff --git a/integration/test/Test/Search.hs b/integration/test/Test/Search.hs index aea52c120c..ab0ab68501 100644 --- a/integration/test/Test/Search.hs +++ b/integration/test/Test/Search.hs @@ -12,6 +12,7 @@ import GHC.Stack import SetupHelpers import Testlib.Assertions import Testlib.Prelude +import qualified Data.Set as Set -------------------------------------------------------------------------------- -- LOCAL SEARCH @@ -358,3 +359,124 @@ testTeamSearchUserIncludesUserGroups = do let expectedUgs = fromMaybe [] (lookup uid expected) actualUgs <- for ugs asString actualUgs `shouldMatchSet` expectedUgs + +withFoundDocs :: + (MakesValue user, MakesValue searchTerm) => + user -> + searchTerm -> + ([Value] -> App a) -> + App a +withFoundDocs self term f = do + BrigP.searchContacts self term OwnDomain `bindResponse` \resp -> do + resp.status `shouldMatchInt` 200 + docs <- resp.json %. "documents" >>= asList + f docs + +testUserSearchable :: App () +testUserSearchable = do + -- Create team and all users who are part of this test + (owner, tid, [u1, u3, u4]) <- createTeam OwnDomain 4 + admin <- createTeamMember owner def {role = "admin"} + let everyone = [owner, u1, admin, u3, u4] + + -- All users are searchable by default + assertBool "created users are searchable by default" . and =<< mapM (\u -> u %. "searchable" & asBool) everyone + + -- Setting self to non-searchable won't work -- only admin can do it. + u1id <- u1 %. "id" & asString + BrigP.setUserSearchable u1 u1id False `bindResponse` \resp -> do + resp.status `shouldMatchInt` 403 + resp.json %. "label" `shouldMatch` "insufficient-permissions" + + BrigP.getUser u1 u1 `bindResponse` \resp -> do + resp.status `shouldMatchInt` 200 + (resp.json %. "searchable") `shouldMatch` True + + -- Team admin can set user to non-searchable. + BrigP.setUserSearchable admin u1id False `bindResponse` \resp -> resp.status `shouldMatchInt` 200 + BrigP.getUser u1 u1 `bindResponse` \resp -> do + resp.status `shouldMatchInt` 200 + (resp.json %. "searchable") `shouldMatch` False + + -- Team owner can, too. + BrigP.setUserSearchable owner u1id True `bindResponse` \resp -> resp.status `shouldMatchInt` 200 + BrigP.setUserSearchable owner u1id False `bindResponse` \resp -> resp.status `shouldMatchInt` 200 + + -- By default created team members are found. + u3id <- u3 %. "id" & asString + BrigI.refreshIndex OwnDomain + withFoundDocs u1 (u3 %. "name") $ \docs -> do + foundUids <- for docs objId + assertBool "u1 must find u3 as they are searchable by default" $ u3id `elem` foundUids + + -- User set to non-searchable is not found by other team members. + u4id <- u4 %. "id" & asString + BrigP.setUserSearchable owner u4id False `bindResponse` \resp -> resp.status `shouldMatchInt` 200 + BrigI.refreshIndex OwnDomain + withFoundDocs u1 (u4 %. "name") $ \docs -> do + foundUids <- for docs objId + assertBool "u1 must not find u4 as they are set non-searchable" $ notElem u4id foundUids + + -- Even admin nor owner won't find non-searchable users via /search/contacts + withFoundDocs admin (u4 %. "name") $ \docs -> do + foundUids <- for docs objId + assertBool "Team admin won't find non-searchable user" $ notElem u4id foundUids + withFoundDocs owner (u4 %. "name") $ \docs -> do + foundUids <- for docs objId + assertBool "Team owner won't find non-searchable user from /search/concatcs" $ notElem u4id foundUids + + -- Exact handle search with HTTP HEAD still works for non-searchable users + u4handle <- API.randomHandle + bindResponse (BrigP.putHandle u4 u4handle) assertSuccess + baseRequest u3 Brig Versioned (joinHttpPath ["handles", u4handle]) >>= \req -> + submit "HEAD" req `bindResponse` \resp -> do + resp.status `shouldMatchInt` 200 -- (200 means "handle is taken", 404 would be "not found") + + -- Handle for POST /handles still works for non-searchable users + u3handle <- API.randomHandle + bindResponse (BrigP.putHandle u3 u3handle) assertSuccess + baseRequest u1 Brig Versioned (joinHttpPath ["handles"]) <&> addJSONObject ["handles" .= [u4handle, u3handle]] >>= \req -> + submit "POST" req `bindResponse` \resp -> do + resp.status `shouldMatchInt` 200 + freeHandles <- resp.json & asList + assertBool "POST /handles filters all taken handles, even for regular members" $ null freeHandles + + -- Regular user can't find non-searchable team member by exact handle. + withFoundDocs u1 u4handle $ \docs -> do + foundUids <- for docs objId + assertBool "u1 must not find non-searchable u4 by exact handle" $ notElem u4id foundUids + + -- /teams/:tid/members gets all members, both searchable and non-searchable + baseRequest u1 Galley Versioned (joinHttpPath ["teams", tid, "members"]) >>= \req -> + submit "GET" req `bindResponse` \resp -> do + resp.status `shouldMatchInt` 200 + docs <- resp.json %. "members" >>= asList + foundUids <- mapM (\m -> m %. "user" & asString) docs + assertBool "/teams/:tid/members returns searchable and non-searchable users from team" $ all (`elem` foundUids) $ [u1id, u3id, u4id] + + -- /teams/:tid/search?searchable=false gets only non-searchable members + baseRequest admin Brig Versioned (joinHttpPath ["teams", tid, "search"]) <&> addQueryParams [("searchable", "false")] >>= \req -> + submit "GET" req `bindResponse` \resp -> do + resp.status `shouldMatchInt` 200 + docs <- resp.json %. "documents" >>= asList + foundUids <- mapM (\m -> m %. "id" & asString) docs + assertBool "/teams/:tid/members?searchable=false returns only non-searchable members" $ Set.fromList foundUids == Set.fromList [u1id, u4id] + + -- /teams/:tid/search and /teams/:tid/search?searchable=true both get all members, searchable and non-searchable + noQueryParam <- baseRequest admin Brig Versioned (joinHttpPath ["teams", tid, "search"]) >>= \req -> + submit "GET" req `bindResponse` \resp -> do + resp.status `shouldMatchInt` 200 + docs <- resp.json %. "documents" >>= asList + mapM (\m -> m %. "id" & asString) docs + withQueryParam <- baseRequest admin Brig Versioned (joinHttpPath ["teams", tid, "search"]) <&> addQueryParams [("searchable", "true")] >>= \req -> + submit "GET" req `bindResponse` \resp -> do + resp.status `shouldMatchInt` 200 + docs <- resp.json %. "documents" >>= asList + mapM (\m -> m %. "id" & asString) docs + assertBool "/teams/:tid/search and /teams/:tid/search?searchable=true are equal" $ + Set.fromList noQueryParam == Set.fromList withQueryParam + + -- All users created as part of this test are in the returned result + everyone'sUids <- mapM objId everyone + assertBool "All created users as part of this test are in the returned result" $ + Set.fromList noQueryParam == Set.fromList everyone'sUids diff --git a/libs/bilge/src/Bilge/Assert.hs b/libs/bilge/src/Bilge/Assert.hs index 5f44fd9d68..a13e624aa5 100644 --- a/libs/bilge/src/Bilge/Assert.hs +++ b/libs/bilge/src/Bilge/Assert.hs @@ -106,7 +106,7 @@ io Assertions () -> m () -(!!!) io = void . ( CaptureUserId "uid" :> GetUserVerb ) - :<|> - -- See Note [ephemeral user sideeffect] - Named - "get-user-qualified" - ( Summary "Get a user by Domain and UserId" - :> ZLocalUser - :> "users" - :> QualifiedCaptureUserId "uid" - :> GetUserVerb - ) + :<|> Named + "get-user-qualified" + ( Summary "Get a user by Domain and UserId" + :> ZLocalUser + :> "users" + :> QualifiedCaptureUserId "uid" + :> GetUserVerb + ) :<|> Named "update-user-email" ( Summary "Resend email address validation email." @@ -224,19 +221,17 @@ type UserAPI = ] (Maybe UserProfile) ) - :<|> - -- See Note [ephemeral user sideeffect] - Named - "list-users-by-unqualified-ids-or-handles" - ( Summary "List users (deprecated)" - :> Until 'V2 - :> Description "The 'ids' and 'handles' parameters are mutually exclusive." - :> ZUser - :> "users" - :> QueryParam' [Optional, Strict, Description "User IDs of users to fetch"] "ids" (CommaSeparatedList UserId) - :> QueryParam' [Optional, Strict, Description "Handles of users to fetch, min 1 and max 4 (the check for handles is rather expensive)"] "handles" (Range 1 4 (CommaSeparatedList Handle)) - :> Get '[JSON] [UserProfile] - ) + :<|> Named + "list-users-by-unqualified-ids-or-handles" + ( Summary "List users (deprecated)" + :> Until 'V2 + :> Description "The 'ids' and 'handles' parameters are mutually exclusive." + :> ZUser + :> "users" + :> QueryParam' [Optional, Strict, Description "User IDs of users to fetch"] "ids" (CommaSeparatedList UserId) + :> QueryParam' [Optional, Strict, Description "Handles of users to fetch, min 1 and max 4 (the check for handles is rather expensive)"] "handles" (Range 1 4 (CommaSeparatedList Handle)) + :> Get '[JSON] [UserProfile] + ) :<|> Named "list-users-by-ids-or-handles" ( Summary "List users" @@ -247,18 +242,16 @@ type UserAPI = :> ReqBody '[JSON] ListUsersQuery :> Post '[JSON] ListUsersById ) - :<|> - -- See Note [ephemeral user sideeffect] - Named - "list-users-by-ids-or-handles@V3" - ( Summary "List users" - :> Description "The 'qualified_ids' and 'qualified_handles' parameters are mutually exclusive." - :> ZUser - :> Until 'V4 - :> "list-users" - :> ReqBody '[JSON] ListUsersQuery - :> Post '[JSON] [UserProfile] - ) + :<|> Named + "list-users-by-ids-or-handles@V3" + ( Summary "List users" + :> Description "The 'qualified_ids' and 'qualified_handles' parameters are mutually exclusive." + :> ZUser + :> Until 'V4 + :> "list-users" + :> ReqBody '[JSON] ListUsersQuery + :> Post '[JSON] [UserProfile] + ) :<|> Named "send-verification-code" ( Summary "Send a verification code to a given email address." @@ -294,6 +287,17 @@ type UserAPI = '[JSON] (Respond 200 "Protocols supported by the user" (Set BaseProtocolTag)) ) + :<|> Named + "set-user-searchable" + ( Summary "Set user's visibility in search" + :> From 'V12 + :> ZLocalUser + :> "users" + :> CaptureUserId "uid" + :> ReqBody '[JSON] Bool + :> "searchable" + :> Post '[JSON] () + ) type LastSeenNameDesc = Description "`name` of the last seen user group, used to get the next page when sorting by name." @@ -1735,6 +1739,13 @@ type SearchAPI = ] "email" EmailVerificationFilter + :> QueryParam' + [ Optional, + Strict, + Description "Optional, return only non-searchable members when false." + ] + "searchable" + Bool :> MultiVerb 'GET '[JSON] diff --git a/libs/wire-api/src/Wire/API/Team/Member.hs b/libs/wire-api/src/Wire/API/Team/Member.hs index f6a75b1ebc..bc6f339fd2 100644 --- a/libs/wire-api/src/Wire/API/Team/Member.hs +++ b/libs/wire-api/src/Wire/API/Team/Member.hs @@ -483,6 +483,7 @@ data HiddenPerm | CreateApp | ManageApps | RemoveTeamCollaborator + | SetMemberSearchable deriving (Eq, Ord, Show) -- | See Note [hidden team roles] @@ -570,7 +571,8 @@ roleHiddenPermissions role = HiddenPermissions p p NewTeamCollaborator, CreateApp, ManageApps, - RemoveTeamCollaborator + RemoveTeamCollaborator, + SetMemberSearchable ] roleHiddenPerms RoleMember = (roleHiddenPerms RoleExternalPartner <>) $ @@ -654,7 +656,7 @@ makeLenses ''TeamMemberList' makeLenses ''NewTeamMember' makeLenses ''TeamMemberDeleteData -userId :: Lens' TeamMember UserId +userId :: Lens' (TeamMember' tag) UserId userId = newTeamMember . nUserId permissions :: Lens (TeamMember' tag1) (TeamMember' tag2) (PermissionType tag1) (PermissionType tag2) diff --git a/libs/wire-api/src/Wire/API/Team/Permission.hs b/libs/wire-api/src/Wire/API/Team/Permission.hs index 6cf7977201..974ef98926 100644 --- a/libs/wire-api/src/Wire/API/Team/Permission.hs +++ b/libs/wire-api/src/Wire/API/Team/Permission.hs @@ -128,6 +128,9 @@ serviceWhitelistPermissions = -- Perm -- | Team-level permission. Analog to conversation-level 'Action'. +-- +-- If you ever think about adding a new permission flag, read Note +-- [team roles] first. data Perm = CreateConversation | -- NOTE: This may get overruled by conv level checks in case those are more restrictive @@ -153,8 +156,6 @@ data Perm | DeleteTeam -- FUTUREWORK: make the verbs in the roles more consistent -- (CRUD vs. Add,Remove vs; Get,Set vs. Create,Delete etc). - -- If you ever think about adding a new permission flag, - -- read Note [team roles] first. deriving stock (Eq, Ord, Show, Enum, Bounded, Generic) deriving (Arbitrary) via (GenericUniform Perm) deriving (FromJSON, ToJSON) via (CustomEncoded Perm) diff --git a/libs/wire-api/src/Wire/API/User.hs b/libs/wire-api/src/Wire/API/User.hs index f8072e95d6..138ded4356 100644 --- a/libs/wire-api/src/Wire/API/User.hs +++ b/libs/wire-api/src/Wire/API/User.hs @@ -509,7 +509,8 @@ data UserProfile = UserProfile profileEmail :: Maybe EmailAddress, profileLegalholdStatus :: UserLegalHoldStatus, profileSupportedProtocols :: Set BaseProtocolTag, - profileType :: UserType + profileType :: UserType, + profileSearchable :: Bool } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform UserProfile) @@ -549,6 +550,7 @@ instance ToSchema UserProfile where .= field "legalhold_status" schema <*> profileSupportedProtocols .= supportedProtocolsObjectSchema <*> profileType .= fmap (fromMaybe UserTypeRegular) (optField "type" schema) + <*> profileSearchable .= fmap (fromMaybe True) (optField "searchable" schema) -------------------------------------------------------------------------------- -- SelfProfile @@ -603,7 +605,8 @@ data User = User -- | How is the user profile managed (e.g. if it's via SCIM then the user profile -- can't be edited via normal means) userManagedBy :: ManagedBy, - userSupportedProtocols :: Set BaseProtocolTag + userSupportedProtocols :: Set BaseProtocolTag, + userSearchable :: Bool } deriving stock (Eq, Ord, Show, Generic) deriving (Arbitrary) via (GenericUniform User) @@ -654,6 +657,7 @@ userObjectSchema = .= (fromMaybe ManagedByWire <$> optField "managed_by" schema) <*> userSupportedProtocols .= supportedProtocolsObjectSchema <* (fromMaybe False <$> (\u -> if userDeleted u then Just True else Nothing) .= maybe_ (optField "deleted" schema)) + <*> userSearchable .= (fromMaybe True <$> optField "searchable" schema) userEmail :: User -> Maybe EmailAddress userEmail = emailIdentity <=< userIdentity @@ -732,7 +736,8 @@ mkUserProfileWithEmail memail u legalHoldStatus = profileEmail = memail, profileLegalholdStatus = legalHoldStatus, profileSupportedProtocols = userSupportedProtocols u, - profileType = ty + profileType = ty, + profileSearchable = userSearchable u } mkUserProfile :: EmailVisibilityConfigWithViewer -> User -> UserLegalHoldStatus -> UserProfile diff --git a/libs/wire-api/src/Wire/API/User/Search.hs b/libs/wire-api/src/Wire/API/User/Search.hs index 8a43fcb955..a46dad3c15 100644 --- a/libs/wire-api/src/Wire/API/User/Search.hs +++ b/libs/wire-api/src/Wire/API/User/Search.hs @@ -193,7 +193,8 @@ data TeamContact = TeamContact teamContactScimExternalId :: Maybe Text, teamContactSso :: Maybe Sso, teamContactEmailUnvalidated :: Maybe EmailAddress, - teamContactUserGroups :: [UserGroupId] + teamContactUserGroups :: [UserGroupId], + teamContactSearchable :: Bool } deriving stock (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform TeamContact) @@ -217,6 +218,7 @@ instance ToSchema TeamContact where <*> teamContactSso .= optField "sso" (maybeWithDefault Aeson.Null schema) <*> teamContactEmailUnvalidated .= optField "email_unvalidated" (maybeWithDefault Aeson.Null schema) <*> teamContactUserGroups .= fieldWithDocModifier "user_groups" (S.description ?~ "List of user group ids the user is a member of") (array schema) + <*> teamContactSearchable .= field "searchable" schema data TeamUserSearchSortBy = SortByName diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/SearchResult_20TeamContact_user.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/SearchResult_20TeamContact_user.hs index 0b4a1e7b84..3e7b0f2108 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/SearchResult_20TeamContact_user.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/SearchResult_20TeamContact_user.hs @@ -27,6 +27,26 @@ import Wire.API.Team.Role (Role (RoleAdmin, RoleExternalPartner, RoleMember, Rol import Wire.API.User import Wire.API.User.Search (FederatedUserSearchPolicy (ExactHandleSearch, FullSearch), PagingState (..), SearchResult (..), Sso (..), TeamContact (..)) +teamContactTemplate :: TeamContact +teamContactTemplate = + TeamContact + { teamContactUserId = Id (fromJust (UUID.fromString "")), + teamContactName = "", + teamContactColorId = Nothing, + teamContactHandle = Nothing, + teamContactTeam = Nothing, + teamContactEmail = Nothing, + teamContactCreatedAt = Nothing, + teamContactManagedBy = Nothing, + teamContactSAMLIdp = Nothing, + teamContactRole = Nothing, + teamContactScimExternalId = Nothing, + teamContactSso = Nothing, + teamContactEmailUnvalidated = Nothing, + teamContactUserGroups = [], + teamContactSearchable = True + } + testObject_SearchResult_20TeamContact_user_1 :: SearchResult TeamContact testObject_SearchResult_20TeamContact_user_1 = SearchResult @@ -34,40 +54,31 @@ testObject_SearchResult_20TeamContact_user_1 = searchReturned = 2, searchTook = 0, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000000")), - teamContactName = "", teamContactColorId = Just 0, - teamContactHandle = Nothing, teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000001"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T20:48:17.263Z")), - teamContactManagedBy = Nothing, teamContactSAMLIdp = Just "", teamContactRole = Just RoleAdmin, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, teamContactUserGroups = [ Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000001")), Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000000")) ] }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000001"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T17:17:18.225Z")), teamContactManagedBy = Just ManagedByWire, - teamContactSAMLIdp = Nothing, teamContactRole = Just RoleExternalPartner, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") } ], searchPolicy = FullSearch, @@ -94,53 +105,28 @@ testObject_SearchResult_20TeamContact_user_3 = searchReturned = -2, searchTook = -7, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000000")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000000"))), - teamContactEmail = Nothing, - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByWire, - teamContactSAMLIdp = Nothing, - teamContactRole = Just RoleAdmin, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleAdmin }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T04:59:07.086Z")), teamContactManagedBy = Just ManagedByWire, - teamContactSAMLIdp = Just "", - teamContactRole = Nothing, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSAMLIdp = Just "" }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T05:39:37.370Z")), teamContactManagedBy = Just ManagedByScim, - teamContactSAMLIdp = Just "", - teamContactRole = Nothing, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSAMLIdp = Just "" } ], searchPolicy = FullSearch, @@ -155,69 +141,46 @@ testObject_SearchResult_20TeamContact_user_4 = searchReturned = 4, searchTook = 2, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000001")), - teamContactName = "", - teamContactColorId = Nothing, - teamContactHandle = Nothing, teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000001"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByWire, - teamContactSAMLIdp = Nothing, teamContactRole = Just RoleOwner, - teamContactScimExternalId = Nothing, teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T01:29:06.597Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", teamContactRole = Just RoleAdmin, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001")), - teamContactName = "", - teamContactColorId = Nothing, - teamContactHandle = Nothing, teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000000"))), - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T17:38:20.677Z")), teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", teamContactRole = Just RoleExternalPartner, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", teamContactRole = Just RoleExternalPartner, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") } ], searchPolicy = ExactHandleSearch, @@ -232,21 +195,16 @@ testObject_SearchResult_20TeamContact_user_5 = searchReturned = -3, searchTook = -7, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T12:39:20.984Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" } ], searchPolicy = FullSearch, @@ -261,57 +219,36 @@ testObject_SearchResult_20TeamContact_user_6 = searchReturned = -7, searchTook = -4, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000000"))), - teamContactEmail = Nothing, - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", - teamContactRole = Just RoleOwner, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleOwner }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", teamContactRole = Just RoleOwner, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000001")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000000"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T10:59:12.538Z")), teamContactManagedBy = Just ManagedByScim, - teamContactSAMLIdp = Just "", - teamContactRole = Nothing, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSAMLIdp = Just "" }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000000"))), @@ -319,95 +256,54 @@ testObject_SearchResult_20TeamContact_user_6 = teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T23:24:12.000Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", - teamContactRole = Just RoleOwner, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleOwner }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, - teamContactManagedBy = Nothing, teamContactSAMLIdp = Just "", - teamContactRole = Nothing, - teamContactScimExternalId = Nothing, - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000001")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000001"))), - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T19:59:50.883Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", - teamContactRole = Just RoleMember, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleMember }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T13:56:02.433Z")), teamContactManagedBy = Just ManagedByWire, - teamContactSAMLIdp = Nothing, - teamContactRole = Just RoleAdmin, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleAdmin }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000000")), - teamContactName = "", teamContactColorId = Just 0, - teamContactHandle = Nothing, teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000000"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T01:45:42.970Z")), - teamContactManagedBy = Nothing, teamContactSAMLIdp = Just "", - teamContactRole = Nothing, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000000")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001"))), - teamContactEmail = Nothing, - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByWire, - teamContactSAMLIdp = Nothing, teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000001"))), @@ -417,57 +313,39 @@ testObject_SearchResult_20TeamContact_user_6 = teamContactSAMLIdp = Just "", teamContactRole = Just RoleOwner, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000000"))), - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T14:01:50.906Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", teamContactRole = Just RoleMember, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000000"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", teamContactRole = Just RoleExternalPartner, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByScim, - teamContactSAMLIdp = Nothing, teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" } ], searchPolicy = FullSearch, @@ -482,101 +360,65 @@ testObject_SearchResult_20TeamContact_user_7 = searchReturned = 5, searchTook = 5, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000001")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T19:22:39.660Z")), - teamContactManagedBy = Nothing, teamContactSAMLIdp = Just "", - teamContactRole = Nothing, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T19:42:55.525Z")), teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", - teamContactRole = Just RoleMember, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleMember }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000000"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000001")), teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, - teamContactEmail = Nothing, - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", - teamContactRole = Nothing, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001")), teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000000"))), - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T00:45:08.016Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", teamContactRole = Just RoleMember, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000001"))), - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T21:18:46.647Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Nothing, - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") } ], searchPolicy = FullSearch, @@ -591,41 +433,27 @@ testObject_SearchResult_20TeamContact_user_8 = searchReturned = 2, searchTook = -7, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000001")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000001"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", teamContactRole = Just RoleOwner, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000000")), - teamContactName = "", teamContactColorId = Just 0, - teamContactHandle = Nothing, - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T13:46:22.701Z")), teamContactManagedBy = Just ManagedByWire, - teamContactSAMLIdp = Nothing, teamContactRole = Just RoleOwner, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000001"))), @@ -633,15 +461,10 @@ testObject_SearchResult_20TeamContact_user_8 = teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T09:25:11.685Z")), teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", - teamContactRole = Nothing, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000001"))), @@ -649,11 +472,7 @@ testObject_SearchResult_20TeamContact_user_8 = teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T11:37:20.763Z")), teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", - teamContactRole = Nothing, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" } ], searchPolicy = FullSearch, @@ -668,25 +487,16 @@ testObject_SearchResult_20TeamContact_user_9 = searchReturned = 3, searchTook = -3, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, - teamContactEmail = Nothing, - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", - teamContactRole = Just RoleMember, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleMember }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000001"))), @@ -694,43 +504,29 @@ testObject_SearchResult_20TeamContact_user_9 = teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T16:22:05.429Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", - teamContactRole = Nothing, - teamContactScimExternalId = Nothing, - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000000"))), - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T17:19:11.439Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", teamContactRole = Just RoleMember, - teamContactScimExternalId = Nothing, - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000001")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000001"))), - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T05:44:15.175Z")), teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", teamContactRole = Just RoleExternalPartner, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") } ], searchPolicy = FullSearch, @@ -757,42 +553,29 @@ testObject_SearchResult_20TeamContact_user_11 = searchReturned = 7, searchTook = 1, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000001")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000001"))), - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T23:32:15.171Z")), teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000001")), - teamContactName = "", teamContactColorId = Just 0, - teamContactHandle = Nothing, teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000001"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T09:36:08.567Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", teamContactRole = Just RoleOwner, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000000")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000001"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), @@ -800,78 +583,41 @@ testObject_SearchResult_20TeamContact_user_11 = teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", teamContactRole = Just RoleAdmin, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000000")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", - teamContactTeam = Nothing, - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T00:23:34.413Z")), teamContactManagedBy = Just ManagedByScim, - teamContactSAMLIdp = Just "", - teamContactRole = Nothing, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSAMLIdp = Just "" }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000000"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, - teamContactManagedBy = Just ManagedByWire, - teamContactSAMLIdp = Nothing, - teamContactRole = Nothing, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactManagedBy = Just ManagedByWire }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000001")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T02:39:28.838Z")), - teamContactManagedBy = Nothing, teamContactSAMLIdp = Just "", - teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleExternalPartner }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000000"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, - teamContactManagedBy = Nothing, - teamContactSAMLIdp = Nothing, - teamContactRole = Just RoleOwner, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleOwner }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000100000001"))), @@ -879,11 +625,8 @@ testObject_SearchResult_20TeamContact_user_11 = teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T01:15:59.694Z")), teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", - teamContactRole = Nothing, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") } ], searchPolicy = FullSearch, @@ -898,21 +641,15 @@ testObject_SearchResult_20TeamContact_user_12 = searchReturned = 0, searchTook = 0, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T06:59:36.374Z")), - teamContactManagedBy = Nothing, teamContactSAMLIdp = Just "", - teamContactRole = Nothing, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") } ], searchPolicy = FullSearch, @@ -927,41 +664,28 @@ testObject_SearchResult_20TeamContact_user_13 = searchReturned = 3, searchTook = 1, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T17:55:15.951Z")), teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", - teamContactRole = Just RoleMember, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleMember }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000001")), - teamContactName = "", - teamContactColorId = Nothing, - teamContactHandle = Nothing, teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000000"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T05:08:55.558Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", teamContactRole = Just RoleMember, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000000"))), @@ -969,11 +693,7 @@ testObject_SearchResult_20TeamContact_user_13 = teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T11:18:47.121Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", - teamContactRole = Nothing, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" } ], searchPolicy = FullSearch, @@ -988,21 +708,14 @@ testObject_SearchResult_20TeamContact_user_14 = searchReturned = 4, searchTook = -4, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000000")), - teamContactName = "", teamContactColorId = Just 0, - teamContactHandle = Nothing, - teamContactTeam = Nothing, - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T06:35:15.745Z")), teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", teamContactRole = Just RoleAdmin, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" } ], searchPolicy = FullSearch, @@ -1017,21 +730,15 @@ testObject_SearchResult_20TeamContact_user_15 = searchReturned = 6, searchTook = -6, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000001")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000000"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByWire, - teamContactSAMLIdp = Nothing, teamContactRole = Just RoleOwner, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") } ], searchPolicy = FullSearch, @@ -1046,41 +753,29 @@ testObject_SearchResult_20TeamContact_user_16 = searchReturned = 2, searchTook = -5, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000001")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T23:38:23.560Z")), teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", teamContactRole = Just RoleAdmin, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000000")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000001"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByScim, - teamContactSAMLIdp = Nothing, teamContactRole = Just RoleAdmin, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" }, - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000000")), - teamContactName = "", teamContactColorId = Just 0, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000000000000"))), @@ -1089,10 +784,7 @@ testObject_SearchResult_20TeamContact_user_16 = teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", teamContactRole = Just RoleAdmin, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" } ], searchPolicy = FullSearch, @@ -1107,21 +799,13 @@ testObject_SearchResult_20TeamContact_user_17 = searchReturned = -5, searchTook = 4, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000100000000")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", - teamContactTeam = Nothing, - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T02:22:14.746Z")), teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "", - teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleExternalPartner } ], searchPolicy = FullSearch, @@ -1136,21 +820,14 @@ testObject_SearchResult_20TeamContact_user_18 = searchReturned = -7, searchTook = -7, searchResults = - [ TeamContact + [ teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000000")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000001"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T12:35:16.437Z")), - teamContactManagedBy = Nothing, teamContactSAMLIdp = Just "", - teamContactRole = Just RoleOwner, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleOwner } ], searchPolicy = FullSearch, diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/SelfProfile_user.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/SelfProfile_user.hs index 9841fd014e..608fd5a96a 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/SelfProfile_user.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/SelfProfile_user.hs @@ -62,6 +62,7 @@ testObject_SelfProfile_user_1 = userExpire = Just (fromJust (readUTCTimeMillis "1864-05-07T21:09:29.342Z")), userTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0002-0000-000000000002"))), userManagedBy = ManagedByScim, - userSupportedProtocols = defSupportedProtocols + userSupportedProtocols = defSupportedProtocols, + userSearchable = True } } diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/TeamContact_user.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/TeamContact_user.hs index 2d106b1907..59488e79ad 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/TeamContact_user.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/TeamContact_user.hs @@ -17,6 +17,7 @@ module Test.Wire.API.Golden.Generated.TeamContact_user where +import Data.Bool (Bool (True)) import Data.Id (Id (Id)) import Data.Json.Util (readUTCTimeMillis) import Data.UUID qualified as UUID (fromString) @@ -25,28 +26,40 @@ import Wire.API.Team.Role (Role (RoleAdmin, RoleExternalPartner, RoleMember, Rol import Wire.API.User import Wire.API.User.Search (Sso (..), TeamContact (..)) -testObject_TeamContact_user_1 :: TeamContact -testObject_TeamContact_user_1 = +teamContactTemplate :: TeamContact +teamContactTemplate = TeamContact - { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000200000001")), + { teamContactUserId = Id (fromJust (UUID.fromString "")), teamContactName = "", teamContactColorId = Nothing, teamContactHandle = Nothing, teamContactTeam = Nothing, + teamContactEmail = Nothing, + teamContactCreatedAt = Nothing, + teamContactManagedBy = Nothing, + teamContactSAMLIdp = Nothing, + teamContactRole = Nothing, + teamContactScimExternalId = Nothing, + teamContactSso = Nothing, + teamContactEmailUnvalidated = Nothing, + teamContactUserGroups = [], + teamContactSearchable = True + } + +testObject_TeamContact_user_1 :: TeamContact +testObject_TeamContact_user_1 = + teamContactTemplate + { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000200000001")), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-11T12:52:22.086Z")), - teamContactManagedBy = Nothing, teamContactSAMLIdp = Just "r", teamContactRole = Just RoleAdmin, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" } testObject_TeamContact_user_2 :: TeamContact testObject_TeamContact_user_2 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000002")), teamContactName = "\160469\35044", teamContactColorId = Just 2, @@ -54,21 +67,14 @@ testObject_TeamContact_user_2 = teamContactTeam = Just (Id (fromJust (UUID.fromString "00000002-0000-0000-0000-000200000001"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-08T03:35:20.125Z")), - teamContactManagedBy = Nothing, teamContactSAMLIdp = Just "N\DC4", - teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleExternalPartner } testObject_TeamContact_user_3 :: TeamContact testObject_TeamContact_user_3 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000002-0000-0000-0000-000000000000")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000002-0000-0002-0000-000100000000"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), @@ -76,91 +82,55 @@ testObject_TeamContact_user_3 = teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "\"c`", teamContactRole = Just RoleMember, - teamContactScimExternalId = Nothing, - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") } testObject_TeamContact_user_4 :: TeamContact testObject_TeamContact_user_4 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000002-0000-0001-0000-000000000002")), - teamContactName = "", - teamContactColorId = Nothing, teamContactHandle = Just "U6", - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, - teamContactManagedBy = Nothing, - teamContactSAMLIdp = Nothing, - teamContactRole = Nothing, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") } testObject_TeamContact_user_5 :: TeamContact testObject_TeamContact_user_5 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000200000000")), teamContactName = "8", teamContactColorId = Just (-3), teamContactHandle = Just "\RS", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000002-0000-0000-0000-000200000000"))), - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-09T19:22:27.168Z")), - teamContactManagedBy = Nothing, teamContactSAMLIdp = Just "\12641", - teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleExternalPartner } testObject_TeamContact_user_6 :: TeamContact testObject_TeamContact_user_6 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000000")), teamContactName = "z", - teamContactColorId = Nothing, - teamContactHandle = Nothing, - teamContactTeam = Nothing, - teamContactEmail = Nothing, - teamContactCreatedAt = Nothing, - teamContactManagedBy = Just ManagedByWire, - teamContactSAMLIdp = Nothing, - teamContactRole = Nothing, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactManagedBy = Just ManagedByWire } testObject_TeamContact_user_7 :: TeamContact testObject_TeamContact_user_7 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000002-0000-0002-0000-000000000000")), teamContactName = "7", - teamContactColorId = Nothing, - teamContactHandle = Nothing, - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-06T11:54:20.119Z")), teamContactManagedBy = Just ManagedByWire, - teamContactSAMLIdp = Nothing, teamContactRole = Just RoleAdmin, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") } testObject_TeamContact_user_8 :: TeamContact testObject_TeamContact_user_8 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000000")), teamContactName = "\1067719Z", teamContactColorId = Just (-1), @@ -170,172 +140,123 @@ testObject_TeamContact_user_8 = teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-06T04:27:11.179Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "", - teamContactRole = Just RoleMember, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleMember } testObject_TeamContact_user_9 :: TeamContact testObject_TeamContact_user_9 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000000")), teamContactName = "h,", teamContactColorId = Just 2, - teamContactHandle = Nothing, teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000200000001"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-11T18:31:16.554Z")), teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "\164542\US", - teamContactRole = Just RoleAdmin, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleAdmin } testObject_TeamContact_user_10 :: TeamContact testObject_TeamContact_user_10 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000002-0000-0000-0000-000100000001")), teamContactName = "or", teamContactColorId = Just 2, teamContactHandle = Just "", - teamContactTeam = Nothing, - teamContactEmail = Nothing, teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-06T05:51:36.680Z")), teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "P-\EM", teamContactRole = Just RoleMember, - teamContactScimExternalId = Nothing, - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") } testObject_TeamContact_user_11 :: TeamContact testObject_TeamContact_user_11 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000000000002")), teamContactName = "\ACK", teamContactColorId = Just (-3), - teamContactHandle = Nothing, - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByScim, - teamContactSAMLIdp = Nothing, - teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactRole = Just RoleExternalPartner } testObject_TeamContact_user_12 :: TeamContact testObject_TeamContact_user_12 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000002-0000-0000-0000-000200000000")), teamContactName = "\10652w", - teamContactColorId = Nothing, teamContactHandle = Just "", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000000000000"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-06T13:09:44.601Z")), - teamContactManagedBy = Nothing, - teamContactSAMLIdp = Just "\SUB:", - teamContactRole = Nothing, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSAMLIdp = Just "\SUB:" } testObject_TeamContact_user_13 :: TeamContact testObject_TeamContact_user_13 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000002-0000-0002-0000-000100000001")), teamContactName = "\SUB\983552P", teamContactColorId = Just 0, teamContactHandle = Just "S", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0002-0000-000200000000"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByScim, teamContactSAMLIdp = Just "\993657\a", teamContactRole = Just RoleMember, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" } testObject_TeamContact_user_14 :: TeamContact testObject_TeamContact_user_14 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000000")), teamContactName = "`+", teamContactColorId = Just (-3), teamContactHandle = Just "\"\US\DC4", - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-08T20:31:37.388Z")), teamContactManagedBy = Just ManagedByScim, - teamContactSAMLIdp = Nothing, teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f" } testObject_TeamContact_user_15 :: TeamContact testObject_TeamContact_user_15 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000002-0000-0002-0000-000100000002")), teamContactName = "\54517}O", - teamContactColorId = Nothing, teamContactHandle = Just "J", - teamContactTeam = Nothing, teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-11T14:15:19.890Z")), - teamContactManagedBy = Nothing, teamContactSAMLIdp = Just "", teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Nothing, - teamContactSso = Nothing, - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") } testObject_TeamContact_user_16 :: TeamContact testObject_TeamContact_user_16 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0000-0000-000000000002")), teamContactName = "\ACK6J", teamContactColorId = Just (-1), - teamContactHandle = Nothing, teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0002-0000-000200000001"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-08T15:43:05.866Z")), teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "k", - teamContactRole = Nothing, - teamContactScimExternalId = Nothing, teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") } testObject_TeamContact_user_17 :: TeamContact testObject_TeamContact_user_17 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000000-0000-0001-0000-000200000001")), teamContactName = "/MB", teamContactColorId = Just (-3), - teamContactHandle = Nothing, teamContactTeam = Just (Id (fromJust (UUID.fromString "00000002-0000-0000-0000-000200000001"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-10T20:50:28.410Z")), @@ -343,54 +264,39 @@ testObject_TeamContact_user_17 = teamContactSAMLIdp = Just "\138052", teamContactRole = Just RoleOwner, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") } testObject_TeamContact_user_18 :: TeamContact testObject_TeamContact_user_18 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000002-0000-0001-0000-000000000002")), teamContactName = "[\1078188C", teamContactColorId = Just 3, - teamContactHandle = Nothing, teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0002-0000-000000000000"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), - teamContactCreatedAt = Nothing, teamContactManagedBy = Just ManagedByWire, teamContactSAMLIdp = Just "\DC2", teamContactRole = Just RoleOwner, - teamContactScimExternalId = Nothing, - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") } testObject_TeamContact_user_19 :: TeamContact testObject_TeamContact_user_19 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0002-0000-000200000002")), - teamContactName = "", teamContactColorId = Just (-3), - teamContactHandle = Nothing, teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0002-0000-000200000002"))), teamContactEmail = Just (unsafeEmailAddress "some" "example"), teamContactCreatedAt = Just (fromJust (readUTCTimeMillis "1864-05-10T11:20:36.673Z")), - teamContactManagedBy = Nothing, - teamContactSAMLIdp = Nothing, teamContactRole = Just RoleExternalPartner, - teamContactScimExternalId = Nothing, - teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f"), - teamContactEmailUnvalidated = Nothing, - teamContactUserGroups = [] + teamContactSso = Just (Sso "https://example.com/issuer/123" "0307979d-c742-4421-954a-9ceb1f22e58f") } testObject_TeamContact_user_20 :: TeamContact testObject_TeamContact_user_20 = - TeamContact + teamContactTemplate { teamContactUserId = Id (fromJust (UUID.fromString "00000001-0000-0001-0000-000100000000")), - teamContactName = "", teamContactColorId = Just (-3), teamContactHandle = Just "0\1085403\1021449", teamContactTeam = Just (Id (fromJust (UUID.fromString "00000001-0000-0002-0000-000100000001"))), @@ -400,7 +306,5 @@ testObject_TeamContact_user_20 = teamContactSAMLIdp = Just "", teamContactRole = Just RoleOwner, teamContactScimExternalId = Just "0307979d-c742-4421-954a-9ceb1f22e58f", - teamContactSso = Nothing, - teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example"), - teamContactUserGroups = [] + teamContactEmailUnvalidated = Just (unsafeEmailAddress "some" "example") } diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/UserProfile_user.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/UserProfile_user.hs index 038c216140..5f47e25dff 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/UserProfile_user.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/UserProfile_user.hs @@ -51,7 +51,8 @@ testObject_UserProfile_user_1 = profileEmail = Nothing, profileLegalholdStatus = UserLegalHoldDisabled, profileSupportedProtocols = defSupportedProtocols, - profileType = UserTypeRegular + profileType = UserTypeRegular, + profileSearchable = True } testObject_UserProfile_user_2 :: UserProfile @@ -82,5 +83,6 @@ testObject_UserProfile_user_2 = profileEmail = Just (unsafeEmailAddress "some" "example"), profileLegalholdStatus = UserLegalHoldNoConsent, profileSupportedProtocols = defSupportedProtocols, - profileType = UserTypeApp + profileType = UserTypeApp, + profileSearchable = True } diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/User_user.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/User_user.hs index 8d45d8da2a..3d46bf5bf9 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/User_user.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/User_user.hs @@ -68,7 +68,8 @@ testObject_User_user_1 = userExpire = Nothing, userTeam = Nothing, userManagedBy = ManagedByWire, - userSupportedProtocols = defSupportedProtocols + userSupportedProtocols = defSupportedProtocols, + userSearchable = True } testObject_User_user_2 :: User @@ -107,7 +108,8 @@ testObject_User_user_2 = userExpire = Just (fromJust (readUTCTimeMillis "1864-05-11T17:06:58.936Z")), userTeam = Nothing, userManagedBy = ManagedByWire, - userSupportedProtocols = mempty + userSupportedProtocols = mempty, + userSearchable = True } testObject_User_user_3 :: User @@ -139,7 +141,8 @@ testObject_User_user_3 = userExpire = Just (fromJust (readUTCTimeMillis "1864-05-09T20:12:05.821Z")), userTeam = Just (Id (fromJust (UUID.fromString "00000002-0000-0001-0000-000200000000"))), userManagedBy = ManagedByWire, - userSupportedProtocols = defSupportedProtocols + userSupportedProtocols = defSupportedProtocols, + userSearchable = True } testObject_User_user_4 :: User @@ -176,7 +179,8 @@ testObject_User_user_4 = userExpire = Just (fromJust (readUTCTimeMillis "1864-05-09T14:25:26.089Z")), userTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000002"))), userManagedBy = ManagedByScim, - userSupportedProtocols = defSupportedProtocols + userSupportedProtocols = defSupportedProtocols, + userSearchable = True } testObject_User_user_5 :: User @@ -213,5 +217,6 @@ testObject_User_user_5 = userExpire = Just (fromJust (readUTCTimeMillis "1864-05-09T14:25:26.089Z")), userTeam = Just (Id (fromJust (UUID.fromString "00000000-0000-0000-0000-000100000002"))), userManagedBy = ManagedByScim, - userSupportedProtocols = defSupportedProtocols + userSupportedProtocols = defSupportedProtocols, + userSearchable = True } diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/ListUsersById.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/ListUsersById.hs index 827ab7d3e2..34e78a8f40 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/ListUsersById.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/ListUsersById.hs @@ -53,7 +53,8 @@ profile1 = profileEmail = Nothing, profileLegalholdStatus = UserLegalHoldDisabled, profileSupportedProtocols = defSupportedProtocols, - profileType = UserTypeRegular + profileType = UserTypeRegular, + profileSearchable = True } profile2 = UserProfile @@ -71,7 +72,8 @@ profile2 = profileEmail = Nothing, profileLegalholdStatus = UserLegalHoldDisabled, profileSupportedProtocols = Set.fromList [BaseProtocolProteusTag, BaseProtocolMLSTag], - profileType = UserTypeRegular + profileType = UserTypeRegular, + profileSearchable = True } testObject_ListUsersById_user_1 :: ListUsersById diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/UserEvent.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/UserEvent.hs index 9c8fa6666f..e24036faaa 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/UserEvent.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/UserEvent.hs @@ -242,7 +242,8 @@ alice = userExpire = Nothing, userTeam = Just $ Id (fromJust (UUID.fromString "bb843450-b2f5-4ec8-90bd-52c7d5f1d22e")), userManagedBy = ManagedByWire, - userSupportedProtocols = defSupportedProtocols + userSupportedProtocols = defSupportedProtocols, + userSearchable = True } bob :: User @@ -271,5 +272,6 @@ bob = userExpire = Nothing, userTeam = Nothing, userManagedBy = ManagedByWire, - userSupportedProtocols = defSupportedProtocols + userSupportedProtocols = defSupportedProtocols, + userSearchable = True } diff --git a/libs/wire-api/test/unit/Test/Wire/API/User.hs b/libs/wire-api/test/unit/Test/Wire/API/User.hs index 32edb7f18c..11ce3d914e 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/User.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/User.hs @@ -117,7 +117,25 @@ testUserProfile = do uid <- Id <$> UUID.nextRandom let domain = Domain "example.com" let colour = ColourId 0 - let userProfile = UserProfile (Qualified uid domain) (Name "name") Nothing (Pict []) [] colour False Nothing Nothing Nothing Nothing Nothing UserLegalHoldNoConsent defSupportedProtocols UserTypeRegular + let userProfile = + UserProfile + { profileQualifiedId = Qualified uid domain, + profileName = Name "name", + profileTextStatus = Nothing, + profilePict = Pict [], + profileAssets = [], + profileAccentId = colour, + profileDeleted = False, + profileService = Nothing, + profileHandle = Nothing, + profileExpire = Nothing, + profileTeam = Nothing, + profileEmail = Nothing, + profileLegalholdStatus = UserLegalHoldNoConsent, + profileSupportedProtocols = defSupportedProtocols, + profileType = UserTypeRegular, + profileSearchable = True + } let profileJSONAsText = show $ Aeson.encode userProfile let msg = "toJSON encoding must not convert Nothing to null, but instead omit those json fields for backwards compatibility. UserProfileJSON:" <> profileJSONAsText assertBool msg (not $ "null" `isInfixOf` profileJSONAsText) diff --git a/libs/wire-subsystems/src/Wire/AppSubsystem/Interpreter.hs b/libs/wire-subsystems/src/Wire/AppSubsystem/Interpreter.hs index d7cf1f05ad..43a1d316a8 100644 --- a/libs/wire-subsystems/src/Wire/AppSubsystem/Interpreter.hs +++ b/libs/wire-subsystems/src/Wire/AppSubsystem/Interpreter.hs @@ -156,7 +156,8 @@ appNewStoredUser creator new = do expires = Nothing, teamId = creator.teamId, managedBy = defaultManagedBy, - supportedProtocols = defAppSupportedProtocols + supportedProtocols = defAppSupportedProtocols, + searchable = True } defAppSupportedProtocols :: Set BaseProtocolTag diff --git a/libs/wire-subsystems/src/Wire/IndexedUserStore/ElasticSearch.hs b/libs/wire-subsystems/src/Wire/IndexedUserStore/ElasticSearch.hs index 28a5e61227..99278e33fb 100644 --- a/libs/wire-subsystems/src/Wire/IndexedUserStore/ElasticSearch.hs +++ b/libs/wire-subsystems/src/Wire/IndexedUserStore/ElasticSearch.hs @@ -222,7 +222,13 @@ defaultUserQuery searcher mSearcherTeamId teamSearchInfo (normalized -> term') = ES.boolQueryMustNotMatch = [termQ "handle" term'] } ], - ES.boolQueryShouldMatch = [ES.QueryExistsQuery (ES.FieldName "handle")] + ES.boolQueryShouldMatch = [ES.QueryExistsQuery (ES.FieldName "handle")], + -- The following matches both where searchable is true + -- or where the field is missing. There didn't seem to + -- be a more readable way to express + -- "not(exists(searchable) or searchable = true" in + -- Elastic Search. + ES.boolQueryMustNotMatch = [ES.TermQuery (ES.Term "searchable" "false") Nothing] } -- This reduces relevance on users not in team of search by 90% (no -- science behind that number). If the searcher is not part of a team the @@ -245,7 +251,7 @@ paginateTeamMembersImpl :: Sem r (SearchResult UserDoc) paginateTeamMembersImpl cfg BrowseTeamFilters {..} maxResults mPagingState = do let (IndexQuery q f sortSpecs) = - teamUserSearchQuery teamId mQuery mRoleFilter mSortBy mSortOrder mEmailVerificationFilter + teamUserSearchQuery teamId mQuery mRoleFilter mSortBy mSortOrder mEmailVerificationFilter searchable let search = (ES.mkSearch (Just q) (Just f)) { -- we are requesting one more result than the page size to determine if there is a next page @@ -311,8 +317,9 @@ teamUserSearchQuery :: Maybe TeamUserSearchSortBy -> Maybe TeamUserSearchSortOrder -> Maybe EmailVerificationFilter -> + Bool -> IndexQuery TeamContact -teamUserSearchQuery tid mbSearchText mRoleFilter mSortBy mSortOrder mEmailFilter = +teamUserSearchQuery tid mbSearchText mRoleFilter mSortBy mSortOrder mEmailFilter searchable = IndexQuery ( maybe (ES.MatchAllQuery Nothing) @@ -364,13 +371,16 @@ teamUserSearchQuery tid mbSearchText mRoleFilter mSortBy mSortOrder mEmailFilter } teamFilter :: ES.Filter - teamFilter = - ES.Filter $ - ES.QueryBoolQuery - boolQuery - { ES.boolQueryMustMatch = ES.TermQuery (ES.Term "team" $ idToText tid) Nothing : roleFilter <> emailFilter - } + teamFilter = ES.Filter $ ES.QueryBoolQuery boolQuery {ES.boolQueryMustMatch = mustMatch} where + mustMatch :: [ES.Query] + mustMatch = ES.TermQuery (ES.Term "team" $ idToText tid) Nothing : roleFilter <> emailFilter <> searchableFilter + + searchableFilter :: [ES.Query] + searchableFilter = if searchable + then [] + else [ES.TermQuery (ES.Term "searchable" "false") Nothing] + roleFilter :: [ES.Query] roleFilter = case mRoleFilter of diff --git a/libs/wire-subsystems/src/Wire/StoredUser.hs b/libs/wire-subsystems/src/Wire/StoredUser.hs index 5627f9a063..fad8c513fb 100644 --- a/libs/wire-subsystems/src/Wire/StoredUser.hs +++ b/libs/wire-subsystems/src/Wire/StoredUser.hs @@ -40,7 +40,8 @@ data StoredUser = StoredUser handle :: Maybe Handle, teamId :: Maybe TeamId, managedBy :: Maybe ManagedBy, - supportedProtocols :: Maybe (Set BaseProtocolTag) + supportedProtocols :: Maybe (Set BaseProtocolTag), + searchable :: Maybe Bool } deriving (Show, Eq, Ord, Generic) deriving (Arbitrary) via (GenericUniform StoredUser) @@ -98,7 +99,8 @@ mkUserFromStored domain defaultLocale storedUser = userManagedBy = fromMaybe ManagedByWire storedUser.managedBy, userSupportedProtocols = case storedUser.supportedProtocols of Nothing -> defSupportedProtocols - Just ps -> if S.null ps then defSupportedProtocols else ps + Just ps -> if S.null ps then defSupportedProtocols else ps, + userSearchable = (fromMaybe True storedUser.searchable) } toLocale :: Locale -> (Maybe Language, Maybe Country) -> Locale @@ -147,7 +149,8 @@ data NewStoredUser = NewStoredUser handle :: Maybe Handle, teamId :: Maybe TeamId, managedBy :: ManagedBy, - supportedProtocols :: Set BaseProtocolTag + supportedProtocols :: Set BaseProtocolTag, + searchable :: Bool } deriving (Show) @@ -178,7 +181,8 @@ deriving instance Maybe Handle, Maybe TeamId, ManagedBy, - Set BaseProtocolTag + Set BaseProtocolTag, + Bool ) instance HasField "service" NewStoredUser (Maybe ServiceRef) where @@ -203,5 +207,6 @@ newStoredUserToUser (Qualified new domain) = userExpire = new.expires, userTeam = new.teamId, userManagedBy = new.managedBy, - userSupportedProtocols = new.supportedProtocols + userSupportedProtocols = new.supportedProtocols, + userSearchable = new.searchable } diff --git a/libs/wire-subsystems/src/Wire/UserSearch/Types.hs b/libs/wire-subsystems/src/Wire/UserSearch/Types.hs index 8490fdebd4..3727fb904d 100644 --- a/libs/wire-subsystems/src/Wire/UserSearch/Types.hs +++ b/libs/wire-subsystems/src/Wire/UserSearch/Types.hs @@ -58,7 +58,8 @@ data UserDoc = UserDoc udSearchVisibilityInbound :: Maybe SearchVisibilityInbound, udScimExternalId :: Maybe Text, udSso :: Maybe Sso, - udEmailUnvalidated :: Maybe EmailAddress + udEmailUnvalidated :: Maybe EmailAddress, + udSearchable :: Maybe Bool } deriving (Eq, Show, Generic) deriving (Arbitrary) via (GenericUniform UserDoc) @@ -81,7 +82,8 @@ instance ToJSON UserDoc where searchVisibilityInboundFieldName .= udSearchVisibilityInbound ud, "scim_external_id" .= udScimExternalId ud, "sso" .= udSso ud, - "email_unvalidated" .= udEmailUnvalidated ud + "email_unvalidated" .= udEmailUnvalidated ud, + "searchable" .= udSearchable ud ] instance FromJSON UserDoc where @@ -103,6 +105,7 @@ instance FromJSON UserDoc where <*> o .:? "scim_external_id" <*> o .:? "sso" <*> o .:? "email_unvalidated" + <*> o .:? "searchable" searchVisibilityInboundFieldName :: Key searchVisibilityInboundFieldName = "search_visibility_inbound" @@ -123,7 +126,8 @@ userDocToTeamContact userGroups UserDoc {..} = teamContactEmail = udEmail, teamContactCreatedAt = udCreatedAt, teamContactColorId = fromIntegral . fromColourId <$> udColourId, - teamContactUserGroups = userGroups + teamContactUserGroups = userGroups, + teamContactSearchable = fromMaybe True udSearchable } -- | Outbound search restrictions configured by team admin of the searcher. This @@ -202,7 +206,8 @@ data BrowseTeamFilters = BrowseTeamFilters mRoleFilter :: Maybe RoleFilter, mSortBy :: Maybe TeamUserSearchSortBy, mSortOrder :: Maybe TeamUserSearchSortOrder, - mEmailVerificationFilter :: Maybe EmailVerificationFilter + mEmailVerificationFilter :: Maybe EmailVerificationFilter, + searchable :: Bool } deriving (Eq, Show) diff --git a/libs/wire-subsystems/src/Wire/UserStore.hs b/libs/wire-subsystems/src/Wire/UserStore.hs index 9ab0ee7b0e..e8bde66108 100644 --- a/libs/wire-subsystems/src/Wire/UserStore.hs +++ b/libs/wire-subsystems/src/Wire/UserStore.hs @@ -78,6 +78,7 @@ data UserStore m a where GetRichInfo :: UserId -> UserStore m (Maybe RichInfoAssocList) GetUserAuthenticationInfo :: UserId -> UserStore m (Maybe (Maybe Password, AccountStatus)) DeleteEmail :: UserId -> UserStore m () + SetUserSearchable :: UserId -> Bool -> UserStore m () makeSem ''UserStore diff --git a/libs/wire-subsystems/src/Wire/UserStore/Cassandra.hs b/libs/wire-subsystems/src/Wire/UserStore/Cassandra.hs index 07d101c096..e585dba8e0 100644 --- a/libs/wire-subsystems/src/Wire/UserStore/Cassandra.hs +++ b/libs/wire-subsystems/src/Wire/UserStore/Cassandra.hs @@ -43,6 +43,7 @@ interpretUserStoreCassandra casClient = GetRichInfo uid -> getRichInfoImpl uid GetUserAuthenticationInfo uid -> getUserAuthenticationInfoImpl uid DeleteEmail uid -> deleteEmailImpl uid + SetUserSearchable uid searchable -> setUserSearchableImpl uid searchable createUserImpl :: NewStoredUser -> Maybe (ConvId, Maybe TeamId) -> Client () createUserImpl new mbConv = retry x5 . batch $ do @@ -102,6 +103,7 @@ getIndexUserBaseQuery = managed_by, writetime(managed_by), sso_id, writetime(sso_id), email_unvalidated, writetime(email_unvalidated), + searchable, writetime(searchable), writetime(write_time_bumper) FROM user |] @@ -234,6 +236,12 @@ getRichInfoImpl uid = deleteEmailImpl :: UserId -> Client () deleteEmailImpl u = retry x5 $ write userEmailDelete (params LocalQuorum (Identity u)) +setUserSearchableImpl :: UserId -> Bool -> Client () +setUserSearchableImpl uid searchable = retry x5 $ write q (params LocalQuorum (searchable, uid)) + where + q :: PrepQuery W (Bool, UserId) () + q = "UPDATE user SET searchable = ? WHERE id = ?" + -------------------------------------------------------------------------------- -- Queries @@ -241,8 +249,8 @@ insertUser :: PrepQuery W (TupleType NewStoredUser) () insertUser = "INSERT INTO user (id, name, text_status, picture, assets, email, sso_id, \ \accent_id, password, activated, status, expires, language, \ - \country, provider, service, handle, team, managed_by, supported_protocols) \ - \VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" + \country, provider, service, handle, team, managed_by, supported_protocols, searchable) \ + \VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" insertServiceUser :: PrepQuery W (ProviderId, ServiceId, BotId, ConvId, Maybe TeamId) () insertServiceUser = @@ -259,7 +267,7 @@ selectUsers = [sql| SELECT id, name, text_status, picture, email, email_unvalidated, sso_id, accent_id, assets, activated, status, expires, language, country, provider, - service, handle, team, managed_by, supported_protocols + service, handle, team, managed_by, supported_protocols, searchable FROM user WHERE id IN ? |] diff --git a/libs/wire-subsystems/src/Wire/UserStore/IndexUser.hs b/libs/wire-subsystems/src/Wire/UserStore/IndexUser.hs index 563ebb8d96..6c5456283f 100644 --- a/libs/wire-subsystems/src/Wire/UserStore/IndexUser.hs +++ b/libs/wire-subsystems/src/Wire/UserStore/IndexUser.hs @@ -38,6 +38,7 @@ data IndexUser = IndexUser managedBy :: Maybe (WithWritetime ManagedBy), ssoId :: Maybe (WithWritetime UserSSOId), unverifiedEmail :: Maybe (WithWritetime EmailAddress), + searchable :: Maybe (WithWritetime Bool), writeTimeBumper :: Maybe (Writetime WriteTimeBumper) } deriving (Eq, Show) @@ -57,6 +58,7 @@ type instance Maybe ManagedBy, Maybe (Writetime ManagedBy), Maybe UserSSOId, Maybe (Writetime UserSSOId), Maybe EmailAddress, Maybe (Writetime EmailAddress), + Maybe Bool, Maybe (Writetime Bool), Maybe (Writetime WriteTimeBumper) ) @@ -74,6 +76,7 @@ instance Record IndexUser where value <$> managedBy, writetime <$> managedBy, value <$> ssoId, writetime <$> ssoId, value <$> unverifiedEmail, writetime <$> unverifiedEmail, + value <$> searchable, writetime <$> searchable, writeTimeBumper ) @@ -90,6 +93,7 @@ instance Record IndexUser where managedBy, tManagedBy, ssoId, tSsoId, emailUnvalidated, tEmailUnvalidated, + searchable, tSearchable, tWriteTimeBumper ) = IndexUser { userId = u, @@ -104,6 +108,7 @@ instance Record IndexUser where managedBy = WithWriteTime <$> managedBy <*> tManagedBy, ssoId = WithWriteTime <$> ssoId <*> tSsoId, unverifiedEmail = WithWriteTime <$> emailUnvalidated <*> tEmailUnvalidated, + searchable = WithWriteTime <$> searchable <*> tSearchable, writeTimeBumper = tWriteTimeBumper } {- ORMOLU_ENABLE -} @@ -122,8 +127,9 @@ indexUserToVersion role IndexUser {..} = const () <$$> fmap writetime managedBy, const () <$$> fmap writetime ssoId, const () <$$> fmap writetime unverifiedEmail, - const () <$$> writeTimeBumper, - const () <$$> fmap writetime role + const () <$$> fmap writetime role, + const () <$$> fmap writetime searchable, + const () <$$> writeTimeBumper ] indexUserToDoc :: SearchVisibilityInbound -> Maybe Role -> IndexUser -> UserDoc @@ -131,7 +137,8 @@ indexUserToDoc searchVisInbound mRole IndexUser {..} = if shouldIndex then UserDoc - { udEmailUnvalidated = value <$> unverifiedEmail, + { udSearchable = value <$> searchable, + udEmailUnvalidated = value <$> unverifiedEmail, udSso = sso . value =<< ssoId, udScimExternalId = join $ scimExternalId <$> (value <$> managedBy) <*> (value <$> ssoId), udSearchVisibilityInbound = Just searchVisInbound, @@ -190,7 +197,8 @@ normalized = transliterate (trans "Any-Latin; Latin-ASCII; Lower") emptyUserDoc :: UserId -> UserDoc emptyUserDoc uid = UserDoc - { udEmailUnvalidated = Nothing, + { udSearchable = Nothing, + udEmailUnvalidated = Nothing, udSso = Nothing, udScimExternalId = Nothing, udSearchVisibilityInbound = Nothing, diff --git a/libs/wire-subsystems/src/Wire/UserSubsystem.hs b/libs/wire-subsystems/src/Wire/UserSubsystem.hs index 9ba1e37285..6de770e73d 100644 --- a/libs/wire-subsystems/src/Wire/UserSubsystem.hs +++ b/libs/wire-subsystems/src/Wire/UserSubsystem.hs @@ -179,6 +179,7 @@ data UserSubsystem m a where RemoveEmailEither :: Local UserId -> UserSubsystem m (Either UserSubsystemError ()) GetUserTeam :: UserId -> UserSubsystem m (Maybe TeamId) CheckUserIsAdmin :: UserId -> UserSubsystem m TeamId + SetUserSearchable :: Local UserId -> UserId -> Bool -> UserSubsystem m () -- | the return type of 'CheckHandle' data CheckHandleResp diff --git a/libs/wire-subsystems/src/Wire/UserSubsystem/Interpreter.hs b/libs/wire-subsystems/src/Wire/UserSubsystem/Interpreter.hs index 45429e315c..653f68fc16 100644 --- a/libs/wire-subsystems/src/Wire/UserSubsystem/Interpreter.hs +++ b/libs/wire-subsystems/src/Wire/UserSubsystem/Interpreter.hs @@ -168,6 +168,7 @@ runUserSubsystem authInterpreter = interpret $ RemoveEmailEither luid -> removeEmailEitherImpl luid UserSubsystem.GetUserTeam uid -> getUserTeamImpl uid CheckUserIsAdmin uid -> checkUserIsAdminImpl uid + UserSubsystem.SetUserSearchable luid uid searchability -> setUserSearchableImpl luid uid searchability scimExtId :: StoredUser -> Maybe Text scimExtId su = do @@ -854,7 +855,7 @@ searchLocally searcher searchTerm maybeMaxResults = do isContactVisible = (config.searchSameTeamOnly && (snd . tUnqualified $ searcher) == storedUser.teamId) || (not config.searchSameTeamOnly) - if isContactVisible + if isContactVisible && fromMaybe True storedUser.searchable then pure contact else MaybeT $ pure Nothing @@ -1130,3 +1131,21 @@ checkUserIsAdminImpl uid = do tid <- maybe (throw UserSubsystemInsufficientPermissions) pure =<< UserStore.getUserTeam uid ensurePermissions uid tid [CreateUpdateDeleteIdp] pure tid + +setUserSearchableImpl :: + ( Member UserStore r, + Member (Error UserSubsystemError) r, + Member TeamSubsystem r, + Member GalleyAPIAccess r, + Member IndexedUserStore r, + Member Metrics r + ) => + Local UserId -> + UserId -> + Bool -> + Sem r () +setUserSearchableImpl luid uid searchable = do + tid <- maybe (throw UserSubsystemInsufficientPermissions) pure =<< UserStore.getUserTeam uid + ensurePermissions (tUnqualified luid) tid [SetMemberSearchable] + UserStore.setUserSearchable uid searchable + syncUserIndex uid diff --git a/libs/wire-subsystems/test/unit/Wire/MockInterpreters/UserStore.hs b/libs/wire-subsystems/test/unit/Wire/MockInterpreters/UserStore.hs index ae5396691c..9c8330f756 100644 --- a/libs/wire-subsystems/test/unit/Wire/MockInterpreters/UserStore.hs +++ b/libs/wire-subsystems/test/unit/Wire/MockInterpreters/UserStore.hs @@ -90,6 +90,12 @@ inMemoryUserStoreInterpreter = interpret $ \case gets $ \users -> do user <- find (\user -> user.id == uid) users user.teamId + SetUserSearchable uid searchable -> modify $ map f + where + f u = + if u.id == uid + then u {Wire.StoredUser.searchable = Just searchable} :: StoredUser + else u storedUserToIndexUser :: StoredUser -> IndexUser storedUserToIndexUser storedUser = @@ -109,6 +115,7 @@ storedUserToIndexUser storedUser = managedBy = withDefaultTime <$> storedUser.managedBy, ssoId = withDefaultTime <$> storedUser.ssoId, unverifiedEmail = Nothing, + searchable = withDefaultTime <$> storedUser.searchable, writeTimeBumper = Nothing } @@ -160,5 +167,6 @@ newStoredUserToStoredUser new = handle = new.handle, teamId = new.teamId, managedBy = Just new.managedBy, - supportedProtocols = Just new.supportedProtocols + supportedProtocols = Just new.supportedProtocols, + searchable = Just new.searchable } diff --git a/libs/wire-subsystems/test/unit/Wire/MockInterpreters/UserSubsystem.hs b/libs/wire-subsystems/test/unit/Wire/MockInterpreters/UserSubsystem.hs index f412a6c076..66e43c6b9d 100644 --- a/libs/wire-subsystems/test/unit/Wire/MockInterpreters/UserSubsystem.hs +++ b/libs/wire-subsystems/test/unit/Wire/MockInterpreters/UserSubsystem.hs @@ -47,6 +47,7 @@ userSubsystemTestInterpreter initialUsers = SearchUsers {} -> error "SearchUsers: implement on demand (userSubsystemInterpreter)" BrowseTeam {} -> error "BrowseTeam: implement on demand (userSubsystemInterpreter)" CheckUserIsAdmin {} -> error "CheckUserIsAdmin: implement on demand (userSubsystemInterpreter)" + SetUserSearchable {} -> error "SetUserSearchable: implement on demand (userSubsystemInterpreter)" toProfile :: User -> UserProfile toProfile u = mkUserProfileWithEmail (userEmail u) u UserLegalHoldDisabled diff --git a/libs/wire-subsystems/test/unit/Wire/UserSearch/TypesSpec.hs b/libs/wire-subsystems/test/unit/Wire/UserSearch/TypesSpec.hs index 5e82d9a569..db2c728507 100644 --- a/libs/wire-subsystems/test/unit/Wire/UserSearch/TypesSpec.hs +++ b/libs/wire-subsystems/test/unit/Wire/UserSearch/TypesSpec.hs @@ -46,7 +46,8 @@ userDoc1 = udSearchVisibilityInbound = Nothing, udScimExternalId = Nothing, udSso = Nothing, - udEmailUnvalidated = Nothing + udEmailUnvalidated = Nothing, + udSearchable = Nothing -- TODO: or Just True? } -- Dont touch this. This represents serialized legacy data. diff --git a/services/brig/src/Brig/API/Public.hs b/services/brig/src/Brig/API/Public.hs index 96f7a8a637..00d640e452 100644 --- a/services/brig/src/Brig/API/Public.hs +++ b/services/brig/src/Brig/API/Public.hs @@ -140,7 +140,7 @@ import Wire.API.SwaggerHelper (cleanupSwagger) import Wire.API.SystemSettings import Wire.API.Team qualified as Public import Wire.API.Team.LegalHold (LegalholdProtectee (..)) -import Wire.API.Team.Member (HiddenPerm (..), hasPermission) +import Wire.API.Team.Member (HiddenPerm (..), IsPerm (..), hasPermission) import Wire.API.User (RegisterError (RegisterErrorAllowlistError)) import Wire.API.User qualified as Public import Wire.API.User.Activation qualified as Public @@ -454,6 +454,7 @@ servantSitemap = :<|> Named @"send-verification-code" sendVerificationCode :<|> Named @"get-rich-info" getRichInfo :<|> Named @"get-supported-protocols" getSupportedProtocols + :<|> Named @"set-user-searchable" setUserSearchableH userGroupAPI :: ServerT UserGroupAPI (Handler r) userGroupAPI = @@ -644,9 +645,13 @@ browseTeamHandler :: Maybe (Range 1 500 Int) -> Maybe Public.PagingState -> Maybe EmailVerificationFilter -> + Maybe Bool -> Handler r (Public.SearchResult Public.TeamContact) -browseTeamHandler uid tid mQuery mRoleFilter mTeamUserSearchSortBy mTeamUserSearchSortOrder mMaxResults mPagingState mEmailFilter = do - let browseTeamFilters = BrowseTeamFilters tid mQuery mRoleFilter mTeamUserSearchSortBy mTeamUserSearchSortOrder mEmailFilter +browseTeamHandler uid tid mQuery mRoleFilter mTeamUserSearchSortBy mTeamUserSearchSortOrder mMaxResults mPagingState mEmailFilter mSearchable = do + let searchable = case mSearchable of + Just False -> False + _ -> True + browseTeamFilters = BrowseTeamFilters tid mQuery mRoleFilter mTeamUserSearchSortBy mTeamUserSearchSortOrder mEmailFilter searchable lift . liftSem $ User.browseTeam uid browseTeamFilters mMaxResults mPagingState setPropertyH :: (Member PropertySubsystem r) => UserId -> ConnId -> Public.PropertyKey -> Public.RawPropertyValue -> Handler r () @@ -854,6 +859,14 @@ getSupportedProtocols lself quid = do user <- maybe (throwStd (errorToWai @'E.UserNotFound)) pure muser pure (Public.profileSupportedProtocols user) +setUserSearchableH :: + (Member UserSubsystem r) => + Local UserId -> + UserId -> + Bool -> + Handler r () +setUserSearchableH zusr uid searchable = lift $ liftSem $ User.setUserSearchable zusr uid searchable + getClientPrekeys :: UserId -> ClientId -> (Handler r) [Public.PrekeyId] getClientPrekeys usr clt = lift (wrapClient $ API.lookupPrekeyIds usr clt) diff --git a/services/brig/src/Brig/Data/User.hs b/services/brig/src/Brig/Data/User.hs index e285999741..6345813536 100644 --- a/services/brig/src/Brig/Data/User.hs +++ b/services/brig/src/Brig/Data/User.hs @@ -141,7 +141,8 @@ newStoredUser u inv tid mbHandle = do expires = e, teamId = tid, managedBy = managedBy, - supportedProtocols = prots + supportedProtocols = prots, + searchable = True -- NewUser doesn't have this field. TODO: should a defSearchable be added to Wire.API.User to be used everywhere? } newStoredUserViaScim :: (MonadReader Env m) => UserId -> Text -> TeamId -> Maybe Locale -> Name -> EmailAddress -> m NewStoredUser @@ -172,7 +173,8 @@ newStoredUserViaScim uid externalId tid locale name email = do expires = Nothing, teamId = Just tid, managedBy = ManagedByScim, - supportedProtocols = defSupportedProtocols + supportedProtocols = defSupportedProtocols, + searchable = True } updateEmail :: (MonadClient m) => UserId -> EmailAddress -> m () @@ -341,14 +343,15 @@ type UserRow = Maybe Handle, Maybe TeamId, Maybe ManagedBy, - Maybe (Set BaseProtocolTag) + Maybe (Set BaseProtocolTag), + Maybe Bool ) usersSelect :: PrepQuery R (Identity [UserId]) UserRow usersSelect = "SELECT id, name, text_status, picture, email, email_unvalidated, sso_id, accent_id, assets, \ \activated, status, expires, language, country, provider, service, \ - \handle, team, managed_by, supported_protocols \ + \handle, team, managed_by, supported_protocols, searchable \ \FROM user where id IN ?" idSelect :: PrepQuery R (Identity UserId) (Identity UserId) @@ -417,7 +420,8 @@ toUsers domain defLocale havePendingInvitations = fmap mk . filter fp _handle, _tid, _managed_by, - _prots + _prots, + _searchable ) -> status /= Just PendingInvitation ) @@ -442,7 +446,8 @@ toUsers domain defLocale havePendingInvitations = fmap mk . filter fp handle, tid, managed_by, - prots + prots, + searchable ) = let ident = toIdentity activated email ssoid expiration = if status == Just Ephemeral then expires else Nothing @@ -465,6 +470,7 @@ toUsers domain defLocale havePendingInvitations = fmap mk . filter fp tid (fromMaybe ManagedByWire managed_by) (fromMaybe defSupportedProtocols prots) + (fromMaybe True searchable) toLocaleWithDefault :: Locale -> (Maybe Language, Maybe Country) -> Locale toLocaleWithDefault _ (Just l, c) = Locale l c diff --git a/services/brig/src/Brig/Provider/API.hs b/services/brig/src/Brig/Provider/API.hs index 80304f53f8..10285f1306 100644 --- a/services/brig/src/Brig/Provider/API.hs +++ b/services/brig/src/Brig/Provider/API.hs @@ -831,7 +831,8 @@ addBot zuid zcon cid add = do handle = Nothing, teamId = Nothing, managedBy = ManagedByWire, - supportedProtocols = defSupportedProtocols + supportedProtocols = defSupportedProtocols, + searchable = True } let newClt = diff --git a/services/brig/src/Brig/User/Search/Index.hs b/services/brig/src/Brig/User/Search/Index.hs index 9d34dc8753..634f059559 100644 --- a/services/brig/src/Brig/User/Search/Index.hs +++ b/services/brig/src/Brig/User/Search/Index.hs @@ -278,6 +278,7 @@ traceES descr act = liftIndexIO $ do -- saml_idp: URL of SAML issuer, not indexed, used for sorting -- managed_by: possible values "scim" or "wire", indexed as keyword -- created_at: date when "activated" state last chagned in epoch-millis, not indexed, used for sorting +-- searchable: Used to filter searchable users -- -- The prefix fields use "prefix_index" analyzer for indexing and "prefix_search" -- analyzer for searching. The "prefix_search" analyzer uses "edge_ngram" filter, this @@ -419,6 +420,14 @@ indexMapping = mpAnalyzer = Nothing, mpFields = mempty }, + "searchable" + .= MappingProperty + { mpType = MPBoolean, + mpStore = False, + mpIndex = True, + mpAnalyzer = Nothing, + mpFields = mempty + }, "scim_external_id" .= MappingProperty { mpType = MPKeyword, @@ -475,7 +484,7 @@ data MappingField = MappingField mfSearchAnalyzer :: Maybe Text } -data MappingPropertyType = MPText | MPKeyword | MPByte | MPDate +data MappingPropertyType = MPText | MPKeyword | MPByte | MPDate | MPBoolean deriving (Eq) instance ToJSON MappingProperty where @@ -494,6 +503,7 @@ instance ToJSON MappingPropertyType where toJSON MPKeyword = Aeson.String "keyword" toJSON MPByte = Aeson.String "byte" toJSON MPDate = Aeson.String "date" + toJSON MPBoolean = Aeson.String "boolean" instance ToJSON MappingField where toJSON mf = diff --git a/services/brig/test/integration/API/User/Account.hs b/services/brig/test/integration/API/User/Account.hs index ca61c03496..4bde9dcd18 100644 --- a/services/brig/test/integration/API/User/Account.hs +++ b/services/brig/test/integration/API/User/Account.hs @@ -808,7 +808,8 @@ testMultipleUsers opts brig = do profileEmail = Nothing, profileLegalholdStatus = UserLegalHoldDisabled, profileSupportedProtocols = defSupportedProtocols, - profileType = UserTypeRegular + profileType = UserTypeRegular, + profileSearchable = True } users = [u1, u2, u3] q = ListUsersByIds $ u5 : u4 : map userQualifiedId users diff --git a/services/galley/src/Galley/Cassandra/Queries.hs b/services/galley/src/Galley/Cassandra/Queries.hs index fd190ff53e..b143103b55 100644 --- a/services/galley/src/Galley/Cassandra/Queries.hs +++ b/services/galley/src/Galley/Cassandra/Queries.hs @@ -135,6 +135,12 @@ selectTeamMember :: ) selectTeamMember = "select perms, invited_by, invited_at, legalhold_status from team_member where team = ? and user = ?" +selectTeamMembersBase :: (IsString a) => [String] -> a +selectTeamMembersBase conds = fromString $ selectFrom <> " where team = ?" <> whereClause <> " order by user" + where + selectFrom = "select user, perms, invited_by, invited_at, legalhold_status from team_member" + whereClause = concatMap (" and " <>) conds + -- | This query fetches **all** members of a team, it should always be paginated selectTeamMembers :: PrepQuery @@ -146,12 +152,7 @@ selectTeamMembers :: Maybe UTCTimeMillis, Maybe UserLegalHoldStatus ) -selectTeamMembers = - [r| - select user, perms, invited_by, invited_at, legalhold_status - from team_member - where team = ? order by user - |] +selectTeamMembers = selectTeamMembersBase [] selectTeamMembersFrom :: PrepQuery @@ -163,12 +164,7 @@ selectTeamMembersFrom :: Maybe UTCTimeMillis, Maybe UserLegalHoldStatus ) -selectTeamMembersFrom = - [r| - select user, perms, invited_by, invited_at, legalhold_status - from team_member - where team = ? and user > ? order by user - |] +selectTeamMembersFrom = selectTeamMembersBase ["user > ?"] selectTeamMembers' :: PrepQuery diff --git a/services/galley/test/integration/API/Util.hs b/services/galley/test/integration/API/Util.hs index 0edd71133b..b26c80ab3d 100644 --- a/services/galley/test/integration/API/Util.hs +++ b/services/galley/test/integration/API/Util.hs @@ -2587,7 +2587,8 @@ mkProfile quid name = profileEmail = Nothing, profileLegalholdStatus = defUserLegalHoldStatus, profileSupportedProtocols = defSupportedProtocols, - profileType = UserTypeRegular + profileType = UserTypeRegular, + profileSearchable = True } -- mock federator