Forums de discussion

Rights Management during manual Import

Nicolas Muller, modifié il y a 13 années.

Rights Management during manual Import

Junior Member Publications: 57 Date d'inscription: 22/02/07 Publications récentes
Hello,

I am writing a process to import Organization and Users into Liferay database from another database (mix between a ldap and a relation database).

Therefore at the end of the process, I must add ROLE to Organization. My action follows it from LDAP so I must create a PermissionChecker because nobody is connected.

My code is wrong elsewhere because I don't have any INSERT or UPDATE...


Organization organisation = OrganizationLocalServiceUtil.getOrganization(p_companyId, name);
Role role = RoleLocalServiceUtil.getRole(p_companyId, name.toUpperCase());
long[] groupId = new long[] { organisation.getOrganizationId() };

User user = UserLocalServiceUtil.getUserById(defaultUserId);
PermissionChecker _permissionChecker = PermissionCheckerFactoryUtil.create(user, true);
PermissionThreadLocal.setPermissionChecker(_permissionChecker);

GroupServiceUtil.addRoleGroups(role.getRoleId(), groupId);


Thank you very much.

Best regards,