Versions Compared

Key

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

...

Those groups are represented by Authorized to Approve values objectId and can be found in Objects code-list matrix.

The hardcoded values we are comparing Custom Fields to are defined by Customer and are under NDA. Sorry for not sharing, but you can imagine just some thresholds by putting togethers values of Risk Factor and Expected Costs.

Group MS, K, P and superiors 

...

Because there is no method to return list of roles for currentUser, we are using this logic: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")))

...