def get(self): """ .. http:get:: /roles The current role list **Example request**: .. sourcecode:: http GET /roles HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript { "items": [ { "id": 1, "name": "role1", "description": "this is role1" }, { "id": 2, "name": "role2", "description": "this is role2" } ] "total": 2 } :query sortBy: field to sort on :query sortDir: acs or desc :query page: int default is 1 :query filter: key value pair format is k;v :query count: count number default is 10 :reqheader Authorization: OAuth token to authenticate :statuscode 200: no error :statuscode 403: unauthenticated """ parser = paginated_parser.copy() parser.add_argument('owner', type=str, location='args') parser.add_argument('id', type=str, location='args') args = parser.parse_args() if not g.current_user.is_admin: args['user_id'] = g.current_user.id return service.render(args)
def get(self): """ .. http:get:: /roles The current role list **Example request**: .. sourcecode:: http GET /roles HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript { "items": [ { "id": 1, "name": "role1", "description": "this is role1" }, { "id": 2, "name": "role2", "description": "this is role2" } ] "total": 2 } :query sortBy: field to sort on :query sortDir: asc or desc :query page: int default is 1 :query filter: key value pair format is k;v :query count: count number default is 10 :reqheader Authorization: OAuth token to authenticate :statuscode 200: no error :statuscode 403: unauthenticated """ parser = paginated_parser.copy() parser.add_argument('owner', type=str, location='args') parser.add_argument('id', type=str, location='args') args = parser.parse_args() args['user'] = g.current_user return service.render(args)
def get(self, authority_id): """ .. http:get:: /authorities/1/roles List of roles for a given authority **Example request**: .. sourcecode:: http GET /authorities/1/roles HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript { "items": [ { "id": 1, "name": "role1", "description": "this is role1" }, { "id": 2, "name": "role2", "description": "this is role2" } ] "total": 2 } :query sortBy: field to sort on :query sortDir: asc or desc :query page: int default is 1 :query filter: key value pair format is k;v :query count: count number default is 10 :reqheader Authorization: OAuth token to authenticate :statuscode 200: no error """ parser = paginated_parser.copy() args = parser.parse_args() args["authority_id"] = authority_id return service.render(args)
def get(self, authority_id): """ .. http:get:: /authorities/1/roles List of roles for a given authority **Example request**: .. sourcecode:: http GET /authorities/1/roles HTTP/1.1 Host: example.com Accept: application/json, text/javascript **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript { "items": [ { "id": 1, "name": "role1", "description": "this is role1" }, { "id": 2, "name": "role2", "description": "this is role2" } ] "total": 2 } :query sortBy: field to sort on :query sortDir: acs or desc :query page: int default is 1 :query filter: key value pair format is k;v :query count: count number default is 10 :reqheader Authorization: OAuth token to authenticate :statuscode 200: no error """ parser = paginated_parser.copy() args = parser.parse_args() args['authority_id'] = authority_id return service.render(args)