Ejemplo n.º 1
0
 /**
  * @param string                                                    $module
  * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
  * @param \ACP3\Core\Modules\SchemaHelper                           $schemaHelper
  *
  * @return bool
  */
 public function installSampleData($module, ContainerInterface $container, SchemaHelper $schemaHelper)
 {
     $bool = true;
     $serviceId = $module . '.installer.sampleData';
     if ($container->has($serviceId)) {
         /** @var Core\Modules\Installer\SampleDataInterface $moduleSampleData */
         $moduleSampleData = $container->get($serviceId);
         $bool = $schemaHelper->executeSqlQueries($moduleSampleData->sampleData());
     }
     return $bool;
 }
Ejemplo n.º 2
0
 /**
  * Insert new acl user rules
  *
  * @param string $moduleName
  */
 protected function insertAclRules($moduleName)
 {
     $roles = $this->roleRepository->getAllRoles();
     $privileges = $this->privilegeRepository->getAllPrivilegeIds();
     $moduleId = $this->schemaHelper->getModuleId($moduleName);
     foreach ($roles as $role) {
         foreach ($privileges as $privilege) {
             $insertValues = ['id' => '', 'role_id' => $role['id'], 'module_id' => $moduleId, 'privilege_id' => $privilege['id'], 'permission' => $this->getDefaultAclRulePermission($role, $privilege)];
             $this->ruleRepository->insert($insertValues);
         }
     }
 }