예제 #1
0
    def _adjust_staff_roles(self, no_reindex=0):
        """Adjust local-role assignments to track staff roster settings.
        Ie, ensure: only designated supporters and managers have 'Reviewer'
        local role, only designated managers have 'Manager' local role.

        We reindex the issues if any local role changes occur, so
        allowedRolesAndUsers catalog index tracks.

        We return a list of changes (or non-changes)."""

        managers = self.managers
        supporters = self.supporters
        change_notes = []
        changed = 0

        if not managers:
            # Something is awry.  Managers are not allowed to remove
            # themselves from the managers roster, and only managers should be
            # able to adjust the roles, so:
            change_notes.append("Populated empty managers roster")
            changed = 1
            self.managers = managers = [str(getSecurityManager().getUser())]
        if util.users_for_local_role(self, managers, 'Manager'):
            changed = 1
        if util.users_for_local_role(self, managers + supporters, 'Reviewer'):
            changed = 1
        if changed and not no_reindex:
            self._reindex_issues()

        return change_notes
예제 #2
0
파일: Collector.py 프로젝트: goschtl/zope
    def _adjust_staff_roles(self, no_reindex=0):
        """Adjust local-role assignments to track staff roster settings.
        Ie, ensure: only designated supporters and managers have 'Reviewer'
        local role, only designated managers have 'Manager' local role.

        We reindex the issues if any local role changes occur, so
        allowedRolesAndUsers catalog index tracks.

        We return a list of changes (or non-changes)."""

        managers = self.managers
        supporters = self.supporters
        change_notes = []
        changed = 0

        if not managers:
            # Something is awry.  Managers are not allowed to remove
            # themselves from the managers roster, and only managers should be
            # able to adjust the roles, so:
            change_notes.append("Populated empty managers roster")
            changed = 1
            self.managers = managers = [str(getSecurityManager().getUser())]
        if util.users_for_local_role(self, managers, 'Manager'):
            changed = 1
        if util.users_for_local_role(self, managers + supporters, 'Reviewer'):
            changed = 1
        if changed and not no_reindex:
            self._reindex_issues()

        return change_notes