示例#1
0
 /**
  * @param array $formData
  *
  * @return \Generated\Shared\Transfer\RolesTransfer
  */
 protected function getRoleTransfersFromForm(array $formData)
 {
     $roles = new RolesTransfer();
     foreach ($formData[GroupForm::FIELD_ROLES] as $idRole) {
         $roleTransfer = (new RoleTransfer())->setIdAclRole($idRole);
         $roles->addRole($roleTransfer);
     }
     return $roles;
 }
示例#2
0
文件: Rule.php 项目: spryker/Acl
 /**
  * @param int $idRole
  *
  * @return \Generated\Shared\Transfer\RulesTransfer
  */
 public function getRoleRules($idRole)
 {
     $roleTransfer = new RoleTransfer();
     $roleTransfer->setIdAclRole($idRole);
     $rolesTransfer = new RolesTransfer();
     $rolesTransfer->addRole($roleTransfer);
     $rules = $this->findByRoles($rolesTransfer);
     return $rules;
 }
示例#3
0
文件: Group.php 项目: spryker/Acl
 /**
  * @param int $idGroup
  *
  * @return \Generated\Shared\Transfer\RoleTransfer
  */
 public function getRoles($idGroup)
 {
     $roleCollection = $this->queryContainer->queryGroupRoles($idGroup)->find();
     $roleTransferCollection = new RolesTransfer();
     foreach ($roleCollection as $roleEntity) {
         $roleTransfer = new RoleTransfer();
         $roleTransfer->fromArray($roleEntity->toArray(), true);
         $roleTransferCollection->addRole($roleTransfer);
     }
     return $roleTransferCollection;
 }
示例#4
0
文件: Role.php 项目: spryker/Acl
 /**
  * @param int $idGroup
  *
  * @return \Generated\Shared\Transfer\RolesTransfer
  */
 public function getGroupRoles($idGroup)
 {
     $aclRoleEntities = $this->queryContainer->queryGroupRoles($idGroup)->find();
     $rolesTransfer = new RolesTransfer();
     foreach ($aclRoleEntities as $aclRoleEntity) {
         $roleTransfer = new RoleTransfer();
         $roleTransfer->fromArray($aclRoleEntity->toArray(), true);
         $rolesTransfer->addRole($roleTransfer);
     }
     return $rolesTransfer;
 }