def __init__(self, actions_path=None, users_path=None, roles_path=None, *args, **kwargs): super(RightsModule, self).__init__(*args, **kwargs) self.logger = Logger.get('migrationtool', MigrationModule.LOG_PATH) self.config = Configuration.load(RightsModule.CONF_PATH, Ini) conf = self.config.get(self.CATEGORY, {}) self.manager = Rights() if actions_path is not None: actions_path = actions_path else: actions_path = conf.get('actions_path', DEFAULT_ACTIONS_PATH) self.actions_path = os.path.expanduser(actions_path) if users_path is not None: users_path = users_path else: users_path = conf.get('users_path', DEFAULT_USERS_PATH) self.users_path = os.path.expanduser(users_path) if roles_path is not None: roles_path = roles_path else: roles_path = conf.get('roles_path', DEFAULT_ROLES_PATH) self.roles_path = os.path.expanduser(roles_path)
def get_manager(): global rights if not rights: rights = Rights() return rights
def __init__(self, *args, **kwargs): super(ViewsModule, self).__init__(*args, **kwargs) self.logger = Logger.get('migrationmodule', MigrationModule.LOG_PATH) self.storage = Middleware.get_middleware_by_uri('storage-default://', table='object') self.rights = Rights()
def setUp(self): self.logger = getLogger() self.rights = Rights() self.data_types = ['profile', 'group', 'role'] # This should be in a filldb script referenced_rights = { '1234', '1235', '1236', '1237', '1238', '1239', '1240', '1241', '2344', '2345', '2346', '2347', '2348', '2349', '4210', '4211' } for x in referenced_rights: self.rights.add(x, 'desc test rule') # delete everything before starting self.rights.delete_group('group_test1') self.rights.delete_group('group_test2') self.rights.delete_user('jharris') self.rights.delete_profile('profile_test1') self.rights.delete_profile('profile_test2') self.rights.delete_role('role_test1bis')