Esempio n. 1
0
    def checkAuthenticated(self, user):
        """Check that a user may delete a bugtask.

        A user may delete a bugtask if:
         - project maintainer
         - task creator
         - bug supervisor
        """
        if user is None:
            return False

        # Admins can always delete bugtasks.
        if user.in_admin:
            return True

        bugtask = self.obj
        owner = None
        if IHasOwner.providedBy(bugtask.pillar):
            owner = bugtask.pillar.owner
        bugsupervisor = None
        if IHasBugSupervisor.providedBy(bugtask.pillar):
            bugsupervisor = bugtask.pillar.bug_supervisor
        return (
            user.inTeam(owner) or
            user.inTeam(bugsupervisor) or
            user.inTeam(bugtask.owner))
Esempio n. 2
0
    def checkAuthenticated(self, user):
        """Check that a user may delete a bugtask.

        A user may delete a bugtask if:
         - project maintainer
         - task creator
         - bug supervisor
        """
        if user is None:
            return False

        # Admins can always delete bugtasks.
        if user.in_admin:
            return True

        bugtask = self.obj
        owner = None
        if IHasOwner.providedBy(bugtask.pillar):
            owner = bugtask.pillar.owner
        bugsupervisor = None
        if IHasBugSupervisor.providedBy(bugtask.pillar):
            bugsupervisor = bugtask.pillar.bug_supervisor
        return (user.inTeam(owner) or user.inTeam(bugsupervisor)
                or user.inTeam(bugtask.owner))
Esempio n. 3
0
 def isBugSupervisor(self, obj):
     """See IPersonRoles."""
     return (IHasBugSupervisor.providedBy(obj)
             and self.inTeam(obj.bug_supervisor))
Esempio n. 4
0
 def isBugSupervisor(self, obj):
     """See IPersonRoles."""
     return (IHasBugSupervisor.providedBy(obj)
             and self.inTeam(obj.bug_supervisor))