Skip to content

Commit

Permalink
remove assumption user is in the same group
Browse files Browse the repository at this point in the history
  • Loading branch information
jburel committed Apr 2, 2024
1 parent bf8df47 commit 9638f97
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,16 @@ def testAuthorCanEdit(self, gatewaywrapper, author_testimg_generated):
assert i.canAnnotate(), "Admin can annotate Author's image"

# Login as default "User"
# NB: seems this user is not in same group as Author's image.
# Retrieve the user ID and create a new group
gatewaywrapper.loginAsUser()
gatewaywrapper.gateway.SERVICE_OPTS.setOmeroGroup('-1')
ctx = gatewaywrapper.gateway.getAdminService().getEventContext()
uuid = ctx.sessionUuid
gatewaywrapper.loginAsAdmin()
gid = gatewaywrapper.gateway.createGroup("author-can-edit-test-%s" % uuid,
member_Ids=[ctx.userId])

gatewaywrapper.loginAsUser()
gatewaywrapper.gateway.setGroupForSession(gid)
i = gatewaywrapper.gateway.getObject("Image", imageId)
assert i is None, \
"User cannot access Author's image in Read-only group"
Expand Down

0 comments on commit 9638f97

Please sign in to comment.