/** * test if an attribute GrouperLoaderLdap is assigned to this group * @return true if an attribute GrouperLoaderLdap is assigned. * return false if not */ public boolean isHasAttrDefNameGrouperLoaderLdap() { boolean hasAttrLdap = false; //first, get the attribute def name AttributeDefName grouperLoaderLdapName = GrouperDAOFactory.getFactory().getAttributeDefName() .findByNameSecure(LoaderLdapUtils.grouperLoaderLdapName(), false); //check if the attribute def name is assigned to this group if (grouperLoaderLdapName != null) { hasAttrLdap = this.group.getAttributeDelegate().hasAttribute(grouperLoaderLdapName); } return hasAttrLdap; }
/** * assign an attribute value * @param group * @param attributeDefName * @param value */ private static void assignGroupLdapAttribute(Group group, AttributeDefName attributeDefName, String value) { AttributeDefName grouperLoaderAttributeDefName = AttributeDefNameFinder.findByName(LoaderLdapUtils.grouperLoaderLdapName(), false); AttributeAssign attributeAssign = group.getAttributeDelegate().retrieveAssignment(null, grouperLoaderAttributeDefName, false, false); if (attributeAssign == null) { if (StringUtils.isBlank(value)) { return; } throw new RuntimeException("Cant find ldap loader attribute assign (" + attributeDefName.getName() + ") on group (" + group.getName() + ")"); } if (StringUtils.isBlank(value)) { attributeAssign.getAttributeDelegate().removeAttribute(attributeDefName); } else { attributeAssign.getAttributeValueDelegate().assignValue(attributeDefName.getName(), value); } }
/** * @param group */ private void updateAttestationLastCertifiedDate(Group group) { if (!group.getAttributeDelegate().hasAttributeByName(GrouperAttestationJob.retrieveAttributeDefNameValueDef().getName())) { group.getAttributeDelegate().assignAttribute(GrouperAttestationJob.retrieveAttributeDefNameValueDef()); } AttributeAssign attributeAssign = group.getAttributeDelegate().retrieveAssignment(null, GrouperAttestationJob.retrieveAttributeDefNameValueDef(), false, false); String date = new SimpleDateFormat("yyyy/MM/dd").format(new Date()); attributeAssign.getAttributeValueDelegate().assignValue(GrouperAttestationJob.retrieveAttributeDefNameDateCertified().getName(), date); // add/update the directAssignment attribute String attestationDirectAssignment = attributeAssign.getAttributeValueDelegate().retrieveValueString(GrouperAttestationJob.retrieveAttributeDefNameDirectAssignment().getName()); if (attestationDirectAssignment == null) { attributeAssign.getAttributeValueDelegate().assignValue(GrouperAttestationJob.retrieveAttributeDefNameDirectAssignment().getName(), "false"); } //reset number of days GrouperAttestationJob.updateCalculatedDaysUntilRecertify(group, attributeAssign); }
/** * test if an attribute GrouperLoader SQL is assigned to this group * @return true if an attribute GrouperLoader SQL is assigned. * return false if not */ public boolean isHasAttrDefNameGrouperLoader() { boolean hasAttrLdap = false; //first, get the attribute def name AttributeDefName grouperLoader = GrouperDAOFactory.getFactory().getAttributeDefName() .findByNameSecure(GrouperConfig.retrieveConfig().propertyValueString("grouper.rootStemForBuiltinObjects", "etc") + ":legacy:attribute:legacyGroupType_grouperLoader", false); //check if the attribute def name is assigned to this group if (grouperLoader != null) { hasAttrLdap = this.group.getAttributeDelegate().hasAttribute(grouperLoader); } return hasAttrLdap; }
/** * get the ldap attribute assign for this group * @return attribute assign */ private AttributeAssign getLdapAttributeAssign() { if (this.attributeAssign == null) { Group jobGroup = GrouperRequestContainer.retrieveFromRequestOrCreate().getGroupContainer().getGuiGroup().getGroup(); AttributeDefName attributeDefName = AttributeDefNameFinder.findByName(LoaderLdapUtils.grouperLoaderLdapName(), false); this.attributeAssign = jobGroup.getAttributeDelegate().retrieveAssignment(AttributeDef.ACTION_DEFAULT, attributeDefName, false, true); } return this.attributeAssign; }
@Override public Boolean callback(GrouperSession grouperSession) throws GrouperSessionException { String date = new SimpleDateFormat("yyyy/MM/dd").format(new Date()); AttributeDefName attributeDefName = GrouperAttestationJob.retrieveAttributeDefNameValueDef(); // go through all the child groups and certify if they have attestation attributes for (Group group: childGroups) { AttributeAssign attributeAssign = group.getAttributeDelegate().retrieveAssignment(null, attributeDefName, false, false); if (attributeAssign != null) { if (onlyIfNeverCertified && attributeAssign.getAttributeValueDelegate().retrieveValueString(GrouperAttestationJob.retrieveAttributeDefNameDateCertified().getName()) == null) { attributeAssign.getAttributeValueDelegate().assignValue(GrouperAttestationJob.retrieveAttributeDefNameDateCertified().getName(), date); } else if (!onlyIfNeverCertified) { attributeAssign.getAttributeValueDelegate().assignValue(GrouperAttestationJob.retrieveAttributeDefNameDateCertified().getName(), date); } } } return null; } });
if (GrouperUtil.length(group.getAttributeDelegate().retrieveAssignments(attributeDefName)) > 0) { guiResponseJs.addAction(GuiScreenAction.newValidationMessage(GuiMessageType.error, "#attributeDefComboErrorId", AttributeAssignGroupDelegate attributeDelegate = group.getAttributeDelegate();
Set<AttributeAssign> attributeAssigns = group.getAttributeDelegate().getAttributeAssigns();
@Override public Object callback(GrouperSession theGrouperSession) throws GrouperSessionException { AttributeAssign attributeAssign = GROUP.getAttributeDelegate().retrieveAssignment(null, GrouperAttestationJob.retrieveAttributeDefNameValueDef(), false, false); if (attributeAssign == null) { guiResponseJs.addAction(GuiScreenAction.newMessage(GuiMessageType.error, TextContainer.retrieveFromRequest().getText().get("noDirectAttestationAttributeOnGroupError"))); return null; } updateAttestationLastCertifiedDate(GROUP); AuditEntry auditEntry = new AuditEntry(AuditTypeBuiltin.GROUP_ATTESTATION_UPDATE_LAST_CERTIFIED_DATE, "groupId", GROUP.getId(), "groupName", GROUP.getName()); auditEntry.setDescription("Update last certified date attribute of group: " + GROUP.getName()); attestationSaveAudit(auditEntry); setupAttestation(GROUP); if (drawAttestationScreen) { guiResponseJs.addAction(GuiScreenAction.newInnerHtmlFromJsp("#groupAttestation", "/WEB-INF/grouperUi2/group/groupAttestationView.jsp")); } guiResponseJs.addAction(GuiScreenAction.newMessage(GuiMessageType.success, TextContainer.retrieveFromRequest().getText().get("attestationLastCertifiedUpdateSuccess"))); return null; } });
if (group.getAttributeDelegate().hasAttribute(grouperLoader)) { foundLoaderType = true; GrouperLoaderType.validateAndScheduleSqlLoad(group, null, false); AttributeAssign assign = group.getAttributeDelegate().retrieveAssignment("assign", grouperLoaderLdapName, true, false); if (assign != null) { foundLoaderType = true;
AttributeAssign groupAttributeAssign = group.getAttributeDelegate().retrieveAssignment(null, loaderMetadataAttributeDefName, false, false);
boolean updateLastCertifiedDate) { AttributeAssign attributeAssign = group.getAttributeDelegate().retrieveAssignment(null, GrouperAttestationJob.retrieveAttributeDefNameValueDef(), false, false);
DEBUG_MAP.put("assignAttribute", true); group.getAttributeDelegate().assignAttribute(GrouperAttestationJob.retrieveAttributeDefNameValueDef()); // we are adding attribute here auditEntry = new AuditEntry(AuditTypeBuiltin.GROUP_ATTESTATION_ADD, "groupId", group.getId(), "groupName", group.getName()); auditEntry.setDescription("Add group attestation: "+group.getName());
@Override public Boolean callback(GrouperSession grouperSession) throws GrouperSessionException { AttributeAssign attributeAssign = GROUP.getAttributeDelegate().retrieveAssignment(null, GrouperAttestationJob.retrieveAttributeDefNameValueDef(), false, false); if (attributeAssign == null) { guiResponseJs.addAction(GuiScreenAction.newMessage(GuiMessageType.error, TextContainer.retrieveFromRequest().getText().get("noDirectAttestationAttributeOnGroupError"))); return true; } attributeAssign.getAttributeValueDelegate().assignValue(GrouperAttestationJob.retrieveAttributeDefNameDateCertified().getName(), null); GrouperAttestationJob.updateCalculatedDaysUntilRecertify(GROUP, attributeAssign); AuditEntry auditEntry = new AuditEntry(AuditTypeBuiltin.GROUP_ATTESTATION_CLEAR_LAST_CERTIFIED_DATE, "groupId", GROUP.getId(), "groupName", GROUP.getName()); auditEntry.setDescription("Clear last certified date attribute of group: " + GROUP.getName()); attestationSaveAudit(auditEntry); setupAttestation(GROUP); guiResponseJs.addAction(GuiScreenAction.newInnerHtmlFromJsp("#groupAttestation", "/WEB-INF/grouperUi2/group/groupAttestationView.jsp")); guiResponseJs.addAction(GuiScreenAction.newMessage(GuiMessageType.success, TextContainer.retrieveFromRequest().getText().get("groupAttestationSuccessClearedAttestationDate"))); return false; } });
group.getAttributeDelegate().removeAttribute(grouperLoaderLdapName); group.getAttributeDelegate().removeAttribute(grouperLoader); .findByNameSecure(LoaderLdapUtils.grouperLoaderLdapName(), false); if (grouperLoaderLdapName != null) { group.getAttributeDelegate().removeAttribute(grouperLoaderLdapName); group.getAttributeDelegate().removeAttribute(grouperLoader); throw new RuntimeException("Cannot find attribute in registry: " + nameOfLoaderAttributeDefName); AttributeAssign attributeAssign = group.getAttributeDelegate().retrieveAssignment(null, grouperLoaderAttributeDefName, false, false); if (attributeAssign == null) { attributeAssign = group.getAttributeDelegate().assignAttribute(grouperLoaderAttributeDefName).getAttributeAssign(); AttributeAssign attributeAssign = group.getAttributeDelegate().retrieveAssignment(null, grouperLoaderAttributeDefName, false, false); if (attributeAssign == null) { attributeAssign = group.getAttributeDelegate().assignAttribute(grouperLoaderAttributeDefName).getAttributeAssign();
group.getAttributeDelegate().retrieveAssignment(null, GrouperAttestationJob.retrieveAttributeDefNameValueDef(), false, false);