@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode()); hashCode = prime * hashCode + ((getRoleName() == null) ? 0 : getRoleName().hashCode()); hashCode = prime * hashCode + ((getRoleId() == null) ? 0 : getRoleId().hashCode()); hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode()); hashCode = prime * hashCode + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode()); hashCode = prime * hashCode + ((getAssumeRolePolicyDocument() == null) ? 0 : getAssumeRolePolicyDocument().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getMaxSessionDuration() == null) ? 0 : getMaxSessionDuration().hashCode()); hashCode = prime * hashCode + ((getPermissionsBoundary() == null) ? 0 : getPermissionsBoundary().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); return hashCode; }
if (other.getRoleName() != null && other.getRoleName().equals(this.getRoleName()) == false) return false; if (other.getRoleId() == null ^ this.getRoleId() == null) return false; if (other.getRoleId() != null && other.getRoleId().equals(this.getRoleId()) == false) return false; if (other.getArn() == null ^ this.getArn() == null)
long companyId= _X_; //Perhaps CompanyThreadLocal.getCompanyId() if you don't have it anywhere else? Role role=RoleLocalServiceUtil.getRole(companyId, "Example Role"); Group group=GroupLocalServiceUtil.getGroup(companyId, "Example Community"); List<UserGroupRole> userGroupRoles = UserGroupRoleLocalServiceUtil. getUserGroupRolesByGroupAndRole(groupId, role.getRoleId()); for(UserGroupRole userGroupRole:userGroupRoles){ User oneUser=userGroupRole.getUser(); }
Role role = RoleLocalServiceUtil.getRole(companyId, RoleConstants.USER); List<ResourcePermission> roleResourcePermissions = ResourcePermissionLocalServiceUtil.getRoleResourcePermissions(role.getRoleId()); for(ResourcePermission permission : roleResourcePermissions ) ResourcePermissionLocalServiceUtil.reassignPermissions(permission.getResourcePermissionId(),role.getRoleId());
String[] usery = (String[])user.getExpandoBridge().getAttribute("Type"); Role role = RoleLocalServiceUtil.getRole(company.getCompanyId(), usery[0]); UserLocalServiceUtil.addRoleUser(role.getRoleId(), user.getUserId()); UserLocalServiceUtil.updateUser(user);
Role userRole = RoleLocalServiceUtil.getRole(companyId, "POWER USER"); ResourcePermissionServiceUtil.setIndividualResourcePermissions(themeDisplay.getScopeGroupId(), themeDisplay.getCompanyId(), Layout.class.getName(), "primKey", userRole.getRoleId(), new String[] { ActionKeys.VIEW });
List<Layout> tempPages = LayoutLocalServiceUtil.getLayouts( 0, LayoutLocalServiceUtil.getLayoutsCount() ); List<Role> allAvailRoles = RoleLocalServiceUtil.getRoles( 0, RoleLocalServiceUtil.getRolesCount() ); for ( Layout page : tempPages ) { List<Role> mappedRoles = new ArrayList<Role>(); for ( Role role : allAvailRoles ) { boolean hasRolePermission = PermissionLocalServiceUtil.hasRolePermission( role.getRoleId(), page.getCompanyId(), Layout.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf( page.getPrimaryKey() ), "VIEW" ); if ( hasRolePermission ) { mappedRoles.add( role ); } } pages.add( new LayoutRoleModel( page, mappedRoles ) ); }
for (UserGroup userGroup : userGroups) { String userGroupName = userGroup.getName(); // for locale specific title (optional, can be null) Map<Locale, String> titleMap = new HashMap<Locale, String>(); titleMap.put(Locale.ENGLISH, userGroupName); // for locale specific description (optional, can be null) Map<Locale, String> descriptionMap = new HashMap<Locale, String>(); titleMap.put(Locale.ENGLISH, "Role created for UserGroup - " + userGroupName); int type = RoleConstants.TYPE_REGULAR; // adding the role Role role = RoleLocalServiceUtil.addRole(userId, Role.class.getName(), 0, userGroupName, titleMap, descriptionMap, type, null, null); // assigning the UserGroup to the role GroupLocalServiceUtil.addRoleGroups(role.getRoleId(), new long[]{userGroup.getGroupId()}); // need to pass groupId and not userGroupId }
childJsonArray.put(roleObj.getRoleId()); childJsonArray.put(roleObj.getTitle(themeDisplay.getLocale())); objJsonArray.put(childJsonArray);
"role_name", role.getRoleName(), "grantees", crossAccountArns), role.getRoleId() );
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode()); hashCode = prime * hashCode + ((getRoleName() == null) ? 0 : getRoleName().hashCode()); hashCode = prime * hashCode + ((getRoleId() == null) ? 0 : getRoleId().hashCode()); hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode()); hashCode = prime * hashCode + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode()); hashCode = prime * hashCode + ((getAssumeRolePolicyDocument() == null) ? 0 : getAssumeRolePolicyDocument().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getMaxSessionDuration() == null) ? 0 : getMaxSessionDuration().hashCode()); hashCode = prime * hashCode + ((getPermissionsBoundary() == null) ? 0 : getPermissionsBoundary().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); return hashCode; }
if (other.getRoleName() != null && other.getRoleName().equals(this.getRoleName()) == false) return false; if (other.getRoleId() == null ^ this.getRoleId() == null) return false; if (other.getRoleId() != null && other.getRoleId().equals(this.getRoleId()) == false) return false; if (other.getArn() == null ^ this.getArn() == null)