Skip to content

Commit

Permalink
SHIBUI-1788
Browse files Browse the repository at this point in the history
Quick feedback adjustments
  • Loading branch information
chasegawa committed Jun 17, 2021
1 parent 770cdc6 commit 98ca11f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,21 @@ public class CustomPropertiesConfiguration implements ApplicationListener<Custom

private void buildRelyingPartyOverrides() {
// Start over with a clean map and get the CustomEntityAttributesDefinitions from the DB
overrides = new HashMap<>();
HashMap<String, IRelyingPartyOverrideProperty> reloaded = new HashMap<>();
ceadService.getAllDefinitions().forEach(def -> {
def.updateExamplesList(); // totally non-ooo, but @PostLoad wasn't working and JPA/Hibernate is doing some reflection crap
overrides.put(def.getName(), def);
reloaded.put(def.getName(), def);
});

// We only want to add to an override from the config file if the incoming override (by name) isn't already in
// the list of overrides (ie DB > file config)
for (RelyingPartyOverrideProperty rpop : this.overridesFromConfigFile) {
if (!this.overrides.containsKey(rpop.getName())) {
this.overrides.put(rpop.getName(), rpop);
if (!reloaded.containsKey(rpop.getName())) {
reloaded.put(rpop.getName(), rpop);
}
}

this.overrides = reloaded;
}

public List<? extends Map<String, String>> getAttributes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

import edu.internet2.tier.shibboleth.admin.ui.configuration.CustomPropertiesConfiguration;
import edu.internet2.tier.shibboleth.admin.ui.domain.CustomEntityAttributeDefinition;
import edu.internet2.tier.shibboleth.admin.ui.service.CustomEntityAttributesDefinitionService;

Expand All @@ -24,9 +23,6 @@
public class CustomEntityAttributesDefinitionsController {
@Autowired
private CustomEntityAttributesDefinitionService caService;

@Autowired
private CustomPropertiesConfiguration customPropertiesConfiguration;

@PostMapping("/attribute")
@Transactional
Expand Down Expand Up @@ -71,7 +67,7 @@ public ResponseEntity<?> update(@RequestBody CustomEntityAttributeDefinition def
@GetMapping("/attributes")
@Transactional(readOnly = true)
public ResponseEntity<?> getAll() {
return ResponseEntity.ok(customPropertiesConfiguration.getOverrides());
return ResponseEntity.ok(caService.getAllDefinitions());
}

@GetMapping("/attribute/{name}")
Expand Down

0 comments on commit 98ca11f

Please sign in to comment.