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);
}
}
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);
}
}
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);
}
}
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);
}
}
}
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;
}
Aggregations