Foren

Resource Action Mapping in EXT for out-of-the-box Portlets (My Account)

Monica Valverde, geändert vor 8 Jahren.

Resource Action Mapping in EXT for out-of-the-box Portlets (My Account)

New Member Beiträge: 17 Beitrittsdatum: 03.09.14 Neueste Beiträge
Hello all, I'm trying to change the access permission for My Account portlet. Basically I don't want any user to access it.

I'm doing the following:

(followed the instructions from here)

In an EXT in ext-impl/src I've created a directory named resource-actions with default-ext.xml.

default-ext.xml:

<!--?xml version="1.0"?-->
<resource-action-mapping>
	<portlet-resource>
        <portlet-name>2</portlet-name>
        <permissions>
            <supports>
                <action-key>VIEW</action-key>
                <action-key>UPDATE</action-key>
            </supports>
			<community-defaults />
            <site-member-defaults />
            <guest-defaults />
            <guest-unsupported>
                <action-key>VIEW</action-key>
                <action-key>UPDATE</action-key>
            </guest-unsupported>
			<layout-manager />
			<owner-defaults />
		</permissions>
    </portlet-resource>
</resource-action-mapping>


In portlet-ext.properties of the server I've added the following:


resource.actions.configs=resource-actions/default-ext.xml


I've restarted the server and then tried to access My Account with a user (through the dockbar, it opens the portlet in a popup), but it allowed the access.

Can anyone give some tips on this situation? Am I missing something here? Thank you!
Monica Valverde, geändert vor 8 Jahren.

RE: Resource Action Mapping in EXT for out-of-the-box Portlets (My Account) (Antwort)

New Member Beiträge: 17 Beitrittsdatum: 03.09.14 Neueste Beiträge
The solution above was not working as it was giving a NoSuchResourceActionException when I deploy it to a clean Liferay server instance and start it. I also should have looked in the portal-impl\src\resource-actions\portal.xml and copy pasted and change the content in my own resource action xml in the EXT. But it still wouldn't work as there are more resource action mappings of this portlet (My Account, named "2") in the resource-actions directory of other portlets, so it'd never successfully change the general permission of this portlet.

What actually worked was to remove a row in table resourceaction in the database. Using the following code in SetupAction does this:


ResourcePermissionLocalServiceUtil.deleteResourcePermissions(companyId, "2", ResourceConstants.SCOPE_COMPANY, companyId);


(note that due to cache the result might not persist right away that refresh/restart might be necessary)