/** * @return bool */ public function executeCommand() { if ($_GET['mode']) { $this->ctrl->saveParameter($this, 'mode'); $this->ctrl->setParameterByClass("ildatacollectionrecordlistgui", "mode", $_GET['mode']); } $this->ctrl->saveParameter($this, 'redirect'); if ($this->record_id) { $this->record = ilDataCollectionCache::getRecordCache($this->record_id); if (!$this->record->hasPermissionToEdit($this->parent_obj->ref_id) or !$this->record->hasPermissionToView($this->parent_obj->ref_id)) { $this->accessDenied(); } $this->table = $this->record->getTable(); $this->table_id = $this->table->getId(); } else { $this->table = ilDataCollectionCache::getTableCache($this->table_id); if (!ilObjDataCollectionAccess::hasAddRecordAccess($_GET['ref_id'])) { $this->accessDenied(); } } $cmd = $this->ctrl->getCmd(); switch ($cmd) { default: $this->{$cmd}(); break; } return true; }
/** * @param $ref_id int the reference id of the current datacollection object * @param $record ilDataCollectionRecord the record which will be deleted * * @return bool */ public function hasPermissionToDeleteRecord($ref_id, ilDataCollectionRecord $record) { if (ilObjDataCollectionAccess::hasWriteAccess($ref_id)) { return true; } if (!ilObjDataCollectionAccess::hasAddRecordAccess($ref_id)) { return false; } if (!$this->checkLimit()) { return false; } if ($this->getDeletePerm() && !$this->getEditByOwner()) { return true; } if ($this->getEditByOwner()) { // Edit by owner is set... user is only allowed to edit her own entries return $this->checkEditByOwner($record); } return false; }