示例#1
0
    def get(self, resource_id=None):
        """Fetch request(s)"""

        if not self.user.is_admin:
            raise PermissionDeniedError()

        if resource_id is None:
            self.dump([JsRequest.from_db(req) for req in self.db.get_reqs()])
            return

        req = self.db.get_req(int(resource_id))
        if req is None:
            self.abort(404)

        self.dump(JsRequest.from_db(req))
示例#2
0
    def get_requests(self):
        '''
        Return a list of all requests
        '''
        if not self.db.user.is_admin:
            raise PermissionDeniedError()

        return [ AccessReq.from_db(db) for db in self.db.get_reqs() ]
示例#3
0
    def get_requests(self):
        '''
        Return a list of all requests
        '''
        if not self.db.user.is_admin:
            raise PermissionDeniedError()

        return [AccessReq.from_db(db) for db in self.db.get_reqs()]