def require_permission(level=None):
  def decorator(f):
    @gen.engine
    def wrapper(self, *args, **kwargs):
      assert level in [None, 'root', 'support']
      self._permissions = yield gen.Task(self.QueryAdminPermissions)

      if level == 'root':
        self.CheckIsRoot()
      elif level == 'support':
        self.CheckIsSupport()

      f(self, *args, **kwargs)
    return wrapper
  return decorator
Decorator to be used in admin get/post methods.
dataset/ETHPy150Open viewfinderco/viewfinder/backend/www/admin/admin.py/require_permission