Пример #1
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
Пример #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
    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
    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