Skip to content

Commit

Permalink
SHIBUI-1788
Browse files Browse the repository at this point in the history
reverted logic for generating jsonschema definitions.
eliminating whitespace in custom entity attribute at the point it would
be set.
  • Loading branch information
chasegawa committed Jun 29, 2021
1 parent 5db234d commit 7aa97c6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package edu.internet2.tier.shibboleth.admin.ui.service

import org.apache.commons.lang3.StringUtils
import edu.internet2.tier.shibboleth.admin.ui.configuration.CustomPropertiesConfiguration
import edu.internet2.tier.shibboleth.admin.ui.domain.IRelyingPartyOverrideProperty
import edu.internet2.tier.shibboleth.admin.ui.security.model.User
import edu.internet2.tier.shibboleth.admin.ui.security.service.UserService
import org.springframework.beans.factory.annotation.Autowired
Expand Down Expand Up @@ -30,19 +28,18 @@ class JsonSchemaBuilderService {
void addRelyingPartyOverridesToJson(Object json) {
def properties = [:]
customPropertiesConfiguration.getOverrides().each {
def propertyName = ((String) it['name']).replaceAll("\\s","")
def property
if (it['displayType'] == 'list' || it['displayType'] == 'set' || it['displayType'] == 'selection_list') {
property = [$ref: '#/definitions/' + propertyName]
property = [$ref: '#/definitions/' + it['name']]
} else {
property =
[title : it['displayName'],
description : it['helpText'],
type : ((IRelyingPartyOverrideProperty)it).getTypeForUI(),
type : it['displayType'],
default : it['displayType'] == 'boolean' ? Boolean.getBoolean(it['defaultValue']) : it['defaultValue'],
examples : it['examples']]
}
properties[propertyName] = property
properties[(String) it['name']] = property
}
json['properties'] = properties
}
Expand All @@ -67,7 +64,7 @@ class JsonSchemaBuilderService {


definition['items'] = items
json[((String) it['name']).replaceAll("\\s","")] = definition
json[(String) it['name']] = definition
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,35 +65,17 @@ public class CustomEntityAttributeDefinition implements IRelyingPartyOverridePro
@Id
@Column(name = "resource_id", nullable = false)
String resourceId = UUID.randomUUID().toString();

@Override
public String getAttributeName() {
// This is a bit of a hack because we don't have attribute name in the UI yet...
return attributeName == null ? name : attributeName;
}


@Override
public Set<String> getDefaultValues() {
return customAttrListDefinitions;
}

@Override
public String getDisplayName() {
// This is here only to ensure proper functionality works until the full definition is revised with all the fields
return displayName == null ? name : displayName;
}


@Override
public String getDisplayType() {
return attributeType.name().toLowerCase();
}

@Override
public String getAttributeFriendlyName() {
// This is here only to ensure proper functionality works until the full definition is revised with all the fields
return attributeFriendlyName == null ? name : attributeFriendlyName;
}

@Override
public Boolean getFromConfigFile() {
return Boolean.FALSE;
Expand Down Expand Up @@ -121,6 +103,14 @@ public void setDisplayType(String displayType) {
// This is here to comply with the interface only and should not be used to change the value in this implementation
}

/**
* Ensure there are no whitespace characters in the name
*/
@Override
public void setName(String name) {
this.name = name.replaceAll("\\s","");
}

public void updateExamplesList() {
examples = customAttrListDefinitions;
}
Expand Down

0 comments on commit 7aa97c6

Please sign in to comment.