def create_perm(self, role, scopes=None): data = { 'match': role, 'scopes': scopes or list() } r = self.http.post('/perm', data) return Permission.parse(r['permission'])
def update_perm(self, id, **kwargs): data = { 'match': kwargs.get('match'), # role 'scopes': kwargs.get('scopes') } r = self.http.put('/perm/{}'.format(id), data) return Permission.parse(r['permission'])
def get_perms(self, query=None): r = self.http.get('/perms', query) return [Permission.parse(p) for p in r['permissions']]
def get_user(self): return Permission.parse(self.http.get('/user/%s' % id)['user'])
def get_perm(self): return Permission.parse(self.http.get('/perm/%s' % id)['perm'])