控制后台用户的权限

本文介绍了一种通过修改Joomla的mod_fullmenu.php文件来限制后台用户权限的方法,包括禁用模板管理、安装及编辑模块等功能,以保护网站免受误操作的影响。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我们有时想控制用户在后台的使用权限,有一种情况是做好网站后,给用户管理员权限,但是用户对Joomla不熟,等到他把里面的模块组件,删除又安装什么的,那才叫抓狂。你不给客户管理员权限,估计客户会不满意,但是Joomla的用户权限管理不好,怎么办?

    如果有一种方法,当客户以admin进入后台,可是很多功以都不可以用,比如安装删除组件、模块等等,只能更新文章,当自己想进去维护网站(比如:安装模块)时,修改回来就可以了。网友“与时俱进”提供了一种方法,测试通过。

    该方法通过修改文件administrator/modules/mod_fullmenu.php来实现,当你打开这个文件,你将看到如下内容(38行到49行):
        $manageTemplates     = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_templates' );
        $manageTrash         = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_trash' );
        $manageMenuMan         = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_menumanager' );
        $manageLanguages     = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_languages' );
        $installModules     = $acl->acl_check( 'administration', 'install', 'users', $usertype, 'modules', 'all' );
        $editAllModules     = $acl->acl_check( 'administration', 'edit', 'users', $usertype, 'modules', 'all' );
        $installMambots     = $acl->acl_check( 'administration', 'install', 'users', $usertype, 'mambots', 'all' );
        $editAllMambots     = $acl->acl_check( 'administration', 'edit', 'users', $usertype, 'mambots', 'all' );
        $installComponents     = $acl->acl_check( 'administration', 'install', 'users', $usertype, 'components', 'all' );
        $editAllComponents     = $acl->acl_check( 'administration', 'edit', 'users', $usertype, 'components', 'all' );
        $canMassMail         = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_massmail' );
        $canManageUsers     = $acl->acl_check( 'administration', 'manage', 'users', $usertype, 'components', 'com_users' );

仔细看一下估计你也能看得八九不离十了,比如你要求超级用户不可以安装模块,你可以将$installModules这行注释,在前面加"//"就可以注释了,这样改后,以超级用户进去就没有那个安装模块的菜单项了。其它的同理可得,我只测试其中几个,没有全部测试,有需要的自己摸索一下。

            变量               功能
        $manageTemplates     管理模板
        $manageTrash         管理回收站
        $manageMenuMan       管理菜单
        $manageLanguages     管理语言
        $installModules      安装模块
        $editAllModules      编辑模块
        $installMambots      安装插件
        $editAllMambots      编辑插件
        $installComponents   安装组件
        $editAllComponents   编辑组件
        $canMassMail         管理内部消息
        $canManageUsers      管理用户 

版权所有:www.joomer.cn,转载只需注明出处 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值