Search in sources :

Example 21 with GluuOrganization

use of org.gluu.oxtrust.model.GluuOrganization in project oxTrust by GluuFederation.

the class FaviconImageServlet method doGet.

@Override
protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("image/x-icon");
    response.setDateHeader("Expires", new Date().getTime() + 1000L * 1800);
    GluuOrganization organization = organizationService.getOrganization();
    boolean hasSucceed = readCustomFavicon(response, organization);
    if (!hasSucceed) {
        readDefaultFavicon(response);
    }
}
Also used : GluuOrganization(org.gluu.oxtrust.model.GluuOrganization) Date(java.util.Date)

Example 22 with GluuOrganization

use of org.gluu.oxtrust.model.GluuOrganization in project oxTrust by GluuFederation.

the class IdpFaviconServlet method doGet.

@Override
protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("image/x-icon");
    response.setDateHeader("Expires", new Date().getTime() + 1000L * 1800);
    GluuOrganization organization = organizationService.getOrganization();
    boolean hasSucceed = readCustomFavicon(response, organization);
    if (!hasSucceed) {
        readDefaultFavicon(response);
    }
}
Also used : GluuOrganization(org.gluu.oxtrust.model.GluuOrganization) Date(java.util.Date)

Example 23 with GluuOrganization

use of org.gluu.oxtrust.model.GluuOrganization in project oxTrust by GluuFederation.

the class OxAuthLogoServlet method doGet.

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) {
    response.setContentType("image/jpg");
    response.setDateHeader("Expires", new Date().getTime() + 1000L * 1800);
    String scale = request.getParameter("scale");
    GluuOrganization organization = organizationService.getOrganization();
    boolean hasSucceed = readCustomLogo(response, organization);
    if (!hasSucceed) {
        readDefaultLogo(response, scale);
    }
}
Also used : GluuOrganization(org.gluu.oxtrust.model.GluuOrganization) Date(java.util.Date)

Example 24 with GluuOrganization

use of org.gluu.oxtrust.model.GluuOrganization 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.isUpdateStatus()) {
            Boolean 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.isUpdateStatus()) {
            Boolean 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.isUpdateStatus()) {
        // Update existing members if needed
        for (String dn : existingMembers) {
            GluuCustomPerson person = personService.getPersonByDn(dn);
            log.debug("Updating group {} to person {} memberOf", groupDn, person.getDisplayName());
            Boolean 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)

Example 25 with GluuOrganization

use of org.gluu.oxtrust.model.GluuOrganization in project oxTrust by GluuFederation.

the class RegistrationManagementAction method init.

public String init() {
    customScriptTypes = new ArrayList<String>();
    customScriptTypes.add(OxTrustConstants.INIT_REGISTRATION_SCRIPT);
    customScriptTypes.add(OxTrustConstants.PRE_REGISTRATION_SCRIPT);
    customScriptTypes.add(OxTrustConstants.POST_REGISTRATION_SCRIPT);
    this.oxTrustappConfiguration = jsonConfigurationService.getOxTrustappConfiguration();
    GluuOrganization org = organizationService.getOrganization();
    RegistrationConfiguration config = org.getOxRegistrationConfiguration();
    if (config != null) {
        captchaDisabled = config.isCaptchaDisabled();
        List<String> attributeList = config.getAdditionalAttributes();
        if (attributeList != null && !attributeList.isEmpty()) {
            configureRegistrationForm = true;
            for (String attributeInum : attributeList) {
                GluuAttribute attribute = attributeService.getAttributeByInum(attributeInum);
                selectedAttributes.add(attribute);
                attributes.add(attribute);
            }
        }
    }
    search();
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : RegistrationConfiguration(org.gluu.oxtrust.model.RegistrationConfiguration) GluuOrganization(org.gluu.oxtrust.model.GluuOrganization) GluuAttribute(org.gluu.model.GluuAttribute)

Aggregations

GluuOrganization (org.gluu.oxtrust.model.GluuOrganization)25 RegistrationConfiguration (org.gluu.oxtrust.model.RegistrationConfiguration)7 Date (java.util.Date)6 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 GluuAttribute (org.gluu.model.GluuAttribute)3 RegistrationInterceptorScript (org.gluu.oxtrust.model.RegistrationInterceptorScript)3 RegistrationScript (org.gluu.oxtrust.service.python.interfaces.RegistrationScript)3 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)2 ParseException (java.text.ParseException)1 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1 UserRole (org.gluu.model.user.UserRole)1 DuplicateEmailException (org.gluu.oxtrust.exception.DuplicateEmailException)1 GluuConfiguration (org.gluu.oxtrust.model.GluuConfiguration)1 GluuCustomAttribute (org.gluu.oxtrust.model.GluuCustomAttribute)1 PasswordResetRequest (org.gluu.oxtrust.model.PasswordResetRequest)1