Commit d0f6418d authored by Bruno Antunes Magrini's avatar Bruno Antunes Magrini
Browse files

Adiciona config no plugin para autorizar avaliadores

parent e664b702
......@@ -40,10 +40,6 @@ return [
return false;
}
if($app->user->is('admin')){
return true;
}
$plugin = $app->plugins['AldirBlanc'];
// só pode acessar as demais urls quem tiver controle sobre o agente da SECULT
......@@ -52,11 +48,28 @@ return [
$opportunities = $app->repo('Opportunity')->findBy(['id' => $opportunities_ids]);
foreach($opportunities as $opportunity) {
$evaluation_method_configurations = [];
foreach($opportunities as $opportunity) {
$evaluation_method_configurations[] = $opportunity->evaluationMethodConfiguration;
if($opportunity->canUser('@control') || $opportunity->canUser('viewEvaluations') || $opportunity->canUser('evaluateRegistrations')) {
return true;
}
}
foreach ($evaluation_method_configurations as $emc) {
$param = [
'originType' => 'MapasCulturais\Entities\EvaluationMethodConfiguration',
'originId' => $emc->id,
'destinationType' => 'MapasCulturais\Entities\Agent',
'destinationId' => $app->user->profile->id,
];
if($request = $app->repo('RequestAgentRelation')->findOneBy($param)) {
return true;
}
}
return false;
}
]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment