1
14
15 package com.liferay.portal.verify;
16
17 import com.liferay.portal.NoSuchRoleException;
18 import com.liferay.portal.model.Role;
19 import com.liferay.portal.model.RoleConstants;
20 import com.liferay.portal.service.RoleLocalServiceUtil;
21 import com.liferay.portal.util.PortalInstances;
22
23
28 public class VerifyRole extends VerifyProcess {
29
30 protected void doVerify() throws Exception {
31 long[] companyIds = PortalInstances.getCompanyIdsBySQL();
32
33 for (long companyId : companyIds) {
34 try {
35 Role communityMemberRole = RoleLocalServiceUtil.getRole(
36 companyId, RoleConstants.COMMUNITY_MEMBER);
37
38 deleteImplicitAssociations(communityMemberRole);
39 }
40 catch (NoSuchRoleException nsre) {
41 }
42
43 try {
44 Role organizationMemberRole = RoleLocalServiceUtil.getRole(
45 companyId, RoleConstants.ORGANIZATION_MEMBER);
46
47 deleteImplicitAssociations(organizationMemberRole);
48 }
49 catch (NoSuchRoleException nsre) {
50 }
51 }
52 }
53
54 protected void deleteImplicitAssociations(Role role) throws Exception {
55 runSQL(
56 "delete from UserGroupGroupRole where roleId = " +
57 role.getRoleId());
58 runSQL(
59 "delete from UserGroupRole where roleId = " + role.getRoleId());
60 }
61
62 }