Foros de discusión

PrincipalException lors d'un expandoBridge.setAttribute()

Jean-Phi Noel, modificado hace 13 años.

PrincipalException lors d'un expandoBridge.setAttribute()

New Member Mensajes: 2 Fecha de incorporación: 3/03/11 Mensajes recientes
Bonjour,

J'essaie désespérément d'utiliser les customs attributes afin
de lier une liste de valeurs (String[]) à un utilisateur liferay.

Malheureusement, lorsque j'invoque le setAttribute() une PrincipalException
est levée lors du ExpandoColumnPermission.check()

J'ai adapté la méthode setPermission() de la page suivante :
http://www.liferay.com/community/wiki/-/wiki/Main/Adding+an+custom+attribute+to+a+Community

et les permissions VIEW et UPDATE on été ajoutées sur les colonnes de la table expando en question (DEFAULT).

Mais la PrincipalException saute toujours. emoticon

Est-ce que qqun aurait une idée ou un début de piste vers laquelle chercher ?

Voici un bout de la stackTrace :

10:35:10,075 ERROR [ExpandoBridgeImpl:280] com.liferay.portal.security.auth.PrincipalException
com.liferay.portal.security.auth.PrincipalException
	at com.liferay.portlet.expando.service.permission.ExpandoColumnPermission.check(ExpandoColumnPermission.java:67)
	at com.liferay.portlet.expando.service.impl.ExpandoValueServiceImpl.addValue(ExpandoValueServiceImpl.java:50)
	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:585)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:77)
	at com.liferay.portal.spring.aop.ServiceHookAdvice.invoke(ServiceHookAdvice.java:90)
	at sun.reflect.GeneratedMethodAccessor71.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:64)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at $Proxy120.addValue(Unknown Source)
	at com.liferay.portlet.expando.service.ExpandoValueServiceUtil.addValue(ExpandoValueServiceUtil.java:52)
	at com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl.setAttribute(ExpandoBridgeImpl.java:275)
	at monPackage.bean.UserBean.saveIds(UserBean.java:154)
Jean-Phi Noel, modificado hace 13 años.

RE: PrincipalException lors d'un expandoBridge.setAttribute() (Respuesta)

New Member Mensajes: 2 Fecha de incorporación: 3/03/11 Mensajes recientes
Afin de pouvoir avancer dans mon projet,
j'ai suivi la même solution que celle expliquée sur la page suivante :

http://www.liferay.com/community/forums/-/message_boards/message/4057220

-> court-circuiter le check des permissions en utilisant la ExpandoValueLocalServiceUtil.

ExpandoValueLocalServiceUtil.addValue(
	User.class.getName(),
	ExpandoTableConstants.DEFAULT_TABLE_NAME,
	IDS_ATTRIBUTE_NAME, /* contante */
	connectedUser.getUserId(), /* avec connectedUser instance de User*/
	ids.toArray(new String[ergIds.size()]); /* avec ids une ArrayList */