Skip to content

Commit

Permalink
Merge branch 'feature/shibui-1742' of bitbucket.org:unicon/shib-idp-u…
Browse files Browse the repository at this point in the history
…i into feature/shibui-1742
  • Loading branch information
rmathis committed Jul 29, 2021
2 parents 9445355 + 066318b commit 392d815
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package edu.internet2.tier.shibboleth.admin.ui.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import edu.internet2.tier.shibboleth.admin.ui.repository.EntityDescriptorRepository;
import edu.internet2.tier.shibboleth.admin.ui.security.service.UserService;

@RestController
@RequestMapping("/api/activate")
public class ActivateController {
@Autowired
private UserService userService;

@Autowired
private EntityDescriptorRepository entityDescriptorRepo;




// Enable/disable for : entity descriptor, provider, filter
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package edu.internet2.tier.shibboleth.admin.ui.security.controller;

import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -56,10 +58,17 @@ public ResponseEntity<?> getOne(@PathVariable String resourceId) throws EntityNo
}

@Secured("ROLE_ADMIN")
@PutMapping
@PutMapping(path = {"/", "/{resourceId}" })
@Transactional
public ResponseEntity<?> update(@RequestBody Role role) throws EntityNotFoundException {
Role result = rolesService.updateRole(role);
public ResponseEntity<?> update(@RequestBody Role incomingRoleDetail, @PathVariable Optional<String> resourceId) throws EntityNotFoundException {
Role updateRole;
if (resourceId.isPresent()) {
updateRole = rolesService.findByResourceId(resourceId.get());
} else {
updateRole = rolesService.findByResourceId(incomingRoleDetail.getResourceId());
}
updateRole.setName(incomingRoleDetail.getName());
Role result = rolesService.updateRole(updateRole);
return ResponseEntity.ok(result);
}
}

0 comments on commit 392d815

Please sign in to comment.