/** * 编辑权限菜单 * * @param object $data * @return boolean true|false * @access public */ public function editAcl(AclSave $data) { $id = intval(url_param_decode($data->id)); unset($data->id); if (!$id) { return $this->setErrorMsg(Lang::get('common.illegal_operation')); } if (!$this->aclValidate->edit($data)) { return $this->setErrorMsg($this->aclValidate->getErrorMessage()); } if ($this->permissionModel->checkIfIsExists($data->module, $data->class, $data->action, false, $id)) { return $this->setErrorMsg(Lang::get('acl.acl_exists')); } $data = $data->toArray(); if ($this->permissionModel->editPermission($data, intval($id)) === false) { return $this->setErrorMsg(Lang::get('common.action_error')); } return true; }
/** * 编辑权限菜单 * * @param string $data * @access public * @return boolean true|false */ public function editAcl(\App\Services\Admin\Acl\Param\AclSave $data) { $id = intval(url_param_decode($data->id)); unset($data->id); if (!$id) { return $this->setErrorMsg(Lang::get('common.illegal_operation')); } if (!$this->aclValidate->edit($data)) { return $this->setErrorMsg($this->aclValidate->getErrorMessage()); } if ($this->permissionModel->checkIfIsExists($data->module, $data->class, $data->action, false, $id)) { return $this->setErrorMsg(Lang::get('acl.acl_exists')); } $info = $this->permissionModel->getOnePermissionById(intval($data->pid)); $data = $data->toArray(); $data['level'] = $info['level'] + 1; if ($this->permissionModel->editPermission($data, intval($id)) !== false) { return true; } return $this->setErrorMsg(Lang::get('common.action_error')); }