def update_guards(self):
        wf = self.selected_workflow
        transition = self.selected_transition
        guard = transition.getGuard()

        perms = []
        for key, perm in allowed_guard_permissions(wf.getId()).items():
            key = "transition-%s-guard-permission-%s" % (transition.id, key)
            if key in self.request and perm not in guard.permissions:
                perms.append(perm)
        guard.permissions = tuple(perms)

        roles = validators.parse_set_value(self, "transition-%s-guard-roles" % transition.id)
        okay_roles = set(wf.getAvailableRoles())
        guard.roles = tuple(roles & okay_roles)

        groups = validators.parse_set_value(self, "transition-%s-guard-groups" % transition.id)
        okay_groups = set([g["id"] for g in self.getGroups()])
        guard.groups = tuple(groups & okay_groups)

        transition.guard = guard
    def update_guards(self):
        wf = self.selected_workflow
        transition = self.selected_transition
        guard = transition.getGuard()

        perms = []
        for key, perm in allowed_guard_permissions(wf.getId()).items():
            key = 'transition-%s-guard-permission-%s' % (transition.id, key)
            if key in self.request and perm not in guard.permissions:
                perms.append(perm)
        guard.permissions = tuple(perms)

        roles = validators.parse_set_value(
            self, 'transition-%s-guard-roles' % transition.id)
        okay_roles = set(wf.getAvailableRoles())
        guard.roles = tuple(roles & okay_roles)

        groups = validators.parse_set_value(
            self, 'transition-%s-guard-groups' % transition.id)
        okay_groups = set([g['id'] for g in self.getGroups()])
        guard.groups = tuple(groups & okay_groups)

        transition.guard = guard
 def allowed_guard_permissions(self):
     return allowed_guard_permissions(self.selected_workflow.getId())
示例#4
0
 def allowed_guard_permissions(self):
     return allowed_guard_permissions(self.selected_workflow.getId())