掲示板

createUserGroup from API leads to Control Panel breakdown

11年前 に the denu によって更新されました。

createUserGroup from API leads to Control Panel breakdown

New Member 投稿: 20 参加年月日: 12/07/05 最新の投稿
Hello,

I've managed to break down Control Panel which is disability to edit specific user or remove user group completely.

You just need to create User Group via Liferay API:
                UserGroup uGroup = UserGroupLocalServiceUtil.createUserGroup( CounterLocalServiceUtil.increment() );
                uGroup.setName( userGroupName );
                uGroup.setCompanyId( user.getCompanyId() );
                UserGroupLocalServiceUtil.updateUserGroup( uGroup );



Then just add user to this group via Control Panel and.... voila:

ERROR [GroupImpl:251] com.liferay.portal.NoSuchGroupException: No Group exists with the key {companyId=10154, classNameId=10006, classPK=10155}
com.liferay.portal.NoSuchGroupException: No Group exists with the key {companyId=10154, classNameId=10006, classPK=10155}
	at com.liferay.portal.service.persistence.GroupPersistenceImpl.findByC_C_C(GroupPersistenceImpl.java:2076)
	at com.liferay.portal.service.impl.LayoutLocalServiceImpl.getLayoutsCount(LayoutLocalServiceImpl.java:1171)
	at sun.reflect.GeneratedMethodAccessor221.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:112)
	at com.liferay.portal.service.impl.LayoutLocalServiceVirtualLayoutsAdvice.invoke(LayoutLocalServiceVirtualLayoutsAdvice.java:166)
	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:108)



I think that issue here is that no ordinary Group is created in parallel to UserGroup. which is needed I think, because when you create User Group by Control Panel, its created in database in completely different manner than by API.

Or maybe i'm wrong with something?

BR
denu