当前位置: 首页>>代码示例>>Python>>正文


Python ExperimenterGroupI.ldap方法代码示例

本文整理汇总了Python中omero_model_ExperimenterGroupI.ExperimenterGroupI.ldap方法的典型用法代码示例。如果您正苦于以下问题:Python ExperimenterGroupI.ldap方法的具体用法?Python ExperimenterGroupI.ldap怎么用?Python ExperimenterGroupI.ldap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在omero_model_ExperimenterGroupI.ExperimenterGroupI的用法示例。


在下文中一共展示了ExperimenterGroupI.ldap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testGroupOwners

# 需要导入模块: from omero_model_ExperimenterGroupI import ExperimenterGroupI [as 别名]
# 或者: from omero_model_ExperimenterGroupI.ExperimenterGroupI import ldap [as 别名]
    def testGroupOwners(self):
        # this is the test of creating private 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.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)
        gr1 = admin.getGroup(g1_id)

        # create user1
        new_exp1 = ExperimenterI()
        new_exp1.omeName = rstring("user1_%s" % uuid)
        new_exp1.firstName = rstring("New")
        new_exp1.lastName = rstring("Test")
        new_exp1.ldap = rbool(False)
        new_exp1.email = rstring("[email protected]")

        uuid = self.uuid()
        uuidGroup = ExperimenterGroupI()
        uuidGroup.name = rstring(uuid)
        uuidGroup.ldap = rbool(False)
        uuidGroupId = admin.createGroup(uuidGroup)
        uuidGroup = ExperimenterGroupI(uuidGroupId, False)
        listOfGroups = list()
        listOfGroups.append(admin.lookupGroup("user"))
        eid1 = admin.createExperimenterWithPassword(
            new_exp1, rstring("ome"), uuidGroup, listOfGroups)
        exp1 = admin.getExperimenter(eid1)

        # set owner of the group (user is not a member of)
        admin.addGroupOwners(gr1, [exp1])
        # chech if is the leader
        leaderOfGroups = admin.getLeaderOfGroupIds(exp1)
        assert gr1.id.val in leaderOfGroups

        # remove group owner
        admin.removeGroupOwners(gr1, [exp1])
        # chech if no longer is the leader
        leaderOfGroups = admin.getLeaderOfGroupIds(exp1)
        assert gr1.id.val not in leaderOfGroups

        """
开发者ID:Daniel-Walther,项目名称:openmicroscopy,代码行数:58,代码来源:test_permissions.py

示例2: testCreatAndUpdatePublicGroup

# 需要导入模块: from omero_model_ExperimenterGroupI import ExperimenterGroupI [as 别名]
# 或者: from omero_model_ExperimenterGroupI.ExperimenterGroupI import ldap [as 别名]
    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
开发者ID:Daniel-Walther,项目名称:openmicroscopy,代码行数:31,代码来源:test_permissions.py

示例3: testLoginToPublicGroupTicket1940

# 需要导入模块: from omero_model_ExperimenterGroupI import ExperimenterGroupI [as 别名]
# 或者: from omero_model_ExperimenterGroupI.ExperimenterGroupI import ldap [as 别名]
    def testLoginToPublicGroupTicket1940(self):
        # As root create a new group
        uuid = self.uuid()
        g = ExperimenterGroupI()
        g.name = rstring(uuid)
        g.ldap = rbool(False)
        g.details.permissions = PermissionsI("rwrwrw")
        self.root.sf.getAdminService().createGroup(g)

        # As a regular user, login to that group
        rv = self.root.getPropertyMap()
        ec = self.client.sf.getAdminService().getEventContext()
        public_client = omero.client(rv)
        public_client.getImplicitContext().put("omero.group", uuid)
        sf = public_client.createSession(ec.userName, ec.userName)
        ec = sf.getAdminService().getEventContext()
        assert uuid == ec.groupName

        # But can the user write anything?
        tag = TagAnnotationI()
        sf.getUpdateService().saveObject(tag)
开发者ID:stelfrich,项目名称:openmicroscopy,代码行数:23,代码来源:test_permissions.py

示例4: add

# 需要导入模块: from omero_model_ExperimenterGroupI import ExperimenterGroupI [as 别名]
# 或者: from omero_model_ExperimenterGroupI.ExperimenterGroupI import ldap [as 别名]
    def add(self, args):

        import omero
        from omero.rtypes import rbool, rstring
        from omero_model_ExperimenterGroupI import ExperimenterGroupI as Grp

        perms = self.parse_perms(args)
        c = self.ctx.conn(args)
        g = Grp()
        g.name = rstring(args.name)
        g.ldap = rbool(False)
        g.details.permissions = perms
        admin = c.getSession().getAdminService()
        try:
            grp = admin.lookupGroup(args.name)
            if grp:
                if args.ignore_existing:
                    self.ctx.out("Group exists: %s (id=%s)"
                                 % (args.name, grp.id.val))
                    return
                else:
                    self.ctx.die(3, "Group exists: %s (id=%s)"
                                 % (args.name, grp.id.val))
        except omero.ApiUsageException:
            pass  # Apparently no such group exists

        try:
            id = admin.createGroup(g)
            self.ctx.out("Added group %s (id=%s) with permissions %s"
                         % (args.name, id, perms))
        except omero.ValidationException, ve:
            # Possible, though unlikely after previous check
            if self.exc.is_constraint_violation(ve):
                self.ctx.die(66, "Group already exists: %s" % args.name)
            else:
                self.ctx.die(67, "Unknown ValidationException: %s"
                             % ve.message)
开发者ID:stelfrich,项目名称:openmicroscopy,代码行数:39,代码来源:group.py

示例5: testCreatGroupAndchangePermissions

# 需要导入模块: from omero_model_ExperimenterGroupI import ExperimenterGroupI [as 别名]
# 或者: from omero_model_ExperimenterGroupI.ExperimenterGroupI import ldap [as 别名]
    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)
开发者ID:Daniel-Walther,项目名称:openmicroscopy,代码行数:66,代码来源:test_permissions.py

示例6: test1109

# 需要导入模块: from omero_model_ExperimenterGroupI import ExperimenterGroupI [as 别名]
# 或者: from omero_model_ExperimenterGroupI.ExperimenterGroupI import ldap [as 别名]
    def test1109(self):
        uuid = self.uuid()
        admin = self.root.sf.getAdminService()

        # Replace defaultGroup with something new
        defaultGroup = self.new_group()

        # create data
        # group1
        new_gr1 = ExperimenterGroupI()
        new_gr1.name = rstring("group1_%s" % uuid)
        new_gr1.ldap = rbool(False)
        gid = admin.createGroup(new_gr1)

        # new user1
        new_exp = ExperimenterI()
        new_exp.omeName = rstring("user_%s" % uuid)
        new_exp.firstName = rstring("New")
        new_exp.lastName = rstring("Test")
        new_exp.ldap = rbool(False)
        new_exp.email = rstring("[email protected]")

        listOfGroups = list()
        # defaultGroup = admin.lookupGroup("default") Removed in 4.2
        listOfGroups.append(admin.getGroup(gid))
        listOfGroups.append(admin.lookupGroup("user"))

        eid = admin.createExperimenter(new_exp, defaultGroup, listOfGroups)

        # test
        exp = admin.getExperimenter(eid)
        # print "exp: ", exp.id.val, " his default group is: ",
        # admin.getDefaultGroup(exp.id.val).id.val

        gr1 = admin.getGroup(2)
        indefault = admin.containedExperimenters(gr1.id.val)
        # print "members of group %s %i" % (gr1.name.val, gr1.id.val)
        for m in indefault:
            if m.id.val == exp.id.val:
                assert m.copyGroupExperimenterMap()[0].parent.id.val == \
                    admin.getDefaultGroup(exp.id.val).id.val
                # print "exp: id=", m.id.val, "; GEM[0]: ",
                # type(m.copyGroupExperimenterMap()[0].parent),
                # m.copyGroupExperimenterMap()[0].parent.id.val

        gr2 = admin.getGroup(gid)
        members2 = admin.containedExperimenters(gr2.id.val)
        # print "members of group %s %i" % (gr2.name.val, gr2.id.val)
        for m in members2:
            if m.id.val == exp.id.val:
                copied_id = m.copyGroupExperimenterMap()[0].parent.id.val
                got_id = admin.getDefaultGroup(exp.id.val).id.val
                contained = admin.containedGroups(m.id.val)
                assert copied_id == got_id, \
                    """
                    %s != %s. Groups for experimenter %s = %s
                     (graph) or %s (contained)
                    """ % (
                        copied_id, got_id, exp.id.val,
                        [x.parent.id.val for x in
                            m.copyGroupExperimenterMap()],
                        [y.id.val for y in contained])
开发者ID:Daniel-Walther,项目名称:openmicroscopy,代码行数:64,代码来源:test_tickets2000.py


注:本文中的omero_model_ExperimenterGroupI.ExperimenterGroupI.ldap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。