3

I have developed a component and added ACL for viewing permissions in it and everything works great, the only issue is that when I install the component by default it uses 'inherited' permissions for view which somehow comes as denied and everytime I install the component I have to first change the permission to 'Allowed' so I wanted to ask if there is way to set default values for permissions like there is for everything else? If there is then what exactly is the syntax? Thanks

PS: Please don't provide me with this link as I have read it and it doesn't solve my problem.

Following is my config.xml permissions code

<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>
4

1 回答 1

1

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

如果我们需要默认授予对特定组(如 Manager 或 Author)的完全访问权限,

在中,我们必须像这张表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'

于 2012-09-07T07:22:57.230 回答