Exemple #1
0
    def setUp(self, args=None):
        super(UGMLayer, self).setUp(args)
        import cone.ugm
        path = pkg_resources.resource_filename('cone.ugm.tests', 'ldap.xml')
        cone.ugm.model.utils.LDAP_CFG_FILE = path
        cone.ugm.model.settings._invalidate_ugm_settings(cone.app.get_root())
        ugm = cone.ugm.model.utils.ugm_backend(cone.app.get_root())
        roles = ['viewer', 'editor', 'admin', 'manager']

        def create_user(uid):
            data = {
                'cn': uid,
                'sn': uid,
                'mail': '*****@*****.**' % uid,
            }
            user = ugm.users.create(uid, **data)
            ugm()
            ugm.users.passwd(uid, None, 'secret')
            return user
        for uid in ['viewer', 'editor', 'admin', 'manager', 'max', 'sepp']:
            user = create_user(uid)
            if uid in roles:
                user.add_role(uid)
        for uid in ['localmanager_1', 'localmanager_2']:
            create_user(uid)
        for gid, uid in [('admin_group_1', 'localmanager_1'),
                         ('admin_group_2', 'localmanager_2')]:
            group = ugm.groups.create(gid)
            group.add(uid)
        ugm()
Exemple #2
0
 def create_user(uid):
     data = {
         'cn': uid,
         'sn': uid,
         'mail': '*****@*****.**' % uid,
     }
     user = ugm.users.create(uid, **data)
     ugm()
     ugm.users.passwd(uid, None, 'secret')
     return user
Exemple #3
0
 def setUp(self, args=None):
     super(UGMLayer, self).setUp(args)
     import cone.ugm
     path = pkg_resources.resource_filename('cone.ugm.tests', 'ldap.xml')
     cone.ugm.model.utils.LDAP_CFG_FILE = path
     cone.ugm.model.settings._invalidate_ugm_settings(cone.app.get_root())
     ugm = cone.ugm.model.utils.ugm_backend(cone.app.get_root())
     roles = ['viewer', 'editor', 'owner', 'manager']
     for uid in ['viewer', 'editor', 'owner', 'manager', 'max', 'sepp']:
         data = {
             'cn': uid,
             'sn': uid,
             'mail': '*****@*****.**' % uid,
         }
         user = ugm.users.create(uid, **data)
         ugm()
         ugm.users.passwd(uid, None, 'secret')
         if uid in roles:
             user.add_role(uid)
     ugm()