Message Boards
Liferay 7 MVC Portlet only showing view.jsp for Administrator
Robert Schrepfer, modified 4 Years ago.
Liferay 7 MVC Portlet only showing view.jsp for Administrator
New Member Posts: 14 Join Date: 2/14/20 Recent Posts
Hello everyone,
I am desperate. I feel like I have tried everything and the answer to the problem is probably 1 line of code.I have created an osgi-module mvc portlet with a control panel entry.When I deploy the module everything works as expected. The module shows in control panel, the view.jsp gets rendered with my content...
But only when I have given my user the administrator role. Any other role and the control panel entry shows, but when I click on it the content is not rendered.I tried removing "javax.portlet.security-role-ref=user,guest,power-user,administrator", no change. I tried adding other roles, no change. I tried giving other roles view permissions in control panel via website (Control Panel -> User -> Roles), no change.
And the worst part? I dont even want it to be seen by these roles, I handle control panel viewing separately anyways so my requirement is to just show the content always when anyone clicks on the panel entry for "my portlet".
@Component(immediate = true,
property = {
"javax.portlet.init-param.view-template=/html/view.jsp",
"javax.portlet.init-param.config-template=/html/myportlet/config.jsp",
"javax.portlet.mime-type=text/html",
"javax.portlet.portlet-mode=text/html;view",
"javax.portlet.expiration-cache=0",
"javax.portlet.security-role-ref=user,guest,power-user,administrator",
"com.liferay.portlet.icon=/icon.png",
"com.liferay.portlet.instanceable=false",
"javax.portlet.display-name=My Portlet",
"javax.portlet.name=my-portlet",
"com.liferay.portlet.preferences-owned-by-group=true",
"com.liferay.portlet.preferences-unique-per-layout=false",
"com.liferay.portlet.scopeable=true",
"com.liferay.portlet.private-request-attributes=false",
"com.liferay.portlet.private-session-attributes=false"
},
service = Portlet.class
)
public class MyPortlet extends MVCPortlet {
I am desperate. I feel like I have tried everything and the answer to the problem is probably 1 line of code.I have created an osgi-module mvc portlet with a control panel entry.When I deploy the module everything works as expected. The module shows in control panel, the view.jsp gets rendered with my content...
But only when I have given my user the administrator role. Any other role and the control panel entry shows, but when I click on it the content is not rendered.I tried removing "javax.portlet.security-role-ref=user,guest,power-user,administrator", no change. I tried adding other roles, no change. I tried giving other roles view permissions in control panel via website (Control Panel -> User -> Roles), no change.
And the worst part? I dont even want it to be seen by these roles, I handle control panel viewing separately anyways so my requirement is to just show the content always when anyone clicks on the panel entry for "my portlet".
@Component(immediate = true, property = {
"panel.app.order:Integer=10000",
"panel.category.key="+PanelCategoryKeys.SITE_ADMINISTRATION_MEMBERS
,
service = PanelApp.class
)
@Component(immediate = true,
property = {
"javax.portlet.init-param.view-template=/html/view.jsp",
"javax.portlet.init-param.config-template=/html/myportlet/config.jsp",
"javax.portlet.mime-type=text/html",
"javax.portlet.portlet-mode=text/html;view",
"javax.portlet.expiration-cache=0",
"javax.portlet.security-role-ref=user,guest,power-user,administrator",
"com.liferay.portlet.icon=/icon.png",
"com.liferay.portlet.instanceable=false",
"javax.portlet.display-name=My Portlet",
"javax.portlet.name=my-portlet",
"com.liferay.portlet.preferences-owned-by-group=true",
"com.liferay.portlet.preferences-unique-per-layout=false",
"com.liferay.portlet.scopeable=true",
"com.liferay.portlet.private-request-attributes=false",
"com.liferay.portlet.private-session-attributes=false"
},
service = Portlet.class
)
public class MyPortlet extends MVCPortlet {
Robert Schrepfer, modified 3 Years ago.
RE: Liferay 7 MVC Portlet only showing view.jsp for Administrator
New Member Posts: 14 Join Date: 2/14/20 Recent Posts
Well at least it seems like this is not a trivial problem, so I am not completely stupid
Robert Schrepfer, modified 3 Years ago.
RE: Liferay 7 MVC Portlet only showing view.jsp for Administrator
New Member Posts: 14 Join Date: 2/14/20 Recent Posts
I have fixed the issue by replacing the annotation property as follows. I don't know which exact setting made it fail for me, nor do I care to be honest, as this has taken way too much time for such a simple problem. But for anyone who stumbles upon this issue:
Note: it was NOT the "javax.portlet.security-role-ref=administrator,user,guest" setting as I have tried changing it the old annotation and it did not have an impact.
@Component(immediate = true,
property = {
"com.liferay.portlet.add-default-resource=true",
"com.liferay.portlet.display-category=category.hidden",
"com.liferay.portlet.icon=/icons/site_admin.png",
"com.liferay.portlet.preferences-owned-by-group=true",
"com.liferay.portlet.private-request-attributes=false",
"com.liferay.portlet.private-session-attributes=false",
"com.liferay.portlet.render-weight=50",
"com.liferay.portlet.use-default-template=true",
"javax.portlet.display-name=My Portlet",
"javax.portlet.expiration-cache=0",
"javax.portlet.init-param.template-path=/META-INF/resources/",
"javax.portlet.init-param.view-template=/html/view.jsp",
"javax.portlet.name=my-portlet",
"javax.portlet.resource-bundle=content.Language",
"javax.portlet.security-role-ref=administrator,user,guest"
},
service = Portlet.class
)
Note: it was NOT the "javax.portlet.security-role-ref=administrator,user,guest" setting as I have tried changing it the old annotation and it did not have an impact.
Christoph Rabel, modified 3 Years ago.
RE: Liferay 7 MVC Portlet only showing view.jsp for Administrator
Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
If I had to bet, I would put my money onĀ "com.liferay.portlet.add-default-resource=true".