コード例 #1
0
ファイル: __init__.py プロジェクト: robx/adhocracy3.mercator
    def effective_principals(self, request: Request) -> list:
        """Return roles and groups for the current user.

        THE RESULT IS CACHED for the current request in the request attribute
        called: __cached_principals__ .
        """
        cached_principals = getattr(request, '__cached_principals__', None)
        if cached_principals:
            return cached_principals
        if self.authenticated_userid(request) is None:
            return [Everyone, Anonymous]
        principals = super().effective_principals(request)
        request.__cached_principals__ = principals
        return principals
コード例 #2
0
    def effective_principals(self, request: Request) -> list:
        """Return roles and groups for the current user.

        THE RESULT IS CACHED for the current request in the request attribute
        called: __cached_principals__ .
        """
        cached_principals = getattr(request, '__cached_principals__', None)
        if cached_principals:
            return cached_principals
        if self.authenticated_userid(request) is None:
            return [Everyone, Anonymous]
        principals = super().effective_principals(request)
        request.__cached_principals__ = principals
        return principals
コード例 #3
0
ファイル: __init__.py プロジェクト: andantic/adhocracy3
    def effective_principals(self, request: Request) -> list:
        """Return roles and groups for the current user.

        THE RESULT IS CACHED for the current request in the request attribute
        called: __cached_principals__ .
        """
        cached_principals = getattr(request, '__cached_principals__', None)
        if cached_principals:
            return cached_principals
        if self.authenticated_userid(request) is None:
            # FIXME this should go to principals.groups_and_roles_finder
            # to make adhocracy work with other authentication polices.
            return [Everyone, Anonymous]
        principals = super().effective_principals(request)
        request.__cached_principals__ = principals
        return principals
コード例 #4
0
ファイル: __init__.py プロジェクト: libscott/adhocracy3
    def effective_principals(self, request: Request) -> list:
        """Return roles and groups for the current user.

        THE RESULT IS CACHED for the current request in the request attribute
        called: __cached_principals__ .
        """
        cached_principals = getattr(request, '__cached_principals__', None)
        if cached_principals:
            return cached_principals
        if self.authenticated_userid(request) is None:
            # FIXME this should go to principals.groups_and_roles_finder
            # to make adhocracy work with other authentication polices.
            return [Everyone, Anonymous]
        principals = super().effective_principals(request)
        request.__cached_principals__ = principals
        return principals