adapta list of tasks for a person

This commit is contained in:
2021-10-29 16:26:19 +02:00
parent 4017f8db48
commit db15a3d53c
10 changed files with 224 additions and 344 deletions

View File

@@ -40,7 +40,7 @@ class LoadTaskACL extends AbstractFixture implements OrderedFixtureInterface
return 16000;
}
public function load(ObjectManager $manager)
{
foreach (LoadPermissionsGroup::$refs as $permissionsGroupRef) {
@@ -58,33 +58,38 @@ class LoadTaskACL extends AbstractFixture implements OrderedFixtureInterface
case 'direction':
if (in_array($scope->getName()['en'], array('administrative', 'social'))) {
break 2; // we do not want any power on social or administrative
}
}
break;
}
printf("Adding CHILL_TASK_TASK_UPDATE & CHILL_TASK_TASK_CREATE & Chill_TASK_TASK_DELETE permissions to %s "
. "permission group, scope '%s' \n",
. "permission group, scope '%s' \n",
$permissionsGroup->getName(), $scope->getName()['en']);
$roleScopeUpdate = (new RoleScope())
->setRole(TaskVoter::UPDATE)
->setScope($scope);
$permissionsGroup->addRoleScope($roleScopeUpdate);
$roleScopeCreate = (new RoleScope())
->setRole(TaskVoter::CREATE)
$roleScopeCreateP = (new RoleScope())
->setRole(TaskVoter::CREATE_PERSON)
->setScope($scope);
$permissionsGroup->addRoleScope($roleScopeCreate);
$permissionsGroup->addRoleScope($roleScopeCreateP);
$roleScopeCreateC = (new RoleScope())
->setRole(TaskVoter::CREATE_COURSE)
->setScope($scope);
$permissionsGroup->addRoleScope($roleScopeCreateC);
$roleScopeDelete = (new RoleScope())
->setRole(TaskVoter::DELETE)
->setScope($scope);
$permissionsGroup->addRoleScope($roleScopeDelete);
$manager->persist($roleScopeUpdate);
$manager->persist($roleScopeCreate);
$manager->persist($roleScopeCreateP);
$manager->persist($roleScopeCreateC);
$manager->persist($roleScopeDelete);
}
}
$manager->flush();
}