Skip to content

Commit

Permalink
SHIBUI-2059
Browse files Browse the repository at this point in the history
Missing json for bundles with attribute release
  • Loading branch information
chasegawa committed Sep 16, 2021
1 parent 4d68c38 commit 762fe32
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
package edu.internet2.tier.shibboleth.admin.ui.service

import edu.internet2.tier.shibboleth.admin.ui.configuration.CustomPropertiesConfiguration
import edu.internet2.tier.shibboleth.admin.ui.domain.AttributeBundle
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 lombok.NoArgsConstructor
import org.springframework.beans.factory.annotation.Autowired

/**
* @author Bill Smith (wsmith@unicon.net)
*/
@NoArgsConstructor
class JsonSchemaBuilderService {
@Autowired
AttributeBundleService attributeBundleService

@Autowired
CustomPropertiesConfiguration customPropertiesConfiguration

@Autowired
UserService userService

JsonSchemaBuilderService(UserService userService) {
this.userService = userService
}

void addReleaseAttributesToJson(Object json) {
json['enum'] = customPropertiesConfiguration.getAttributes().collect {
List<Object> result = new ArrayList<>()
List<String> resultNames = new ArrayList<>()
attributeBundleService.findAll().forEach({ bundle ->
result.add(bundle.getAttributes())
resultNames.add(bundle.getName())
})

result.addAll(customPropertiesConfiguration.getAttributes().collect {
it['name']
}
})

json['enum'] = result
json['enumNames'] = resultNames
}

void addRelyingPartyOverridesToJson(Object json) {
Expand Down Expand Up @@ -79,4 +91,4 @@ class JsonSchemaBuilderService {
serviceEnabled.remove('description')
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ public JsonSchemaResourceLocationRegistry jsonSchemaResourceLocationRegistry(Res

@Bean
public JsonSchemaBuilderService jsonSchemaBuilderService(UserService userService) {
return new JsonSchemaBuilderService(userService);
return new JsonSchemaBuilderService();
}
}
}

0 comments on commit 762fe32

Please sign in to comment.