use of org.gluu.oxtrust.model.RegistrationConfiguration in project oxTrust by GluuFederation.
the class RegisterPersonAction method initAttributes.
private void initAttributes() {
List<GluuAttribute> allPersonAttributes = attributeService.getAllActivePersonAttributes(GluuUserRole.ADMIN);
List<String> allAttributOrigins = attributeService.getAllAttributeOrigins(allPersonAttributes);
GluuOrganization organization = organizationService.getOrganization();
List<GluuCustomAttribute> customAttributes = this.person.getCustomAttributes();
boolean isNewPerson = (customAttributes == null) || customAttributes.isEmpty();
if (isNewPerson) {
customAttributes = new ArrayList<GluuCustomAttribute>();
this.person.setCustomAttributes(customAttributes);
}
String[] personOCs = appConfiguration.getPersonObjectClassTypes();
String[] personOCDisplayNames = appConfiguration.getPersonObjectClassDisplayNames();
customAttributeAction.initCustomAttributes(allPersonAttributes, customAttributes, allAttributOrigins, personOCs, personOCDisplayNames);
List<GluuCustomAttribute> mandatoryAttributes = new ArrayList<GluuCustomAttribute>();
RegistrationConfiguration config = organization.getOxRegistrationConfiguration();
boolean registrationCustomized = config != null;
boolean registrationAttributesCustomized = registrationCustomized && config.getAdditionalAttributes() != null && !config.getAdditionalAttributes().isEmpty();
if (registrationAttributesCustomized) {
for (String attributeInum : config.getAdditionalAttributes()) {
GluuAttribute attribute = attributeService.getAttributeByInum(attributeInum);
GluuCustomAttribute customAttribute = new GluuCustomAttribute(attribute.getName(), "", false, false);
mandatoryAttributes.add(customAttribute);
}
}
for (GluuCustomAttribute attribute : personService.getMandatoryAtributes()) {
if (!mandatoryAttributes.contains(attribute)) {
mandatoryAttributes.add(attribute);
}
}
mandatoryAttributes.addAll(personService.getMandatoryAtributes());
if (isNewPerson) {
customAttributeAction.addCustomAttributes(mandatoryAttributes);
}
hiddenAttributes = new ArrayList<String>();
hiddenAttributes.add("inum");
hiddenAttributes.add("iname");
hiddenAttributes.add("userPassword");
hiddenAttributes.add("gluuStatus");
hiddenAttributes.add("oxExternalUid");
hiddenAttributes.add("oxLastLogonTime");
}
use of org.gluu.oxtrust.model.RegistrationConfiguration in project oxTrust by GluuFederation.
the class RegistrationManagementAction method save.
public String save() {
GluuOrganization org = organizationService.getOrganization();
RegistrationConfiguration config = org.getOxRegistrationConfiguration();
if (config == null) {
config = new RegistrationConfiguration();
}
config.setRegistrationInterceptorsConfigured(configureInterceptors);
if (configureInterceptors) {
config.setRegistrationInterceptorScripts(registrationInterceptors);
} else {
config.setRegistrationInterceptorScripts(null);
}
config.setCaptchaDisabled(captchaDisabled);
List<String> attributeList = new ArrayList<String>();
if (configureRegistrationForm) {
for (GluuAttribute attribute : selectedAttributes) {
attributeList.add(attribute.getInum());
}
}
config.setAdditionalAttributes(attributeList);
org.setOxRegistrationConfiguration(config);
organizationService.updateOrganization(org);
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.gluu.oxtrust.model.RegistrationConfiguration in project oxTrust by GluuFederation.
the class RegisterPersonAction method initRecaptcha.
private void initRecaptcha() {
GluuOrganization organization = organizationService.getOrganization();
RegistrationConfiguration config = organization.getOxRegistrationConfiguration();
boolean registrationCustomized = config != null;
this.captchaDisabled = !recaptchaService.isEnabled();
if (!this.captchaDisabled) {
this.captchaDisabled = registrationCustomized && config.isCaptchaDisabled();
}
}
use of org.gluu.oxtrust.model.RegistrationConfiguration in project oxTrust by GluuFederation.
the class RegistrationInterceptionService method runPostRegistrationScripts.
public boolean runPostRegistrationScripts(GluuCustomPerson person, Map<String, String[]> requestParameters) {
GluuOrganization org = organizationService.getOrganization();
RegistrationConfiguration config = org.getOxRegistrationConfiguration();
if (config != null && config.isRegistrationInterceptorsConfigured()) {
List<RegistrationInterceptorScript> scripts = config.getRegistrationInterceptorScripts();
List<RegistrationInterceptorScript> sortedEnabledPostRegistrationScripts = sort(getActive(getPostRegistrationScripts(scripts)));
if (sortedEnabledPostRegistrationScripts != null) {
boolean result = true;
for (RegistrationInterceptorScript script : sortedEnabledPostRegistrationScripts) {
RegistrationScript registrationScript = createRegistrationScriptFromStringWithPythonException(script);
result &= registrationScript.execute(script.getCustomAttributes(), person, requestParameters);
}
return result;
} else {
return true;
}
} else {
return true;
}
}
use of org.gluu.oxtrust.model.RegistrationConfiguration in project oxTrust by GluuFederation.
the class RegistrationInterceptionService method runPreRegistrationScripts.
public boolean runPreRegistrationScripts(GluuCustomPerson person, Map<String, String[]> requestParameters) {
GluuOrganization org = organizationService.getOrganization();
RegistrationConfiguration config = org.getOxRegistrationConfiguration();
if (config != null && config.isRegistrationInterceptorsConfigured()) {
List<RegistrationInterceptorScript> scripts = config.getRegistrationInterceptorScripts();
List<RegistrationInterceptorScript> sortedEnabledPreRegistrationScripts = sort(getActive(getPreRegistrationScripts(scripts)));
if (sortedEnabledPreRegistrationScripts != null) {
boolean result = true;
for (RegistrationInterceptorScript script : sortedEnabledPreRegistrationScripts) {
RegistrationScript registrationScript = createRegistrationScriptFromStringWithPythonException(script);
result &= registrationScript.execute(script.getCustomAttributes(), person, requestParameters);
}
return result;
} else {
return true;
}
} else {
return true;
}
}
Aggregations