def check(request): ret = yield from permits(request, 'read') assert ret ret = yield from permits(request, 'write') assert ret ret = yield from permits(request, 'unknown') assert ret return web.Response()
def check(request): ret = yield from permits(request, 'read') self.assertTrue(ret) ret = yield from permits(request, 'write') self.assertTrue(ret) ret = yield from permits(request, 'unknown') self.assertTrue(ret) return web.Response()
def wrapped(self, request): has_perm = yield from permits(request) if not has_perm: raise web.HTTPForbidden() return (yield from f(self, request))
def wrapped(self, request): has_perm = yield from permits(request, permission) if not has_perm: message = 'User has no permission {}'.format(permission) raise web.HTTPForbidden(body=message.encode()) return (yield from f(self, request))
def wrapped(request): has_perm = yield from permits(request, permission) if not has_perm: message = 'User has no permission {}'.format(permission) raise web.HTTPForbidden(body=message.encode()) return (yield from f(request))
def wrapped(self, request): has_perm = yield from permits(request, permission) if not has_perm: response = web.HTTPFound('/login/') return response return (yield from f(self, request))