def has_permission(self, auth: Auth, router: Router, path: http.Path, method: http.Method): if not auth.is_authenticated(): return False _, kwargs = router.lookup(path, method) scopes_required = { scope.format(**kwargs) for scope in self.scopes_required } scopes_given = set(auth.token['scope'].split()) return scopes_required <= scopes_given
def has_permission(self, auth: Auth): return auth.is_authenticated() and auth.token is None
def has_permission(self, auth: Auth): return auth.is_authenticated()
def me(auth: Auth): return { "is_authenticated": auth.is_authenticated(), "username": auth.get_display_name(), }
def get_auth(auth: Auth): return { 'user_id': auth.get_user_id(), 'display_name': auth.get_display_name(), 'is_authenticated': auth.is_authenticated() }
def has_permission(self, auth: Auth): if not auth.is_authenticated(): return False return bool(auth.user.is_guest)
def display_user(auth: Auth): return { 'is_authenticated': auth.is_authenticated(), 'user': auth.get_display_name(), }