Example #1
0
 /**
  * Callback method which is executed when Usergroup permissions on a Page change
  *
  * @param int $usergroupId Usergroup Id
  * @param array $permissions Permissions (RREAD, RWRITE, RDELETE, RSUB, RSTAGE, RMODERATE, RCOMMENT, RSEND)
  * @param bool $value TRUE when the permission is granted, FALSE when it is removed
  */
 public function onPermissionsChange($usergroupId, $permissions, $value)
 {
     // Also set these permissions to the all blinds Cblocks in this Page
     $objectid = (int) $this->_id;
     $templateMgr = new Templates();
     $pageVersions = $this->getVersions();
     $blindCos = array();
     foreach ($pageVersions as $pageVersions_item) {
         $tmpPage = new Page($this->getSite(), $objectid, $pageVersions_item['VERSION']);
         $colist = $tmpPage->getCblockList('', false, true);
         foreach ($colist as $colistItem) {
             $coid = $colistItem['OBJECTID'];
             if ($coid > 0) {
                 array_push($blindCos, $coid);
             }
         }
     }
     $blindCos = array_unique($blindCos);
     $pagePermissions = $this->permissions->getByUsergroup($usergroupId, $objectid);
     if ($pagePermissions) {
         foreach ($blindCos as $coid) {
             $bcb = sCblockMgr()->getCblock($coid);
             $bcb->permissions->setPermissions($permissions, $coid);
         }
     }
     return true;
 }