本文整理汇总了Python中omero_model_PermissionsI.PermissionsI类的典型用法代码示例。如果您正苦于以下问题:Python PermissionsI类的具体用法?Python PermissionsI怎么用?Python PermissionsI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PermissionsI类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testCreatGroupAndchangePermissions
def testCreatGroupAndchangePermissions(self):
# this is the test of updating group permissions
# including changes in #1434
uuid = self.uuid()
admin = self.root.sf.getAdminService()
# create group1
new_gr1 = ExperimenterGroupI()
new_gr1.name = rstring("group1_%s" % uuid)
new_gr1.ldap = rbool(False)
p = PermissionsI()
p.setUserRead(True)
p.setUserWrite(True)
p.setGroupRead(False)
p.setGroupAnnotate(False)
p.setGroupWrite(False)
p.setWorldRead(False)
p.setWorldAnnotate(False)
p.setWorldWrite(False)
new_gr1.details.permissions = p
g1_id = admin.createGroup(new_gr1)
# increase permissions of group1 to rwr---
p1 = PermissionsI()
p1.setUserRead(True)
p1.setUserWrite(True)
p1.setGroupRead(True)
p1.setGroupAnnotate(False)
p1.setGroupWrite(False)
p1.setWorldRead(False)
p1.setWorldAnnotate(False)
p1.setWorldWrite(False)
self.change_permissions(g1_id, str(p1), self.root)
gr2 = admin.getGroup(g1_id)
assert 'rwr---' == str(gr2.details.permissions)
# increase permissions of group1 to rwra--
gr2 = admin.getGroup(g1_id)
p2 = PermissionsI()
p2.setUserRead(True)
p2.setUserWrite(True)
p2.setGroupRead(True)
p2.setGroupAnnotate(True)
p2.setGroupWrite(False)
p2.setWorldRead(False)
p2.setWorldAnnotate(False)
p2.setWorldWrite(False)
self.change_permissions(g1_id, str(p2), self.root)
gr3 = admin.getGroup(g1_id)
assert 'rwra--' == str(gr3.details.permissions)
# increase permissions of group1 to rwrw--
gr3 = admin.getGroup(g1_id)
p3 = PermissionsI()
p3.setUserRead(True)
p3.setUserWrite(True)
p3.setGroupRead(True)
p3.setGroupWrite(True)
p3.setWorldRead(False)
p3.setWorldAnnotate(False)
p3.setWorldWrite(False)
self.change_permissions(g1_id, str(p3), self.root)
gr4 = admin.getGroup(g1_id)
assert 'rwrw--' == str(gr4.details.permissions)
示例2: testCreatAndUpdatePublicGroup
def testCreatAndUpdatePublicGroup(self):
# this is the test of creating public group and updating it
# including changes in #1434
uuid = self.uuid()
admin = self.root.sf.getAdminService()
# create group1
new_gr1 = ExperimenterGroupI()
new_gr1.name = rstring("group1_%s" % uuid)
new_gr1.ldap = rbool(False)
p = PermissionsI()
p.setUserRead(True)
p.setUserWrite(True)
p.setGroupRead(True)
p.setGroupWrite(True)
p.setWorldRead(False)
p.setWorldAnnotate(False)
p.setWorldWrite(False)
new_gr1.details.permissions = p
g1_id = admin.createGroup(new_gr1)
# update name of group1
gr1 = admin.getGroup(g1_id)
assert 'rwrw--' == str(gr1.details.permissions)
new_name = "changed_name_group1_%s" % uuid
gr1.name = rstring(new_name)
admin.updateGroup(gr1)
gr1_u = admin.getGroup(g1_id)
assert new_name == gr1_u.name.val
示例3: testThumbs
def testThumbs(self):
# root session is root.sf
uuid = self.root.sf.getAdminService().getEventContext().sessionUuid
admin = self.root.sf.getAdminService()
group1name = "private_%s" % uuid
group2name = "read-only_%s" % uuid
group3name = "collaborative_%s" % uuid
ownerName = "owner_%s" % uuid
user1name = "user1_%s" % uuid
user2name = "user2_%s" % uuid
### create three users in 3 groups
listOfGroups = list()
listOfGroups.append(admin.lookupGroup("user")) # all users need to be in 'user' group to do anything!
#group1 - private
new_gr1 = ExperimenterGroupI()
new_gr1.name = rstring(group1name)
p = PermissionsI()
p.setUserRead(True)
p.setUserWrite(True)
p.setGroupRead(False)
p.setGroupWrite(False)
p.setWorldRead(False)
p.setWorldWrite(False)
new_gr1.details.permissions = p
gid = admin.createGroup(new_gr1)
privateGroup = admin.getGroup(gid)
self.assertEquals('rw----', str(privateGroup.details.permissions))
listOfGroups.append(privateGroup)
#group2 - read-only
new_gr2 = ExperimenterGroupI()
new_gr2.name = rstring(group2name)
p2 = PermissionsI()
p2.setUserRead(True)
p2.setUserWrite(True)
p2.setGroupRead(True)
p2.setGroupWrite(False)
p2.setWorldRead(False)
p2.setWorldWrite(False)
new_gr2.details.permissions = p2
gid2 = admin.createGroup(new_gr2)
readOnlyGroup = admin.getGroup(gid2)
self.assertEquals('rwr---', str(readOnlyGroup.details.permissions))
listOfGroups.append(readOnlyGroup)
#group3 - collaborative
new_gr3 = ExperimenterGroupI()
new_gr3.name = rstring(group3name)
p = PermissionsI()
p.setUserRead(True)
p.setUserWrite(True)
p.setGroupRead(True)
p.setGroupWrite(True)
p.setWorldRead(False)
p.setWorldWrite(False)
new_gr3.details.permissions = p
gid3 = admin.createGroup(new_gr3)
collaborativeGroup = admin.getGroup(gid3)
self.assertEquals('rwrw--', str(collaborativeGroup.details.permissions))
listOfGroups.append(collaborativeGroup)
#new user (group owner)
owner = ExperimenterI()
owner.omeName = rstring(ownerName)
owner.firstName = rstring("Group")
owner.lastName = rstring("Owner")
owner.email = rstring("[email protected]")
ownerId = admin.createExperimenterWithPassword(owner, rstring("ome"), privateGroup, listOfGroups)
newOwner = admin.getExperimenter(ownerId)
admin.setGroupOwner(privateGroup, newOwner)
admin.setGroupOwner(readOnlyGroup, newOwner)
admin.setGroupOwner(collaborativeGroup, newOwner)
#new user1
new_exp = ExperimenterI()
new_exp.omeName = rstring(user1name)
new_exp.firstName = rstring("Will")
new_exp.lastName = rstring("Moore")
new_exp.email = rstring("[email protected]")
eid = admin.createExperimenterWithPassword(new_exp, rstring("ome"), privateGroup, listOfGroups)
#new user2
new_exp2 = ExperimenterI()
new_exp2.omeName = rstring(user2name)
new_exp2.firstName = rstring("User")
new_exp2.lastName = rstring("Test2")
new_exp2.email = rstring("[email protected]")
eid2 = admin.createExperimenterWithPassword(new_exp2, rstring("ome"), privateGroup, listOfGroups)
## get users
user1 = admin.getExperimenter(eid)
user2 = admin.getExperimenter(eid2)
#.........这里部分代码省略.........