public function updatePermissions()
    {
        if ($this->isHiringOrganization()) {
            $organization = $this->getParent();
            $owner        = $organization->getUser();

            $this->setUser($owner);
        } else {
            $organization = $this;
        }

        /* @var $employees null | ArrayCollection | \Doctrine\ODM\MongoDB\PersistentCollection */
        $employees = $organization->getEmployees();

        $perms = $this->getPermissions();

        foreach ($employees as $emp) {
            /* @var $emp \Organizations\Entity\Employee */
            $perms->grant($emp->getUser(), PermissionsInterface::PERMISSION_CHANGE, false);
        }
        $perms->build();
    }
public function updatePermissions()
    {
        if ($this->isHiringOrganization()) {
            $organization = $this->getParent();
            $owner        = $organization->getUser();

            $this->setUser($owner);
        } else {
            $organization = $this;
        }

        /* @var $employees null | ArrayCollection | \Doctrine\ODM\MongoDB\PersistentCollection */
        $employees = $organization->getEmployees();

        $perms = $this->getPermissions();

        foreach ($employees as $emp) {
            /* @var $emp \Organizations\Entity\Employee */
            $perms->grant($emp->getUser(), PermissionsInterface::PERMISSION_CHANGE, false);
        }
        $perms->build();
    }
public function updatePermissions ( ) { if ( $ this -> isHiringOrganization ( ) ) { $ organization = $ this -> getParent ( ) ; $ owner = $ organization -> getUser ( ) ; $ this -> setUser ( $ owner ) ; } else { $ organization = $ this ; } /* @var $employees null | ArrayCollection | \Doctrine\ODM\MongoDB\PersistentCollection */ $ employees = $ organization -> getEmployees ( ) ; $ perms = $ this -> getPermissions ( ) ; foreach ( $ employees as $ emp ) { /* @var $emp \Organizations\Entity\Employee */ $ perms -> grant ( $ emp -> getUser ( ) , PermissionsInterface :: PERMISSION_CHANGE , false ) ; } $ perms -> build ( ) ; }
Updates the organizationsPermissions to allow all employees to view this organization.

In case of a HiringOrganization Permissions are granted to all employees of the parent
organization.

@ODM\PreUpdate
@ODM\PrePersist
@since 0.18
Updates the organizationsPermissions to allow all employees to view this organization .