|
沙发

楼主 |
发表于 2022-2-12 16:19:00
|
只看该作者
第二版:
逻辑在mod.menu.php中,以reportid属性为判定。
代码段如下:
- function AuthorizeUser($menu){
- if(!array_key_exists("reportid",$menu)){
- /* 没有reportid的没必要做权限卡关 */
- return true;
- }
- $fun=strtoupper($menu["reportid"]);
- $desc=$menu["title"];
- $this->app->prepare_mes(false);
- $user=$this->app->empno; //获得当前登录员工帐号
- if($user=="SYANT"){
- /* 如果是管理员,则自动维护模块信息 */
- $sql="select MODULE,`FUNCTION`,FUN_NAME from sfc.c_module_fun_t where module='SMT_WEB' AND `FUNCTION`='{$fun}' limit 1";
- $res=$this->app->mes->getRow($sql);
- if($res){
- if($res["FUN_NAME"]!=$desc){
- $sql="update sfc.c_module_fun_t set FUN_NAME='{$desc}' where module='SMT_WEB' AND `FUNCTION`='{$fun}' limit 1";
- $this->app->mes->execute($sql);
- }
- }else{
- $sql="insert into sfc.c_module_fun_t(MODULE,`FUNCTION`,FUN_NAME) values ('SMT_WEB','{$fun}','{$desc}')";
- $this->app->mes->execute($sql);
- }
- //return true;
- }
- //
- return $this->app->AuthorizeUser($fun);
- }
复制代码
例如:
|
|