简体   繁体   中英

Resourse permission checker Liferay 7

I have my portlet with CRUD-operations (different bundles, services, etc.).

I want to implement custom actions in permission for this portlet.

I create default.xml file:

<?xml version="1.0"?>

<resource-action-mapping>
       <portlet-resource>
       <portlet-name>com.mypackage.MyPortlet</portlet-name>
          <permissions>
           <supports>
               <action-key>STACKOVERFLOW_ACTION</action-key>
           </supports>
           </permissions>
       </portlet-resource>
</resource-action-mapping>

And create portlet.properties :

include-and-override=portlet-ext.properties
resource.actions.configs=resource-actions/default.xml

The questions is - why do I have nothing in control panel besides default actions life "ADD_TO_PAGE", etc? What am I doing wrong?

UPD: This varient doesn't work too. =(

<?xml version="1.0"?>

<!DOCTYPE resource-action-mapping PUBLIC "-//Liferay//DTD Resource Action Mapping 7.0.0//EN" "http://www.liferay.com/dtd/liferay-resource-action-mapping_7_0_0.dtd">

<resource-action-mapping>

<model-resource>
        <model-name>mypackage.web.portlet.MyPortlet</model-name>
    <portlet-ref>
        <portlet-name>mypackage_web_portlet_MyPortlet</portlet-name>
    </portlet-ref>
    <root>true</root>
    <weight>1</weight>
    <permissions>
        <supports>
            <action-key>VIEW_TEST</action-key>
        </supports>
        <site-member-defaults>
            <action-key>SUBSCRIBE_TEST</action-key>
        </site-member-defaults>
        <guest-defaults />
        <guest-unsupported>
            <action-key>ADD_ENTRY_TEST</action-key>
            <action-key>PERMISSIONS_TEST</action-key>
            <action-key>SUBSCRIBE_TEST</action-key>
        </guest-unsupported>
    </permissions>
</model-resource>

您应该使用<model-resource>块而不是<portlet-resource> :Portlet-Resource由Liferay处理(并使用预定义的词汇表),而您的portlet或服务引入自己的数据类型,您可以在其上定义自己的权限。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM