Search in sources :

Example 46 with GluuAttribute

use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.

the class WhitePagesAction method getReleasedAttributes.

public List<GluuCustomAttribute> getReleasedAttributes(GluuCustomPerson person) {
    if (person == null) {
        return Arrays.asList(new GluuCustomAttribute[0]);
    }
    List<GluuCustomAttribute> releasedAttributes = new ArrayList<GluuCustomAttribute>();
    for (GluuCustomAttribute attribute : person.getCustomAttributes()) {
        List<GluuAttribute> attributes = attributeService.getAllPersonAttributes(GluuUserRole.USER);
        GluuAttribute metadata = attributeService.getAttributeByName(attribute.getName(), attributes);
        if (metadata != null && metadata.isWhitePagesCanView() && !tableAttributes.contains(attribute.getName())) {
            attribute.setMetadata(metadata);
            releasedAttributes.add(attribute);
        }
    }
    return releasedAttributes;
}
Also used : GluuCustomAttribute(org.gluu.oxtrust.model.GluuCustomAttribute) ArrayList(java.util.ArrayList) GluuAttribute(org.xdi.model.GluuAttribute)

Example 47 with GluuAttribute

use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.

the class UpdateTrustRelationshipAction method initFederatedSites.

private void initFederatedSites(GluuSAMLTrustRelationship trustRelationship) {
    List<GluuAttribute> attributes = getAllAttributes();
    this.federatedSites = new ArrayList<GluuSAMLTrustRelationship>();
    for (GluuSAMLTrustRelationship deconstructedTrustRelationship : trustService.getDeconstructedTrustRelationships(trustRelationship)) {
        initTrustRelationship(deconstructedTrustRelationship, attributes);
        this.federatedSites.add(deconstructedTrustRelationship);
    }
}
Also used : GluuSAMLTrustRelationship(org.gluu.oxtrust.model.GluuSAMLTrustRelationship) GluuAttribute(org.xdi.model.GluuAttribute)

Example 48 with GluuAttribute

use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.

the class WhitePagesAction method getPhotoThumbData.

public byte[] getPhotoThumbData(GluuCustomPerson person) {
    List<GluuAttribute> attributes = attributeService.getAllPersonAttributes(GluuUserRole.USER);
    GluuAttribute photoAttribute = attributeService.getAttributeByName(PHOTO_NAME, attributes);
    GluuCustomAttribute customAttribute = new GluuCustomAttribute(PHOTO_NAME, person.getAttribute(PHOTO_NAME));
    customAttribute.setMetadata(photoAttribute);
    GluuImage image = imageService.getImage(customAttribute);
    if (image == null || (person.getGluuOptOuts() != null && person.getGluuOptOuts().contains(PHOTO_NAME))) {
        return imageService.getBlankPhotoData();
    }
    return imageService.getThumImageData(image);
}
Also used : GluuCustomAttribute(org.gluu.oxtrust.model.GluuCustomAttribute) GluuImage(org.xdi.model.GluuImage) GluuAttribute(org.xdi.model.GluuAttribute)

Example 49 with GluuAttribute

use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.

the class ImportPersonConfiguration method createAttributeFromConfig.

private GluuAttribute createAttributeFromConfig(ImportPerson importPerson) {
    String attributeName = importPerson.getLdapName();
    String displayName = importPerson.getDisplayName();
    String dataType = importPerson.getDataType();
    boolean required = importPerson.getRequired();
    if (StringHelper.isNotEmpty(attributeName) && StringHelper.isNotEmpty(displayName) && StringHelper.isNotEmpty(dataType)) {
        GluuAttributeDataType attributeDataType = GluuAttributeDataType.getByValue(dataType);
        if (attributeDataType != null) {
            GluuAttribute attr = new GluuAttribute();
            attr.setName(attributeName);
            attr.setDisplayName(displayName);
            attr.setDataType(attributeDataType);
            attr.setRequred(required);
            return attr;
        }
    }
    return null;
}
Also used : GluuAttributeDataType(org.xdi.model.GluuAttributeDataType) GluuAttribute(org.xdi.model.GluuAttribute)

Example 50 with GluuAttribute

use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.

the class ImportPersonConfiguration method createAttributeFromConfig.

private GluuAttribute createAttributeFromConfig(String prefix) {
    String attributeName = importConfiguration.getString(prefix + ATTRIBUTE_LDAP_NAME_SUFFIX, null);
    String displayName = importConfiguration.getString(prefix + ATTRIBUTE_DISPLAY_NAME_SUFFIX, null);
    String dataType = importConfiguration.getString(prefix + ATTRIBUTE_DATA_TYPE_SUFFIX, null);
    boolean required = importConfiguration.getBoolean(prefix + ATTRIBUTE_DATA_REQUIRED_SUFFIX, false);
    if (StringHelper.isNotEmpty(attributeName) && StringHelper.isNotEmpty(displayName) && StringHelper.isNotEmpty(dataType)) {
        GluuAttributeDataType attributeDataType = GluuAttributeDataType.getByValue(dataType);
        if (attributeDataType != null) {
            GluuAttribute attr = new GluuAttribute();
            attr.setName(attributeName);
            attr.setDisplayName(displayName);
            attr.setDataType(attributeDataType);
            attr.setRequred(required);
            return attr;
        }
    }
    return null;
}
Also used : GluuAttributeDataType(org.xdi.model.GluuAttributeDataType) GluuAttribute(org.xdi.model.GluuAttribute)

Aggregations

GluuAttribute (org.xdi.model.GluuAttribute)64 ArrayList (java.util.ArrayList)24 GluuCustomAttribute (org.gluu.oxtrust.model.GluuCustomAttribute)15 JSONObject (org.codehaus.jettison.json.JSONObject)9 JSONArray (org.codehaus.jettison.json.JSONArray)8 GluuAttributeDataType (org.xdi.model.GluuAttributeDataType)6 IOException (java.io.IOException)5 BigDecimal (java.math.BigDecimal)5 Date (java.util.Date)5 HashMap (java.util.HashMap)5 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)5 Extension (org.gluu.oxtrust.model.scim2.Extension)5 JwtSubClaimObject (org.xdi.oxauth.model.jwt.JwtSubClaimObject)5 Filter (com.unboundid.ldap.sdk.Filter)4 List (java.util.List)4 GluuSAMLTrustRelationship (org.gluu.oxtrust.model.GluuSAMLTrustRelationship)4 Claim (org.xdi.oxauth.model.authorize.Claim)4 Scope (org.xdi.oxauth.model.common.Scope)4 PairwiseIdentifier (org.xdi.oxauth.model.ldap.PairwiseIdentifier)4 DynamicScopeExternalContext (org.xdi.oxauth.service.external.context.DynamicScopeExternalContext)4