-
Notifications
You must be signed in to change notification settings - Fork 334
[WPB-22549] add type field to user #5022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Cassandra (`brig.user`) now keeps track of user types, only for newly created users. **Read this paragraph if you have already created apps before their official support:** For existing users and bots, the user type is inferred, but existing apps will show as regular users. Please remove those users from your team and create them again. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -470,7 +470,7 @@ instance (1 <= max) => ToJSON (LimitedQualifiedUserIdList max) where | |
| -- UserType | ||
|
|
||
| data UserType = UserTypeRegular | UserTypeApp | UserTypeBot | ||
| deriving (Eq, Show, Generic) | ||
| deriving (Eq, Ord, Show, Generic) | ||
| deriving (Arbitrary) via (GenericUniform UserType) | ||
| deriving (A.FromJSON, A.ToJSON) via (Schema UserType) | ||
|
|
||
|
|
@@ -486,6 +486,20 @@ instance ToSchema UserType where | |
| Schema.element "bot" UserTypeBot | ||
| ] | ||
|
|
||
| instance C.Cql UserType where | ||
| ctype = C.Tagged C.IntColumn | ||
|
|
||
| toCql UserTypeRegular = C.CqlInt 0 | ||
| toCql UserTypeBot = C.CqlInt 1 | ||
| toCql UserTypeApp = C.CqlInt 2 | ||
|
|
||
| fromCql (C.CqlInt i) = case i of | ||
| 0 -> pure UserTypeRegular | ||
| 1 -> pure UserTypeBot | ||
| 2 -> pure UserTypeApp | ||
| n -> Left $ "unexpected user type: " ++ show n | ||
| fromCql _ = Left "user type: int expected" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you considered to add the unbound value (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i would, but it's like this in all the other cql instances, and i've just go CI green... :-) |
||
|
|
||
| -------------------------------------------------------------------------------- | ||
| -- UserProfile | ||
|
|
||
|
|
@@ -579,6 +593,7 @@ instance FromJSON SelfProfile where | |
| -- | The data of an existing user. | ||
| data User = User | ||
| { userQualifiedId :: Qualified UserId, | ||
| userType :: UserType, | ||
| -- | User identity. For endpoints like @/self@, it will be present in the response iff | ||
| -- the user is activated, and the email/phone contained in it will be guaranteedly | ||
| -- verified. {#RefActivation} | ||
|
|
@@ -635,6 +650,8 @@ userObjectSchema = | |
| User | ||
| <$> userQualifiedId | ||
| .= field "qualified_id" schema | ||
| <*> userType | ||
| .= field "type" schema | ||
| <* userId | ||
| .= optional (field "id" (deprecatedSchema "qualified_id" schema)) | ||
| <*> userIdentity .= maybeUserIdentityObjectSchema | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,5 +15,6 @@ | |
| "supported_protocols": [ | ||
| "proteus" | ||
| ], | ||
| "searchable": true | ||
| "searchable": true, | ||
| "type": "regular" | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I know too little about apps: Is the audience of the changelog the same as the people adding apps? (I.e. sys admins deploying Wire?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changelog should be read by everybody who is dealing with wire-server i guess, so yes, team admins adding apps are covered?
of in this case: the site admin should read this and then make sure nobody is using any apps in prod already (which they shouldn't, it hasn't been released yet).