留言板
Setting Portlet Permission from Background
Hi All,
I have around 300-400 portlets developed in an application and I want to set role based permissions( <portlet>->Configuration->Permissions) on them. Doing this one - by - one won't do. I observed that the changes we make in permission are being saved at "resourcepermission" table.
If there any way to do this from background? Are there any web services provided for this? I was looking into a web service named "Portal_ResourcePermissionService" and trying to execute "addResourcePermission", but I guess I was providing false parameters. Any how I am not sure if that is a correct way to do this of not.
Please help me with the issue.
I have around 300-400 portlets developed in an application and I want to set role based permissions( <portlet>->Configuration->Permissions) on them. Doing this one - by - one won't do. I observed that the changes we make in permission are being saved at "resourcepermission" table.
If there any way to do this from background? Are there any web services provided for this? I was looking into a web service named "Portal_ResourcePermissionService" and trying to execute "addResourcePermission", but I guess I was providing false parameters. Any how I am not sure if that is a correct way to do this of not.
Please help me with the issue.
David H Nebinger,修改在12 年前。
RE: Setting Portlet Permission from Background
Liferay Legend 帖子: 14916 加入日期: 06-9-2 最近的帖子
Never ever modify Liferay tables directly. It is a sure way to break your portal in ways that may not be immediately apparent.
Only use approved Liferay APIs for massaging the data. The good news is that there is the ResourcePermissionLocalServiceUtil that may have the API entry points you're looking for.
Only use approved Liferay APIs for massaging the data. The good news is that there is the ResourcePermissionLocalServiceUtil that may have the API entry points you're looking for.
Hir O,修改在12 年前。
RE: Setting Portlet Permission from Background
Junior Member 帖子: 30 加入日期: 12-3-14 最近的帖子
Thanks David,
Event I wasn't planning for direct database entries. I was just mentioning what I observed, What I needed was a (web) service or any API that can serve the purpose.
So I will check for the ResourcePermissionLocalServiceUtil but I am still confused about few parameters like scope, primKey and actionId
And will I have to write my service parallel to liferay services for this or there is any web service available in Liferay serving the purpose?
Event I wasn't planning for direct database entries. I was just mentioning what I observed, What I needed was a (web) service or any API that can serve the purpose.
So I will check for the ResourcePermissionLocalServiceUtil but I am still confused about few parameters like scope, primKey and actionId
And will I have to write my service parallel to liferay services for this or there is any web service available in Liferay serving the purpose?
Hitoshi Ozawa,修改在12 年前。
RE: Setting Portlet Permission from Background
Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
If you haven't deployed your portlets yet, why don't you just define default permissions unless you want to set permissions separately for each instance of a portlet.
http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/security-and-permissio-4
http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/security-and-permissio-4
Hir O,修改在12 年前。
RE: Setting Portlet Permission from Background
Junior Member 帖子: 30 加入日期: 12-3-14 最近的帖子
Thanks Hitoshi,
I was checking for service, and now I am almost done with that. Can you please tell me what is the "name" field in the "resourcepermission" table?
I tried giving portletId of portlet table but its not working.
I was checking for service, and now I am almost done with that. Can you please tell me what is the "name" field in the "resourcepermission" table?
I tried giving portletId of portlet table but its not working.
Hitoshi Ozawa,修改在12 年前。
RE: Setting Portlet Permission from Background
Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子Can you please tell me what is the "name" field in the "resourcepermission" table?
Try using class.getName()
Hir O,修改在12 年前。
RE: Setting Portlet Permission from Background
Junior Member 帖子: 30 加入日期: 12-3-14 最近的帖子
In my service, I have created some functions for my custom actions, and I am directly using ResourcePermissionLocalServiceUtil class without any other changes or anything, I hope the error isn't because of this.
The error log is
The error log is
03:10:00,913 ERROR [RoleBasedPermissionManagerServiceSoap:81] com.liferay.portal.NoSuchResourceActionException: TestPlugin_WAR_TestPluginportlet#7
com.liferay.portal.NoSuchResourceActionException: TestPlugin_WAR_TestPluginportlet#7
at com.liferay.portal.service.impl.ResourceActionLocalServiceImpl.getResourceAction(ResourceActionLocalServiceImpl.java:80)
at sun.reflect.GeneratedMethodAccessor149.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:86)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy67.getResourceAction(Unknown Source)
at com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl.doUpdateResourcePermission(ResourcePermissionLocalServiceImpl.java:400)
at com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl.updateResourcePermission(ResourcePermissionLocalServiceImpl.java:439)
at com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl.addResourcePermission(ResourcePermissionLocalServiceImpl.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:86)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy69.addResourcePermission(Unknown Source)
at com.liferay.portal.service.ResourcePermissionLocalServiceUtil.addResourcePermission(ResourcePermissionLocalServiceUtil.java:239)
at com.liferay.test.service.impl.RoleBasedPermissionManagerLocalServiceImpl.assignRoleBasedPermission(RoleBasedPermissionManagerLocalServiceImpl.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at com.liferay.portal.dao.jdbc.aop.DynamicDataSourceTransactionInterceptor.invoke(DynamicDataSourceTransactionInterceptor.java:44)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy275.assignRoleBasedPermission(Unknown Source)
at com.liferay.test.service.RoleBasedPermissionManagerLocalServiceUtil.assignRoleBasedPermission(RoleBasedPermissionManagerLocalServiceUtil.java:45)
at com.liferay.test.service.impl.RoleBasedPermissionManagerServiceImpl.assignRoleBasedPermission(RoleBasedPermissionManagerServiceImpl.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at com.liferay.portal.dao.jdbc.aop.DynamicDataSourceTransactionInterceptor.invoke(DynamicDataSourceTransactionInterceptor.java:44)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy276.assignRoleBasedPermission(Unknown Source)
at com.liferay.test.service.RoleBasedPermissionManagerServiceUtil.assignRoleBasedPermission(RoleBasedPermissionManagerServiceUtil.java:45)
at com.liferay.test.service.http.RoleBasedPermissionManagerServiceSoap.assignRoleBasedPermission(RoleBasedPermissionManagerServiceSoap.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at com.liferay.util.axis.AxisServlet.service(AxisServlet.java:119)
at com.liferay.portal.servlet.AxisServlet.service(AxisServlet.java:106)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at com.liferay.portal.kernel.servlet.PortalClassLoaderServlet.service(PortalClassLoaderServlet.java:95)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
at $Proxy282.doFilter(Unknown Source)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:182)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:62)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
at $Proxy282.doFilter(Unknown Source)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
at com.liferay.portal.servlet.filters.threadlocal.ThreadLocalFilter.processFilter(ThreadLocalFilter.java:52)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
at com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:62)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
David H Nebinger,修改在12 年前。
RE: Setting Portlet Permission from Background
Liferay Legend 帖子: 14916 加入日期: 06-9-2 最近的帖子
NoSuchResourceActionException is what it is. You're trying to add a permission w/ a non-existent action.
Hir O,修改在12 年前。
RE: Setting Portlet Permission from Background
Junior Member 帖子: 30 加入日期: 12-3-14 最近的帖子
Thanks David and Hitoshi