/** * 用户权限入库 * * @return boolean true|false */ private function saveUserPermission() { $this->checkFormHash(); $permissions = (array) Request::input('permission'); $id = (int) Request::input('id'); $all = Request::input('all'); if (!(new Acl())->checkGroupLevelPermission($id, Acl::GROUP_LEVEL_TYPE_USER)) { return Js::error(Lang::get('common.account_level_deny'), true); } $params = new AclSet(); $manager = new AclProcess(); $params->setPermission($permissions)->setAll($all)->setId($id); if (!$manager->setUserAcl($params)) { return responseJson($manager->getErrorMessage()); } $this->setActionLog(); return responseJson(Lang::get('common.action_success')); }
/** * 用户权限入库 * * @return boolean true|false */ private function saveUserPermissionToDatabase() { $this->checkFormHash(); $permissions = (array) Request::input('permission'); $id = Request::input('id'); $all = Request::input('all'); if (!$id or !is_numeric($id) or !$all) { return responseJson(Lang::get('common.illegal_operation')); } $params = new \App\Services\Admin\Acl\Param\AclSet(); $params->setPermission($permissions)->setAll($all)->setId($id); $manager = new AclActionProcess(); $result = $manager->setUserAcl($params); if ($result) { $this->setActionLog(); return responseJson(Lang::get('common.action_success')); } return responseJson($manager->getErrorMessage()); }