def get(self, req, lookup): """ Returns all registered privileges. """ _privileges = get_privilege_list() _privileges = sorted(_privileges, key=itemgetter('label')) return ListCursor(_privileges)
def test_privilege_registration(self): _privileges.clear() privilege(name="ingest", label="Ingest") privilege(name="archive", label="Archive") self.assertIn("ingest", _privileges) self.assertIn("archive", _privileges) self.assertEqual(2, len(get_privilege_list()))
def test_privilege_registration(self): _privileges.clear() privilege(name='ingest', label='Ingest') privilege(name='archive', label='Archive') self.assertIn('ingest', _privileges) self.assertIn('archive', _privileges) self.assertEqual(2, len(get_privilege_list()))
def get_admin_privileges(): """Get privileges for admin user.""" return dict.fromkeys([p['name'] for p in get_privilege_list()], 1)
def get(self, req, lookup): """Return all registered privileges.""" return ListCursor(get_privilege_list())