Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Jelikož nám žádné metoda neumí vrátit seznam rolí pro currentUser používáme následující logiku:

Code Block
titleLogika skriptu validátoruScript validator logic
1) We are comparing value in (AtA) with every possible value which is defined by name of Project Role and optionId of Custom Fields Authorized to Approve.
AND
2) We are comparing, if currentUser is in same Project Role. (hardcoded)
IF
Both condition are TRUE, transition is allowed.
ELSE
Transition is blocked and user got an error message, that he is not authorized to this Approval.

...

Code Block
languagegroovy
titleValidátor Oprávnění SchválitApprove Transition Validator
linenumberstrue
(issue.get("customfield_10111")?.any{it.value == "K: Level 1, Role 2"} &&
currentUser.isInProjectRole("K: Level 1, Role 2",issue.get("Project"))) || 
(issue.get("customfield_10111")?.any{it.value == "MS: Level 1, Role 1"} &&
currentUser.isInProjectRole("MS: Level 1, Role 1",issue.get("Project"))) || 
(issue.get("customfield_10111")?.any{it.value == "P: Level 1, Role 3"} &&
currentUser.isInProjectRole("P: Level 1, Role 3",issue.get("Project"))) || 
(issue.get("customfield_10111")?.any{it.value == "Level 4, Role 1"} &&
currentUser.isInProjectRole("TR: Level 4, Role 1",issue.get("Project"))) || 
(issue.get("customfield_10111")?.any{it.value == "VE: NOT IN USE"} &&
currentUser.isInProjectRole("VE: NOT IN USE",issue.get("Project"))) || 
(issue.get("customfield_10111")?.any{it.value == "VK: NOT IN USE"} &&
currentUser.isInProjectRole("VK: NOT IN USE",issue.get("Project"))) || 
(issue.get("customfield_10111")?.any{it.value == "VS: Level 2, Role 1"} &&
currentUser.isInProjectRole("VS: Level 2, Role 1",issue.get("Project"))) || 
(issue.get("customfield_10111")?.any{it.value == "RD: Level 5, Role 1"} &&
currentUser.isInProjectRole("RD: Level 5, Role 1",issue.get("Project"))) ||
(issue.get("customfield_10111")?.any{it.value == "RZP: Level 4, Role 2"} &&
currentUser.isInProjectRole("RZP: Level 4, Role 2",issue.get("Project"))) ||
(issue.get("customfield_10111")?.any{it.value == "RZS: Level 4, Role 2"} &&
currentUser.isInProjectRole("RZS: Level 4, Role 2",issue.get("Project")))

...