我们有时想控制用户在后台的使用权限,有一种情况是做好网站后,给用户管理员权限,但是用户对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,转载只需注明出处