Search in sources :

Example 1 with GluuBoolean

use of org.gluu.persist.model.base.GluuBoolean in project oxTrust by GluuFederation.

the class PassportUmaProtectionService method isPassportEnabled.

private boolean isPassportEnabled() {
    GluuAppliance appliance = applianceService.getAppliance();
    GluuBoolean passportEnbaled = appliance.getPassportEnabled();
    return GluuBoolean.ENABLED.equals(passportEnbaled) || GluuBoolean.TRUE.equals(passportEnbaled);
}
Also used : GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) GluuBoolean(org.gluu.persist.model.base.GluuBoolean)

Example 2 with GluuBoolean

use of org.gluu.persist.model.base.GluuBoolean in project oxTrust by GluuFederation.

the class ScimUmaProtectionService method isScimEnabled.

private boolean isScimEnabled() {
    GluuAppliance appliance = applianceService.getAppliance();
    GluuBoolean scimEnabled = appliance.getScimEnabled();
    return GluuBoolean.ENABLED.equals(scimEnabled) || GluuBoolean.TRUE.equals(scimEnabled);
}
Also used : GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) GluuBoolean(org.gluu.persist.model.base.GluuBoolean)

Example 3 with GluuBoolean

use of org.gluu.persist.model.base.GluuBoolean in project oxTrust by GluuFederation.

the class UpdateGroupAction method updatePersons.

private void updatePersons(List<DisplayNameEntry> oldMembers, List<DisplayNameEntry> newMembers) throws Exception {
    log.debug("Old members: {}", oldMembers);
    log.debug("New members: {}", newMembers);
    String groupDn = this.group.getDn();
    GluuOrganization organization = organizationService.getOrganization();
    String[] organizationGroups = { organization.getManagerGroup() };
    // Convert members to array of DNs
    String[] oldMemberDns = convertToDNsArray(oldMembers);
    String[] newMemberDns = convertToDNsArray(newMembers);
    Arrays.sort(oldMemberDns);
    Arrays.sort(newMemberDns);
    boolean[] retainOldMembers = new boolean[oldMemberDns.length];
    Arrays.fill(retainOldMembers, false);
    List<String> addedMembers = new ArrayList<String>();
    List<String> removedMembers = new ArrayList<String>();
    List<String> existingMembers = new ArrayList<String>();
    // Add new values
    for (String value : newMemberDns) {
        int idx = Arrays.binarySearch(oldMemberDns, value);
        if (idx >= 0) {
            // Old members array contains member. Retain member
            retainOldMembers[idx] = true;
        } else {
            // This is new member
            addedMembers.add(value);
        }
    }
    // Remove members which we don't have in new members
    for (int i = 0; i < oldMemberDns.length; i++) {
        if (retainOldMembers[i]) {
            existingMembers.add(oldMemberDns[i]);
        } else {
            removedMembers.add(oldMemberDns[i]);
        }
    }
    for (String dn : addedMembers) {
        GluuCustomPerson person = personService.getPersonByDn(dn);
        log.debug("Adding group {} to person {} memberOf", groupDn, person.getDisplayName());
        if (appConfiguration.isUpdateApplianceStatus()) {
            GluuBoolean slaManager = isSLAManager(organizationGroups, person);
            person.setSLAManager(slaManager);
        }
        List<String> personMemberOf = new ArrayList<String>(person.getMemberOf());
        personMemberOf.add(groupDn);
        person.setMemberOf(personMemberOf);
        personService.updatePerson(person);
    }
    for (String dn : removedMembers) {
        GluuCustomPerson person = personService.getPersonByDn(dn);
        log.debug("Removing group {} from person {} memberOf", groupDn, person.getDisplayName());
        if (appConfiguration.isUpdateApplianceStatus()) {
            GluuBoolean slaManager = isSLAManager(organizationGroups, person);
            person.setSLAManager(slaManager);
        }
        List<String> personMemberOf = new ArrayList<String>(person.getMemberOf());
        personMemberOf.remove(groupDn);
        person.setMemberOf(personMemberOf);
        personService.updatePerson(person);
    }
    if (appConfiguration.isUpdateApplianceStatus()) {
        // Update existing members if needed
        for (String dn : existingMembers) {
            GluuCustomPerson person = personService.getPersonByDn(dn);
            log.debug("Updating group {} to person {} memberOf", groupDn, person.getDisplayName());
            GluuBoolean slaManager = isSLAManager(organizationGroups, person);
            if (slaManager.equals(person.getSLAManager())) {
                continue;
            }
            person.setSLAManager(slaManager);
            personService.updatePerson(person);
        }
    }
}
Also used : GluuCustomPerson(org.gluu.oxtrust.model.GluuCustomPerson) ArrayList(java.util.ArrayList) GluuOrganization(org.gluu.oxtrust.model.GluuOrganization) GluuBoolean(org.gluu.persist.model.base.GluuBoolean)

Aggregations

GluuBoolean (org.gluu.persist.model.base.GluuBoolean)3 GluuAppliance (org.gluu.oxtrust.model.GluuAppliance)2 ArrayList (java.util.ArrayList)1 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)1 GluuOrganization (org.gluu.oxtrust.model.GluuOrganization)1