Fórumok

Access in control panel exception

thumbnail
Thomas Berg, módosítva 13 év-val korábban

Access in control panel exception

Regular Member Bejegyzések: 131 Csatlakozás dátuma: 2009.09.07. Legújabb bejegyzések
This has probably been asked before but I can't seem to find any posts about it.

Anyway, I've deployed a portlet with the following configuration in liferay-portlet.xml:

<control-panel-entry-category>portal</control-panel-entry-category>
<control-panel-entry-weight>1001</control-panel-entry-weight>
<control-panel-entry-class>com.example.MyControlPanelEntry</control-panel-entry-class>

The portlet shows in the control panel and is accessible to those with the right permissions but the following exception is thrown:

ERROR [AdvancedPermissionChecker:384] com.liferay.portal.NoSuchResourceActionException: example_WAR_exampleportlet#ACCESS_IN_CONTROL_PANEL

I'd be happy if anyone can explain why this is happening!

Thanks

/Thomas
thumbnail
Jan Gregor, módosítva 13 év-val korábban

RE: Access in control panel exception

Regular Member Bejegyzések: 224 Csatlakozás dátuma: 2010.10.20. Legújabb bejegyzések
Hi Thomas,

You are probably missing a permission that you must define for this portlet if you want to make it accessible in control panel.

Take a look at following article :

http://www.liferay.com/community/wiki/-/wiki/Main/Using+Liferay's+Permission+System+from+a+portlet
thumbnail
Thomas Berg, módosítva 13 év-val korábban

RE: Access in control panel exception

Regular Member Bejegyzések: 131 Csatlakozás dátuma: 2009.09.07. Legújabb bejegyzések
Hello Jan, thank you for your answer!

Solved my problem by adding the file /WEB-INF/src/portlet.properties with the following content:

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

and adding the file /WEB-INF/src/resource-actions/default.xml with the following content:

<!--?xml version="1.0" encoding="UTF-8"?-->

<resource-action-mapping>
    <portlet-resource>
        <portlet-name>example-portlet</portlet-name>
        <supports>
            <action-key>ACCESS_IN_CONTROL_PANEL</action-key>
            <action-key>CONFIGURATION</action-key>
            <action-key>VIEW</action-key>
        </supports>
        <community-defaults>
            <action-key>VIEW</action-key>
        </community-defaults>
        <guest-defaults>
            <action-key>VIEW</action-key>
        </guest-defaults>
        <guest-unsupported>
            <action-key>ACCESS_IN_CONTROL_PANEL</action-key>
            <action-key>CONFIGURATION</action-key>
        </guest-unsupported>
    </portlet-resource>
</resource-action-mapping>

Regards Thomas
thumbnail
Jan Gregor, módosítva 13 év-val korábban

RE: Access in control panel exception

Regular Member Bejegyzések: 224 Csatlakozás dátuma: 2010.10.20. Legújabb bejegyzések
Glad to help you emoticon
Hector Leon Garay, módosítva 12 év-val korábban

RE: Access in control panel exception

New Member Bejegyzések: 9 Csatlakozás dátuma: 2011.07.14. Legújabb bejegyzések
Thanks Jan and Thomas

I followed your link and Thomas example, It worked for me too

Regards
thumbnail
Arno Broekhof, módosítva 12 év-val korábban

RE: Access in control panel exception

Junior Member Bejegyzések: 42 Csatlakozás dátuma: 2011.10.18. Legújabb bejegyzések
Thanks, this solutions works!
Pritesh Shah, módosítva 11 év-val korábban

RE: Access in control panel exception

Junior Member Bejegyzések: 31 Csatlakozás dátuma: 2012.07.05. Legújabb bejegyzések
Hello Thomas,

I am new to Liferay, and have query related to this post.

I have requirement to disable view permission for guest users.
Portlets added to a public page by default has view permission to guest users. I want to disable this default view permission to guest users programmatically.

I tried your above solution in my new plugin portlet. I have created portlet.properties ( \WEB-INF\src\portlet.properties).
Also I have created default.xml (\WEB-INF\src\resource-actions\default.xml)

I deployed my plugin portlet and added portlet to a page and then logged out. But still guest user can see my portlet. I want to disable this permission.

I might be doing something wrong in configuration. Can you please guide me to accomplish this?

Please find attached sample Hello World plugin portlet having mentioned configuration files. Please guide me what am i doing wrong here

Thanks in Advance

Thanks,
Pritesh
thumbnail
Thomas Berg, módosítva 11 év-val korábban

RE: Access in control panel exception

Regular Member Bejegyzések: 131 Csatlakozás dátuma: 2009.09.07. Legújabb bejegyzések
Hello Pritesh,

It looks like you're using Liferay 6.0.x (from the schema used in liferay-portlet.xml)
Try adding the following to your default.xml:


	        <guest-defaults />
	        <guest-unsupported>
	            <action-key>ACCESS_IN_CONTROL_PANEL</action-key>
	            <action-key>ADD_TO_PAGE</action-key>
	            <action-key>VIEW</action-key>
	        </guest-unsupported>


For Liferay 6.1, you should instead use the following:

<!--?xml version="1.0"?-->


<resource-action-mapping>
    <portlet-resource>
        <portlet-name>my-hello-world-portlet</portlet-name>
        <permissions>
	        <supports>
	            <action-key>ACCESS_IN_CONTROL_PANEL</action-key>
	            <action-key>ADD_TO_PAGE</action-key>
	            <action-key>VIEW</action-key>
	        </supports>
	        <site-member-defaults>
	            <action-key>ADD_TO_PAGE</action-key>
	            <action-key>VIEW</action-key>
	        </site-member-defaults>
	        <guest-defaults />
	        <guest-unsupported>
	            <action-key>ACCESS_IN_CONTROL_PANEL</action-key>
	            <action-key>ADD_TO_PAGE</action-key>
	            <action-key>VIEW</action-key>
	        </guest-unsupported>
	    </permissions>
    </portlet-resource>
</resource-action-mapping>


To hide the portlet for those who does not have permission, add the following to you liferay-portlet.xml:

		<show-portlet-access-denied>false</show-portlet-access-denied>


Regards
/ Thomas
thumbnail
Vishal Panchal, módosítva 11 év-val korábban

RE: Access in control panel exception

Expert Bejegyzések: 289 Csatlakozás dátuma: 2012.05.20. Legújabb bejegyzések
Hi ,

Thanks for the solution it worked for me and saved my time too.. emoticon


Thanks & Regards,
Vishal R. Panchal
Pablo Martin, módosítva 9 év-val korábban

RE: Access in control panel exception

New Member Bejegyzések: 5 Csatlakozás dátuma: 2015.01.20. Legújabb bejegyzések
Hi,

I have 2 instances on my liferay
and the deployments of one cannot be seen to another.

How i suppose to do that?

Regards,
Pablo M.