Skip to content

Commit

Permalink
feat: add POST /rolePermissionsMapping for adding new rolePermissions…
Browse files Browse the repository at this point in the history
…Mapping entry #144
  • Loading branch information
duttarnab committed Jan 6, 2022
1 parent 932a45b commit 149aeb1
Showing 1 changed file with 0 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ public List<RolePermissionMapping> addPermissionsToRole(RolePermissionMapping ro
entryManager.merge(adminConf);
return adminConf.getDynamic().getRolePermissionMapping();
} catch (ApplicationException e) {
log.error(e.getMessage());
throw e;
} catch (Exception e) {
log.error(ErrorResponse.ERROR_IN_MAPPING_ROLE_PERMISSION.getDescription(), e);
Expand Down Expand Up @@ -287,14 +286,9 @@ public List<RolePermissionMapping> mapPermissionsToRole(RolePermissionMapping ro
}

Optional<RolePermissionMapping> rolePermissionMappingOptional = roleScopeMappingList.stream().findFirst();
List<String> mappedPermissions = Lists.newArrayList();
if (rolePermissionMappingOptional.isPresent()) {
mappedPermissions = rolePermissionMappingOptional.get().getPermissions();
}

//remove duplicate permissions
Set<String> scopesSet = new LinkedHashSet<>(rolePermissionMappingArg.getPermissions());
//scopesSet.addAll(rolePermissionMappingArg.getPermissions());
List<String> combinedScopes = new ArrayList<>(scopesSet);

if (adminConf.getDynamic().getRolePermissionMapping()
Expand All @@ -311,7 +305,6 @@ public List<RolePermissionMapping> mapPermissionsToRole(RolePermissionMapping ro
entryManager.merge(adminConf);
return adminConf.getDynamic().getRolePermissionMapping();
} catch (ApplicationException e) {
log.error(e.getMessage());
throw e;
} catch (Exception e) {
log.error(ErrorResponse.ERROR_IN_MAPPING_ROLE_PERMISSION.getDescription(), e);
Expand Down

0 comments on commit 149aeb1

Please sign in to comment.