in synergy/server/controller/TribeCtrl.php [339:372]
public function validatePermission($assignment, $tribes) {
if (Synergy::getSessionProvider()->getUserRole() === "admin" || Synergy::getSessionProvider()->getUserRole() === "manager") {
return;
}
$assignment->tribeId = intval($assignment->tribeId);
$tribeOk = false;
$assigneeOk = false;
$specificationOk = false;
for ($i = 0, $maxi = count($tribes); $i < $maxi; $i++) {
if (intval($tribes[$i]->id) === intval($assignment->tribeId)) {
$tribeOk = true;
// check assignee
for ($j = 0, $maxj = count($tribes[$i]->members); $j < $maxj; $j++) {
if ($assignment->username === $tribes[$i]->members[$j]->username) {
$assigneeOk = true;
}
}
for ($j = 0, $maxj = count($tribes[$i]->ext["specifications"]); $j < $maxj; $j++) {
if (intval($assignment->specificationId) === intval($tribes[$i]->ext["specifications"][$j]->id)) {
$specificationOk = true;
}
}
// check specification
break;
}
}
if (!$tribeOk || !$assigneeOk || !$specificationOk) {
$msg = "Specification check: " . ($specificationOk ? "OK" : "Failed") . " Tribe check: " . ($tribeOk ? "OK" : "Failed") . " Assignee check: " . ($assigneeOk ? "OK" : "Failed");
throw new AssignmentSecurityException("Not allowed", "You don't have permissions for this action. " . $msg, "");
}
}