Exemplo n.º 1
0
    def children_with_permission(
        self, request: Request, permission: str = "view"
    ) -> "List[Node]":
        """ Return only those children for which the user initiating the
        request has the asked permission.

        :param request: current request
        :type request: :class:`kotti.request.Request`

        :param permission: The permission for which you want the allowed
                           children
        :type permission: str

        :result: List of child nodes
        :rtype: list
        """

        return [c for c in self.children if request.has_permission(permission, c)]
Exemplo n.º 2
0
    def children_with_permission(self,
                                 request: Request,
                                 permission: str = "view") -> "List[Node]":
        """ Return only those children for which the user initiating the
        request has the asked permission.

        :param request: current request
        :type request: :class:`kotti.request.Request`

        :param permission: The permission for which you want the allowed
                           children
        :type permission: str

        :result: List of child nodes
        :rtype: list
        """

        return [
            c for c in self.children if request.has_permission(permission, c)
        ]