Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Thomas Berg
Access in control panel exception
22. November 2010 07:35
Antwort

Thomas Berg

Rang: Regular Member

Nachrichten: 134

Eintrittsdatum: 7. September 2009

Neue Beiträge

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:

1<control-panel-entry-category>portal</control-panel-entry-category>
2<control-panel-entry-weight>1001</control-panel-entry-weight>
3<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:

1ERROR [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
Jan Gregor
RE: Access in control panel exception
22. November 2010 10:31
Antwort

Jan Gregor

Rang: Regular Member

Nachrichten: 224

Eintrittsdatum: 20. Oktober 2010

Neue Beiträge

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
Thomas Berg
RE: Access in control panel exception
23. November 2010 01:21
Antwort

Thomas Berg

Rang: Regular Member

Nachrichten: 134

Eintrittsdatum: 7. September 2009

Neue Beiträge

Hello Jan, thank you for your answer!

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

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

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

 1<?xml version="1.0" encoding="UTF-8"?>
 2
 3<resource-action-mapping>
 4    <portlet-resource>
 5        <portlet-name>example-portlet</portlet-name>
 6        <supports>
 7            <action-key>ACCESS_IN_CONTROL_PANEL</action-key>
 8            <action-key>CONFIGURATION</action-key>
 9            <action-key>VIEW</action-key>
10        </supports>
11        <community-defaults>
12            <action-key>VIEW</action-key>
13        </community-defaults>
14        <guest-defaults>
15            <action-key>VIEW</action-key>
16        </guest-defaults>
17        <guest-unsupported>
18            <action-key>ACCESS_IN_CONTROL_PANEL</action-key>
19            <action-key>CONFIGURATION</action-key>
20        </guest-unsupported>
21    </portlet-resource>
22</resource-action-mapping>

Regards Thomas
Jan Gregor
RE: Access in control panel exception
23. November 2010 04:48
Antwort

Jan Gregor

Rang: Regular Member

Nachrichten: 224

Eintrittsdatum: 20. Oktober 2010

Neue Beiträge

Glad to help you emoticon
Hector Leon Garay
RE: Access in control panel exception
25. Juli 2011 08:23
Antwort

Hector Leon Garay

Rang: New Member

Nachrichten: 15

Eintrittsdatum: 14. Juli 2011

Neue Beiträge

Thanks Jan and Thomas

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

Regards
Arno Broekhof
RE: Access in control panel exception
20. März 2012 15:48
Antwort

Arno Broekhof

Rang: Junior Member

Nachrichten: 42

Eintrittsdatum: 18. Oktober 2011

Neue Beiträge

Thanks, this solutions works!
Pritesh Shah
RE: Access in control panel exception
4. Juli 2012 22:31
Antwort

Pritesh Shah

Rang: Junior Member

Nachrichten: 31

Eintrittsdatum: 4. Juli 2012

Neue Beiträge

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
Anhänge: my-hello-world-portlet.zip (26,5k)
Thomas Berg
RE: Access in control panel exception
5. Juli 2012 02:51
Antwort

Thomas Berg

Rang: Regular Member

Nachrichten: 134

Eintrittsdatum: 7. September 2009

Neue Beiträge

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:

1
2            <guest-defaults />
3            <guest-unsupported>
4                <action-key>ACCESS_IN_CONTROL_PANEL</action-key>
5                <action-key>ADD_TO_PAGE</action-key>
6                <action-key>VIEW</action-key>
7            </guest-unsupported>


For Liferay 6.1, you should instead use the following:

 1<?xml version="1.0"?>
 2<!DOCTYPE resource-action-mapping PUBLIC "-//Liferay//DTD Resource Action Mapping 6.1.0//EN" "http://www.liferay.com/dtd/liferay-resource-action-mapping_6_1_0.dtd">
 3
 4<resource-action-mapping>
 5    <portlet-resource>
 6        <portlet-name>my-hello-world-portlet</portlet-name>
 7        <permissions>
 8            <supports>
 9                <action-key>ACCESS_IN_CONTROL_PANEL</action-key>
10                <action-key>ADD_TO_PAGE</action-key>
11                <action-key>VIEW</action-key>
12            </supports>
13            <site-member-defaults>
14                <action-key>ADD_TO_PAGE</action-key>
15                <action-key>VIEW</action-key>
16            </site-member-defaults>
17            <guest-defaults />
18            <guest-unsupported>
19                <action-key>ACCESS_IN_CONTROL_PANEL</action-key>
20                <action-key>ADD_TO_PAGE</action-key>
21                <action-key>VIEW</action-key>
22            </guest-unsupported>
23        </permissions>
24    </portlet-resource>
25</resource-action-mapping>


To hide the portlet for those who does not have permission, add the following to you liferay-portlet.xml:
1
2        <show-portlet-access-denied>false</show-portlet-access-denied>


Regards
/ Thomas
Vishal Panchal
RE: Access in control panel exception
9. August 2012 00:45
Antwort

Vishal Panchal

Rang: Expert

Nachrichten: 280

Eintrittsdatum: 20. Mai 2012

Neue Beiträge

Hi ,

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


Thanks & Regards,
Vishal R. Panchal
Pablo Martin
RE: Access in control panel exception
21. Januar 2015 08:30
Antwort

Pablo Martin

Rang: New Member

Nachrichten: 5

Eintrittsdatum: 20. Januar 2015

Neue Beiträge

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.