Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions libs/wire-api/src/Wire/API/Team/Permission.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ import Wire.Arbitrary (Arbitrary (arbitrary), GenericUniform (..))
-- Permissions

data Permissions = Permissions
{ self :: Set Perm,
{ -- | User's permissions
self :: Set Perm,
-- | Permissions this user is allowed to grant others
copy :: Set Perm
}
deriving stock (Eq, Ord, Show, Generic)
Expand All @@ -69,9 +71,11 @@ permissionsSchema :: ValueSchema NamedSwaggerDoc Permissions
permissionsSchema =
objectWithDocModifier "Permissions" (description ?~ docs) $
Permissions
<$> (permsToInt . self) .= field "self" (intToPerms <$> schema)
<*> (permsToInt . copy) .= field "copy" (intToPerms <$> schema)
<$> (permsToInt . self) .= fieldWithDocModifier "self" selfDoc (intToPerms <$> schema)
<*> (permsToInt . copy) .= fieldWithDocModifier "copy" copyDoc (intToPerms <$> schema)
where
selfDoc = S.description ?~ "Permissions that the user has"
copyDoc = S.description ?~ "Permissions that this user is able to grant others"
docs =
"This is just a complicated way of representing a team role. self and copy \
\always have to contain the same integer, and only the following integers \
Expand Down