function afterLoad() { if (!$this->__isSuperUser) { unset($this->password); } // Load groups $this->groups = $this->parents(static::GROUP_RELATION); return parent::afterLoad(); }
function afterLoad() { // unpack uuid $this->uuid = util::unpackUuid($this->uuid); // Merge tasks with settings $this->tasks = array_reduce((array) @$this->tasks, function ($result, $task) { $taskModel = new Task($task); $taskModel->load($taskModel->identity()); if ($taskModel->identity()) { $taskModel->appendData($task); $result[] = $taskModel; } return $result; }, array()); // Restrict to users who have access to the first step if (!$this->__isSuperUser) { if (!array_intersect((array) @$this->tasks[0]->userGroups(), (array) @$this->__request->user->groups)) { $this->data(array()); } } return parent::afterLoad(); }
/** * @protected * * Unpack uuid field. */ function afterLoad() { // unpack uuid $this->uuid = util::unpackUuid($this->uuid); return parent::afterLoad(); }
/** * @protected * * Load task contents, remove task scripts. */ function afterLoad() { // unpack uuid $this->uuid = util::unpackUuid($this->uuid); $this->nextTask = util::unpackUuid($this->nextTask); // note: Only users with access to nextTask has view permission. if (!$this->__isSuperUser) { // 1. Group:User $res = (array) @$this->__request->user->groups; // 2. Task:Group $res = Relation::getAncestors($res, Task::GROUP_RELATION); // 3. Task $res = Relation::getDescendants($res, 'Task'); // 4. UUID comparison if (!in_array($this->nextTask, $res)) { return $this->data(array()); } } // load task details, do not expose internal scripts $taskInstance = new TaskInstance(); $this->tasks = array_map(removes('order'), $taskInstance->find(array('uuid' => $this->children($taskInstance::WORK_RELATION), '@sorter' => ['order']))); unset($taskInstance); $res = parent::afterLoad(); // lock the item after load $this->_immutable = true; return $res; }