Joomla 2.5设置了默认的ACL权限值

时间:2012-07-28 09:52:37

标签: permissions acl joomla2.5

我开发了一个组件并添加了ACL以查看其中的权限,一切运行良好,唯一的问题是,当我默认安装组件时,它使用“继承”权限进行视图,不知何故被拒绝,每次我安装组件我必须首先将权限更改为“允许”,所以我想询问是否有方法为权限设置默认值,就像其他所有权限一样?如果有,那么语法究竟是什么?感谢

PS:请不要向我提供this link,因为我已经阅读了它并且它无法解决我的问题。

以下是我的config.xml权限代码

<fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" description="JCONFIG_PERMISSIONS_DESC">
        <field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" filter="rules" component="com_name" section="component">
            <action name="core.view" title="View" description="View" />
        </field>
    </fieldset>

1 个答案:

答案 0 :(得分:1)

安装组件时,您必须更新#__assets表中的权限规则。

如果我们需要默认授予管理员或作者等特定群组的完全访问权限,

install.yourcomponent.php中,我们必须像这个update #__assets表一样编写自己的查询。

#__assets表中有rules字段,它将存储所有权限值,因此我们需要使用我们的值更新表。

例如:

update #__assets set规则='{"core.manage":{"6":1},"core.configuration":{"6":1,"7":1,"8":1},"core.admin":[],"core.create":[],"core.delete":[],"core.edit":{"8":1},"core.edit.state":{"8":1}}' where name ='com_yourcomponent' and title='yourcomponent title'