Foren
adding phone number and permission checker
raghu N M, geändert vor 13 Jahren.
adding phone number and permission checker
Junior Member Beiträge: 27 Beitrittsdatum: 27.07.10 Neueste Beiträge
Hello liferay development team,
I using below code add phone number from seperat resource as a hook.
it throwing permission checker exception. How to avoid permission checker during mass upload.
User user = UserLocalServiceUtil.getUser(userid);
Contact cont = user.getContact();
long classPK = cont.getContactId();
String className = Contact.class.getName();
String phone = "4083069596";
try
{
String ext = "12121";
PhoneServiceUtil.addPhone(className, classPK,rs.getString(4), rs.getString(3), 11006, true);
}catch(Exception e)
{
e.printStackTrace();
}
exception:
com.liferay.portal.security.auth.PrincipalException: PermissionChecker not initialized
14:15:53,808 ERROR [STDERR] at com.liferay.portal.service.base.PrincipalBean.getPermissionChecker(PrincipalBean.java:81)
14:15:53,808 ERROR [STDERR] at com.liferay.portal.service.impl.PhoneServiceImpl.addPhone(PhoneServiceImpl.java:36)
14:15:53,808 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor478.invoke(Unknown Source)
14:15:53,808 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:15:53,808 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
14:15:53,808 ERROR [STDERR] at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:75)
14:15:53,808 ERROR [STDERR] at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
14:15:53,808 ERROR [STDERR] at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
14:15:53,808 ERROR [STDERR] at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
14:15:53,808 ERROR [STDERR] at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
14:15:53,808 ERROR [STDERR] at $Proxy229.addPhone(Unknown Source)
I using below code add phone number from seperat resource as a hook.
it throwing permission checker exception. How to avoid permission checker during mass upload.
User user = UserLocalServiceUtil.getUser(userid);
Contact cont = user.getContact();
long classPK = cont.getContactId();
String className = Contact.class.getName();
String phone = "4083069596";
try
{
String ext = "12121";
PhoneServiceUtil.addPhone(className, classPK,rs.getString(4), rs.getString(3), 11006, true);
}catch(Exception e)
{
e.printStackTrace();
}
exception:
com.liferay.portal.security.auth.PrincipalException: PermissionChecker not initialized
14:15:53,808 ERROR [STDERR] at com.liferay.portal.service.base.PrincipalBean.getPermissionChecker(PrincipalBean.java:81)
14:15:53,808 ERROR [STDERR] at com.liferay.portal.service.impl.PhoneServiceImpl.addPhone(PhoneServiceImpl.java:36)
14:15:53,808 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor478.invoke(Unknown Source)
14:15:53,808 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:15:53,808 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
14:15:53,808 ERROR [STDERR] at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:75)
14:15:53,808 ERROR [STDERR] at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
14:15:53,808 ERROR [STDERR] at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
14:15:53,808 ERROR [STDERR] at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
14:15:53,808 ERROR [STDERR] at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
14:15:53,808 ERROR [STDERR] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
14:15:53,808 ERROR [STDERR] at $Proxy229.addPhone(Unknown Source)
Mourad EF, geändert vor 12 Jahren.
RE: adding phone number and permission checker
New Member Beiträge: 21 Beitrittsdatum: 12.02.11 Neueste Beiträge
Hello,
did you find a solution to your problem ?
I'm having the same
Thanks
did you find a solution to your problem ?
I'm having the same
Thanks
Sandeep Nair, geändert vor 12 Jahren.
RE: adding phone number and permission checker
Liferay Legend Beiträge: 1744 Beitrittsdatum: 06.11.08 Neueste Beiträge
Hi,
Instead of PhoneServiceUtil, use PhoneLocalServiceUtil which bypasses the security check
Regards,
Sandeep
Instead of PhoneServiceUtil, use PhoneLocalServiceUtil which bypasses the security check
Regards,
Sandeep
Mourad EF, geändert vor 12 Jahren.
RE: adding phone number and permission checker
New Member Beiträge: 21 Beitrittsdatum: 12.02.11 Neueste Beiträge
thank you
i'm going to try this.
i'm going to try this.