private function getGroupList($tree_id) { if ($this->groupList) { return $this->groupList; } $acl = new Acl(); $aclList = $acl->getAclGroupList($tree_id); $this->groupList = array(); foreach ($aclList as $grp_id => $rights) { if (!in_array(Acl::VIEW, $rights)) { continue; } $this->groupList[] = $grp_id; } return $this->groupList; }
/** * notifies users able to edit node id and with notify option enabled * only users that are not frontend type are notified * * @param integer $tree_id node id that requests notification. Users with rights for this node will be notified * @param string $subject subject of email message * @param string $message content of notification email */ public function notify($tree_id = NULL, $subject, $message) { $searchcriteria = array('notify' => true); $acl = new Acl(); $grouplist = $acl->getAclGroupList($tree_id); $group = array(); foreach ($grouplist as $grp_id => $item) { if (in_array(Acl::EDIT, $item) || in_array(Acl::CREATE, $item) || in_array(Acl::MODIFY, $item) || in_array(Acl::DELETE, $item)) { $group[] = $grp_id; } } if ($group) { $searchcriteria['tree_access'] = $group; } else { $searchcriteria['role'] = self::ROLE_ADMIN; } $userlist = $this->getList($searchcriteria); $mailto = array(); foreach ($userlist['data'] as $item) { $mailto[] = $item['email']; } if (!$mailto) { return; } $this->sendMail($mailto, $this->director->getConfig()->email_address, $subject, $message); }
/** * handle edit */ private function handleAdminEditRootAclGet($retrieveFields = true) { $template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile); $request = Request::getInstance(); if (!$request->exists('id')) { throw new Exception(__FUNCTION__ . ' Node ontbreekt.'); } $id = intval($request->getValue('id')); $template->setVariable('id', $id, false); $key = array('id' => $id); // check if node exists if ($id != $this->tree->getRootId()) { throw new HttpException('403'); } $this->tree->setCurrentId($id); $this->renderBreadcrumb(); // check if user has execute rights $auth = Authentication::getInstance(); // edit root node only for acl. only admins can edit acl if (!$auth->isRole(SystemUser::ROLE_ADMIN)) { throw new HttpException('403'); } $groupSelect = array(); if ($retrieveFields) { $acl = new Acl(); $groupSelect = $acl->getAclGroupList($id); } else { $groupSelect = $request->getValue('acl'); } if (!is_array($groupSelect)) { $groupSelect = array(); } $template->setVariable('groupSelect', $groupSelect, false); $this->handleEdit($template, array()); $this->template[$this->director->theme->getConfig()->main_tag] = $template; }
private function getUserCombo($tree_id, $usr_id) { $acl = new Acl(); $aclList = $acl->getAclGroupList($tree_id); $groupList = array(); foreach ($aclList as $grp_id => $rights) { if (!in_array(Acl::VIEW, $rights)) { continue; } $groupList[] = $grp_id; } $userList = $this->director->systemUser->getList(array('grp_id' => $groupList)); return Utils::getHtmlCombo($userList['data'], $usr_id, NULL, 'id', 'formatName'); }