Search in sources :

Example 1 with GatekeeperRdsRole

use of org.finra.gatekeeper.services.auth.GatekeeperRdsRole in project Gatekeeper by FINRAOS.

the class AuthController method getRole.

@RequestMapping(value = "/getRole", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getRole() {
    Map<String, Object> result = new HashMap<>();
    GatekeeperUserEntry user = gatekeeperRoleService.getUserProfile();
    result.put("userId", user.getUserId());
    result.put("name", user.getName());
    GatekeeperRdsRole role = gatekeeperRoleService.getRole();
    result.put("email", user.getEmail());
    result.put("approvalThreshold", approvalThreshold.getApprovalPolicy(role));
    result.put("role", role);
    switch(role) {
        case APPROVER:
        case DBA:
            result.put("memberships", gatekeeperRoleService.getDbaMemberships());
            return result;
        default:
            {
                result.put("memberships", gatekeeperRoleService.getDevMemberships());
                return result;
            }
    }
}
Also used : GatekeeperUserEntry(org.finra.gatekeeper.common.services.user.model.GatekeeperUserEntry) GatekeeperRdsRole(org.finra.gatekeeper.services.auth.GatekeeperRdsRole) HashMap(java.util.HashMap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

HashMap (java.util.HashMap)1 GatekeeperUserEntry (org.finra.gatekeeper.common.services.user.model.GatekeeperUserEntry)1 GatekeeperRdsRole (org.finra.gatekeeper.services.auth.GatekeeperRdsRole)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1