protected boolean validAssignGroup(IdentityManagementGroupDocument document) { boolean rulePassed = true; Map<String, String> additionalPermissionDetails = new HashMap<String, String>(); additionalPermissionDetails.put( KimConstants.AttributeConstants.NAMESPACE_CODE, document.getGroupNamespace()); additionalPermissionDetails.put( KimConstants.AttributeConstants.GROUP_NAME, document.getGroupName()); if (document.getMembers() != null && document.getMembers().size() > 0) { if (!getDocumentDictionaryService() .getDocumentAuthorizer(document) .isAuthorizedByTemplate( document, KimConstants.NAMESPACE_CODE, KimConstants.PermissionTemplateNames.POPULATE_GROUP, GlobalVariables.getUserSession().getPrincipalId(), additionalPermissionDetails, null)) { GlobalVariables.getMessageMap() .putError( "document.groupName", RiceKeyConstants.ERROR_ASSIGN_GROUP, new String[] {document.getGroupNamespace(), document.getGroupName()}); rulePassed = false; } } return rulePassed; }
protected boolean validDuplicateGroupName(IdentityManagementGroupDocument groupDoc) { Group group = null; if (null != groupDoc.getGroupNamespace() && null != groupDoc.getGroupName()) { group = KimApiServiceLocator.getGroupService() .getGroupByNamespaceCodeAndName( groupDoc.getGroupNamespace(), groupDoc.getGroupName()); } boolean rulePassed = true; if (group != null) { if (group.getId().equals(groupDoc.getGroupId())) { rulePassed = true; } else { GlobalVariables.getMessageMap() .putError( "document.groupName", RiceKeyConstants.ERROR_DUPLICATE_ENTRY, new String[] {"Group Name"}); rulePassed = false; } } return rulePassed; }