Exemple #1
0
 public function checkPerm()
 {
     $db = ezcDbInstance::get();
     $act = $this->act == 'list' ? 'SHOW' : strToUpper($this->act);
     $name = strToUpper($this->baseName);
     if (!$this->auth->hasPerm($act, $name)) {
         die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
     }
     // Extra security
     R3Security::checkEnergyMeterForBuilding($this->act, $this->bu_id, $this->id, array('method' => $this->method, 'skip_methods' => array('fetchUDM', 'getEnergySourceList', 'getUtilityProductList')));
 }
Exemple #2
0
 public function checkPerm()
 {
     $act = $this->act == 'list' ? 'SHOW' : strToUpper($this->act);
     $name = strToUpper($this->baseName);
     if (!$this->auth->hasPerm($act, $name)) {
         die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
     }
     if (!in_array($this->act, array('list', 'add'))) {
         R3Security::checkBuilding($this->id);
     }
 }
 public function checkPerm()
 {
     $act = $this->act == 'list' ? 'SHOW' : strToUpper($this->act);
     $name = strToUpper($this->baseName);
     if (!$this->auth->hasPerm($act, $name)) {
         die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
     }
     if (!in_array($this->act, array('list', 'add'))) {
         if (!in_array($this->method, array('updateLastOpenCloseStatus'))) {
             R3Security::checkGlobalResult($this->ge_id);
         }
     }
 }
 public function checkPerm()
 {
     $mu_id = $this->auth->getParam('mu_id');
     $this->act = $mu_id == '' ? $this->act : 'show';
     $act = $this->act == 'list' ? 'SHOW' : strToUpper($this->act);
     $name = strToUpper($this->baseName);
     if (!$this->auth->hasPerm($act, $name)) {
         die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
     }
     if (!in_array($this->act, array('list', 'add'))) {
         if ($mu_id != '' && $this->id == '') {
             // Nothing do check
         } else {
             R3Security::checkGlobalStrategy($this->id);
         }
     }
 }
Exemple #5
0
 public function checkPerm()
 {
     $db = ezcDbInstance::get();
     $act = $this->act == 'list' ? 'SHOW' : strToUpper($this->act);
     $name = strToUpper($this->baseName);
     if (!$this->auth->hasPerm($act, $name)) {
         die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
     }
     if ($this->act == 'open') {
         // Download
         R3Security::checkDocumentByFileId($this->file_id);
     } else {
         // Attribute
         R3Security::checkDocumentForObject($this->act, $this->doc_object_id, $this->id, array('kind' => $this->type));
     }
 }
Exemple #6
0
 public function checkPerm()
 {
     $act = $this->act == 'list' ? 'SHOW' : strToUpper($this->act);
     $name = strToUpper($this->baseName);
     if (!$this->auth->hasPerm($act, $name)) {
         die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
     }
     if ($this->act == 'list' && $this->bu_id != '') {
         // Arrivo da edificio
         R3Security::checkActionCatalogForBuilding($this->act, $this->bu_id, $this->id, array('method' => $this->method, 'skip_methods' => array('checkSubActionMapLink')));
     } else {
         if (!in_array($this->act, array('list', 'add'))) {
             R3Security::checkActionCatalog($this->id);
         }
     }
 }
 public function checkPerm()
 {
     $db = ezcDbInstance::get();
     $act = $this->act == 'list' ? 'SHOW' : strToUpper($this->act);
     $name = 'GLOBAL_PLAIN_TABLE';
     if (!$this->auth->hasPerm($act, $name)) {
         die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
     }
     R3Security::checkGlobalPlain($this->gp_id);
 }
 public function checkPerm()
 {
     $act = $this->act == 'list' ? 'SHOW' : strToUpper($this->act);
     $name = strToUpper($this->baseName);
     if (!$this->auth->hasPerm($act, $name)) {
         die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
     }
     R3Security::checkGlobalPlain($this->gp_id);
 }
 public function checkPerm()
 {
     $db = ezcDbInstance::get();
     $act = $this->act == 'list' ? 'SHOW' : strToUpper($this->act);
     $name = 'GLOBAL_PLAIN_TABLE';
     if (!$this->auth->hasPerm($act, $name)) {
         die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
     }
     if ($this->act == 'list') {
         return true;
     }
     if ($this->act == 'add') {
         //R3Security::checkGlobalPlain($this->gp_id);
     } else {
         // Can edit/delete the given id
         if (!in_array($this->method, array())) {
             if ($this->gpr_id == null) {
                 $this->gpr_id = $this->id;
             }
             R3Security::checkGlobalPlainRow($this->gpr_id);
         }
     }
 }
Exemple #10
0
 public function checkPerm()
 {
     $db = ezcDbInstance::get();
     $act = $this->act == 'list' ? 'SHOW' : strToUpper($this->act);
     $name = strToUpper($this->baseName);
     if (!$this->auth->hasPerm($act, $name)) {
         die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
     }
     // Extra security
     R3Security::checkDeviceForEnergyMeter($this->act, $this->em_id, $this->id);
 }
Exemple #11
0
 public static function checkDocumentForObject($act, $object_id, $doc_id, array $opt = array())
 {
     $opt = array_merge(array('method' => '', 'skip_methods' => array(), 'kind' => null), $opt);
     if (!in_array($opt['method'], $opt['skip_methods'])) {
         if ($act == 'add' || $act == 'list' && $object_id != '') {
             switch ($opt['kind']) {
                 case 'building':
                     R3Security::checkBuilding($object_id);
                     break;
                 case 'street_lighting':
                     R3Security::checkStreetlighting($object_id);
                     break;
                 case 'global_entry':
                     R3Security::checkGlobalEntry($object_id);
                     break;
                 case 'global_plain':
                     R3Security::checkGlobalPlain($object_id);
                     break;
                 default:
                     throw new Exception("Invalid kind \"{$opt['kind']}\" for document#{$doc_id}");
             }
         } else {
             R3Security::checkDocument($doc_id);
         }
     }
 }
 public function checkPerm()
 {
     $db = ezcDbInstance::get();
     $act = $this->act == 'list' ? 'SHOW' : strToUpper($this->act);
     $name = strToUpper($this->baseName);
     if (!$this->auth->hasPerm($act, $name)) {
         die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
     }
     if ($this->act == 'add') {
         R3Security::checkGlobalEntry($this->ge_id);
     } else {
         // Can edit/delete the given id
         if (!in_array($this->method, array('getEnergySource', 'getEnergyUDM'))) {
             R3Security::checkGlobalSubcategory($this->id);
         }
     }
 }
Exemple #13
0
 public function checkPerm()
 {
     $db = ezcDbInstance::get();
     $act = $this->act == 'list' ? 'SHOW' : strToUpper($this->act);
     $name = strToUpper($this->baseName);
     if (!$this->auth->hasPerm($act, $name)) {
         die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
     }
     // Extra security
     $id = $this->kind == 'street_lighting' ? $this->sl_id : $this->em_id;
     R3Security::checkConsumptionForEnergyMeter($this->act, $id, $this->id, array('kind' => $this->kind));
 }