Пример #1
0
 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()
Пример #2
0
 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()
Пример #3
0
 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()
Пример #4
0
 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()
Пример #5
0
 def wrapped(self, request):
     has_perm = yield from permits(request)
     if not has_perm:
         raise web.HTTPForbidden()
     return (yield from f(self, request))
Пример #6
0
 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))
Пример #7
0
 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))
Пример #8
0
 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))