public function handleAddAcl(string $role, string $resource = null, string $privilege = null)
    {
        $idRole = $this->identityAuthorizator->getIdRoleByName($role);

        $idResource = null;
        if ($resource) {
            $idResource = $this->identityAuthorizator->getIdResourceByName($resource);
        }

        $idPrivilege = null;
        if ($privilege) {
            $idPrivilege = $this->identityAuthorizator->getIdPrivilegeByName($privilege);
            if (!$idPrivilege) {
                $this->identityAuthorizator->savePrivilege(['id' => null, 'privilege' => $privilege]);
                $idPrivilege = $this->identityAuthorizator->getIdPrivilegeByName($privilege);
            }
        } else {
            $idPrivilege = 'all';
        }

        if ($idResource && $idPrivilege) {
            // save acl by one
            if ($this->identityAuthorizator->saveAcl($idRole, [$idResource => [$idPrivilege]], false)) {
                $this->flashMessage('Save ACL');
            }
        }
        $this->redirect('this');
    }
public function handleAddAcl(string $role, string $resource = null, string $privilege = null)
    {
        $idRole = $this->identityAuthorizator->getIdRoleByName($role);

        $idResource = null;
        if ($resource) {
            $idResource = $this->identityAuthorizator->getIdResourceByName($resource);
        }

        $idPrivilege = null;
        if ($privilege) {
            $idPrivilege = $this->identityAuthorizator->getIdPrivilegeByName($privilege);
            if (!$idPrivilege) {
                $this->identityAuthorizator->savePrivilege(['id' => null, 'privilege' => $privilege]);
                $idPrivilege = $this->identityAuthorizator->getIdPrivilegeByName($privilege);
            }
        } else {
            $idPrivilege = 'all';
        }

        if ($idResource && $idPrivilege) {
            // save acl by one
            if ($this->identityAuthorizator->saveAcl($idRole, [$idResource => [$idPrivilege]], false)) {
                $this->flashMessage('Save ACL');
            }
        }
        $this->redirect('this');
    }
public function handleAddAcl ( string $ role , string $ resource = null , string $ privilege = null ) { $ idRole = $ this -> identityAuthorizator -> getIdRoleByName ( $ role ) ; $ idResource = null ; if ( $ resource ) { $ idResource = $ this -> identityAuthorizator -> getIdResourceByName ( $ resource ) ; } $ idPrivilege = null ; if ( $ privilege ) { $ idPrivilege = $ this -> identityAuthorizator -> getIdPrivilegeByName ( $ privilege ) ; if ( ! $ idPrivilege ) { $ this -> identityAuthorizator -> savePrivilege ( [ 'id' => null , 'privilege' => $ privilege ] ) ; $ idPrivilege = $ this -> identityAuthorizator -> getIdPrivilegeByName ( $ privilege ) ; } } else { $ idPrivilege = 'all' ; } if ( $ idResource && $ idPrivilege ) { // save acl by one if ( $ this -> identityAuthorizator -> saveAcl ( $ idRole , [ $ idResource => [ $ idPrivilege ] ] , false ) ) { $ this -> flashMessage ( 'Save ACL' ) ; } } $ this -> redirect ( 'this' ) ; }
Handle add acl.

@param string      $role
@param string|null $resource
@param string|null $privilege
Handle add acl .