Example #1
0
File: Rule.php Project: spryker/Acl
 /**
  * @return void
  */
 protected function provideUserRuleWhitelist()
 {
     $ruleWhitelist = $this->config->getUserRuleWhitelist();
     foreach ($ruleWhitelist as $rule) {
         $rulesTransfer = new RuleTransfer();
         $rulesTransfer->fromArray($rule, true);
         $this->rulesValidator->addRule($rulesTransfer);
     }
 }
Example #2
0
 /**
  * @throws \Spryker\Zed\Acl\Business\Exception\GroupNotFoundException
  * @throws \Spryker\Zed\User\Business\Exception\UserNotFoundException
  *
  * @return void
  */
 private function addUserGroupRelations()
 {
     foreach ($this->config->getInstallerUsers() as $username => $config) {
         $group = $this->group->getByName($config['group']);
         if (!$group) {
             throw new GroupNotFoundException();
         }
         $user = $this->userFacade->getUserByUsername($username);
         if (!$user) {
             throw new UserNotFoundException();
         }
         if (!$this->group->hasUser($group->getIdAclGroup(), $user->getIdUser())) {
             $this->group->addUser($user->getIdUser(), $group->getIdAclGroup());
         }
     }
 }