directory: fix double logic inversion on roles check, incorrect error message (#3944)

This commit is contained in:
spaced4ndy
2024-03-22 15:07:01 +04:00
committed by GitHub
parent 6ad5048b58
commit ec73a31cb5
2 changed files with 5 additions and 5 deletions

View File

@@ -177,8 +177,8 @@ directoryService st DirectoryOpts {superUsers, serviceName, searchResults, testi
badRolesMsg :: GroupRolesStatus -> Maybe String
badRolesMsg = \case
GRSOk -> Nothing
GRSServiceNotAdmin -> Just "You must have a group *owner* role to register the group"
GRSContactNotOwner -> Just "You must grant directory service *admin* role to register the group"
GRSServiceNotAdmin -> Just "You must grant directory service *admin* role to register the group"
GRSContactNotOwner -> Just "You must have a group *owner* role to register the group"
GRSBadRoles -> Just "You must have a group *owner* role and you must grant directory service *admin* role to register the group"
getGroupRolesStatus :: GroupInfo -> GroupReg -> IO (Maybe GroupRolesStatus)
@@ -190,8 +190,8 @@ directoryService st DirectoryOpts {superUsers, serviceName, searchResults, testi
groupRolesStatus :: GroupMemberRole -> GroupMemberRole -> GroupRolesStatus
groupRolesStatus contactRole serviceRole = case (contactRole, serviceRole) of
(GROwner, GRAdmin) -> GRSOk
(_, GRAdmin) -> GRSServiceNotAdmin
(GROwner, _) -> GRSContactNotOwner
(_, GRAdmin) -> GRSContactNotOwner
(GROwner, _) -> GRSServiceNotAdmin
_ -> GRSBadRoles
getGroupMember :: GroupReg -> IO (Maybe GroupMember)

View File

@@ -522,7 +522,7 @@ testNotApprovedBadRoles tmp =
let approve = "/approve 1:privacy 1"
superUser #> ("@SimpleX-Directory " <> approve)
superUser <# ("SimpleX-Directory> > " <> approve)
superUser <## " Group is not approved: user is not an owner."
superUser <## " Group is not approved: SimpleX-Directory is not an admin."
groupNotFound cath "privacy"
bob ##> "/mr privacy SimpleX-Directory admin"
bob <## "#privacy: you changed the role of SimpleX-Directory from member to admin"