wip permissions
This commit is contained in:
@@ -81,6 +81,8 @@ public class GroupsApiResource {
|
|||||||
@QueryParam("externalId") final String externalId,
|
@QueryParam("externalId") final String externalId,
|
||||||
@QueryParam("name") final String name,
|
@QueryParam("name") final String name,
|
||||||
@QueryParam("underHierarchy") final String hierarchy){
|
@QueryParam("underHierarchy") final String hierarchy){
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("GROUP");
|
||||||
|
|
||||||
final String extraCriteria = getGroupExtraCriteria(sqlSearch, officeId, externalId, name, hierarchy);
|
final String extraCriteria = getGroupExtraCriteria(sqlSearch, officeId, externalId, name, hierarchy);
|
||||||
|
|
||||||
@@ -104,6 +106,8 @@ public class GroupsApiResource {
|
|||||||
@PathParam("groupId") final Long groupId,
|
@PathParam("groupId") final Long groupId,
|
||||||
@QueryParam("officeId") final Long officeId) {
|
@QueryParam("officeId") final Long officeId) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("GROUP");
|
||||||
|
|
||||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo
|
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo
|
||||||
.getQueryParameters());
|
.getQueryParameters());
|
||||||
if (responseParameters.isEmpty()) {
|
if (responseParameters.isEmpty()) {
|
||||||
@@ -147,6 +151,8 @@ public class GroupsApiResource {
|
|||||||
public String newGroupDetails(@Context final UriInfo uriInfo,
|
public String newGroupDetails(@Context final UriInfo uriInfo,
|
||||||
@QueryParam("officeId") final Long officeId) {
|
@QueryParam("officeId") final Long officeId) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("GROUP");
|
||||||
|
|
||||||
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
if (responseParameters.isEmpty()) {
|
if (responseParameters.isEmpty()) {
|
||||||
responseParameters.addAll(typicalResponseParameters);
|
responseParameters.addAll(typicalResponseParameters);
|
||||||
@@ -208,6 +214,8 @@ public class GroupsApiResource {
|
|||||||
public String retrieveGroupAccount(@PathParam("groupId") final Long groupId,
|
public String retrieveGroupAccount(@PathParam("groupId") final Long groupId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("GROUP");
|
||||||
|
|
||||||
Set<String> typicalResponseParameters = new HashSet<String>(
|
Set<String> typicalResponseParameters = new HashSet<String>(
|
||||||
Arrays.asList("pendingApprovalLoans", "awaitingDisbursalLoans", "openLoans", "closedLoans",
|
Arrays.asList("pendingApprovalLoans", "awaitingDisbursalLoans", "openLoans", "closedLoans",
|
||||||
"anyLoanCount", "pendingApprovalLoanCount", "awaitingDisbursalLoanCount",
|
"anyLoanCount", "pendingApprovalLoanCount", "awaitingDisbursalLoanCount",
|
||||||
|
|||||||
+12
-1
@@ -32,6 +32,7 @@ import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
|
|||||||
import org.mifosng.platform.loanproduct.service.LoanDropdownReadPlatformService;
|
import org.mifosng.platform.loanproduct.service.LoanDropdownReadPlatformService;
|
||||||
import org.mifosng.platform.loanproduct.service.LoanProductReadPlatformService;
|
import org.mifosng.platform.loanproduct.service.LoanProductReadPlatformService;
|
||||||
import org.mifosng.platform.loanproduct.service.LoanProductWritePlatformService;
|
import org.mifosng.platform.loanproduct.service.LoanProductWritePlatformService;
|
||||||
|
import org.mifosng.platform.security.PlatformSecurityContext;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -64,6 +65,10 @@ public class LoanProductsApiResource {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LoanDropdownReadPlatformService dropdownReadPlatformService;
|
private LoanDropdownReadPlatformService dropdownReadPlatformService;
|
||||||
|
|
||||||
|
private final String entityType = "LOANPRODUCT";
|
||||||
|
@Autowired
|
||||||
|
private PlatformSecurityContext context;
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Consumes({MediaType.APPLICATION_JSON})
|
@Consumes({MediaType.APPLICATION_JSON})
|
||||||
@@ -81,6 +86,8 @@ public class LoanProductsApiResource {
|
|||||||
@Consumes({MediaType.APPLICATION_JSON})
|
@Consumes({MediaType.APPLICATION_JSON})
|
||||||
@Produces({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
public String retrieveAllLoanProducts(@Context final UriInfo uriInfo) {
|
public String retrieveAllLoanProducts(@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission(entityType);
|
||||||
|
|
||||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||||
@@ -95,7 +102,9 @@ public class LoanProductsApiResource {
|
|||||||
@Consumes({MediaType.APPLICATION_JSON})
|
@Consumes({MediaType.APPLICATION_JSON})
|
||||||
@Produces({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
public String retrieveNewLoanProductDetails(@Context final UriInfo uriInfo) {
|
public String retrieveNewLoanProductDetails(@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission(entityType);
|
||||||
|
|
||||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
@@ -111,6 +120,8 @@ public class LoanProductsApiResource {
|
|||||||
@Produces({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
public String retrieveLoanProductDetails(@PathParam("productId") final Long productId, @Context final UriInfo uriInfo) {
|
public String retrieveLoanProductDetails(@PathParam("productId") final Long productId, @Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission(entityType);
|
||||||
|
|
||||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||||
final boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
|
final boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import org.mifosng.platform.loan.service.LoanReadPlatformService;
|
|||||||
import org.mifosng.platform.loan.service.LoanWritePlatformService;
|
import org.mifosng.platform.loan.service.LoanWritePlatformService;
|
||||||
import org.mifosng.platform.loanproduct.service.LoanDropdownReadPlatformService;
|
import org.mifosng.platform.loanproduct.service.LoanDropdownReadPlatformService;
|
||||||
import org.mifosng.platform.loanproduct.service.LoanProductReadPlatformService;
|
import org.mifosng.platform.loanproduct.service.LoanProductReadPlatformService;
|
||||||
|
import org.mifosng.platform.security.PlatformSecurityContext;
|
||||||
import org.mifosng.platform.staff.service.StaffReadPlatformService;
|
import org.mifosng.platform.staff.service.StaffReadPlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
@@ -92,7 +93,10 @@ public class LoansApiResource {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private StaffReadPlatformService staffReadPlatformService;
|
private StaffReadPlatformService staffReadPlatformService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PlatformSecurityContext context;
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("template")
|
@Path("template")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@@ -102,6 +106,8 @@ public class LoansApiResource {
|
|||||||
@QueryParam("groupId") final Long groupId,
|
@QueryParam("groupId") final Long groupId,
|
||||||
@QueryParam("productId") final Long productId,
|
@QueryParam("productId") final Long productId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("LOAN");
|
||||||
|
|
||||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||||
@@ -155,6 +161,8 @@ public class LoansApiResource {
|
|||||||
@PathParam("loanId") final Long loanId,
|
@PathParam("loanId") final Long loanId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("LOAN");
|
||||||
|
|
||||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
@@ -414,6 +422,8 @@ public class LoansApiResource {
|
|||||||
@PathParam("loanId") final Long loanId,
|
@PathParam("loanId") final Long loanId,
|
||||||
@QueryParam("command") final String commandParam,
|
@QueryParam("command") final String commandParam,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("LOAN");
|
||||||
|
|
||||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||||
@@ -443,6 +453,8 @@ public class LoansApiResource {
|
|||||||
public String retrieveTransaction(@PathParam("loanId") final Long loanId,
|
public String retrieveTransaction(@PathParam("loanId") final Long loanId,
|
||||||
@PathParam("transactionId") final Long transactionId,
|
@PathParam("transactionId") final Long transactionId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("LOAN");
|
||||||
|
|
||||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||||
@@ -491,7 +503,9 @@ public class LoansApiResource {
|
|||||||
@Consumes({MediaType.APPLICATION_JSON})
|
@Consumes({MediaType.APPLICATION_JSON})
|
||||||
@Produces({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
public String retrieveNewLoanChargeDetails(@Context final UriInfo uriInfo) {
|
public String retrieveNewLoanChargeDetails(@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("LOAN");
|
||||||
|
|
||||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
@@ -511,6 +525,8 @@ public class LoansApiResource {
|
|||||||
@PathParam("chargeId") final Long loanChargeId,
|
@PathParam("chargeId") final Long loanChargeId,
|
||||||
@Context final UriInfo uriInfo){
|
@Context final UriInfo uriInfo){
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("LOAN");
|
||||||
|
|
||||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -6,13 +6,13 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface GroupWritePlatformService {
|
public interface GroupWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_GROUP')")
|
||||||
EntityIdentifier createGroup(GroupCommand command);
|
EntityIdentifier createGroup(GroupCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'UPDATE_GROUP')")
|
||||||
EntityIdentifier updateGroup(GroupCommand command);
|
EntityIdentifier updateGroup(GroupCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'DELETE_GROUP')")
|
||||||
EntityIdentifier deleteGroup(Long groupId);
|
EntityIdentifier deleteGroup(Long groupId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-20
@@ -12,63 +12,63 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface LoanWritePlatformService {
|
public interface LoanWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_LOAN', 'CREATEHISTORIC_LOAN')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_LOAN', 'CREATEHISTORIC_LOAN')")
|
||||||
EntityIdentifier submitLoanApplication(LoanApplicationCommand command);
|
EntityIdentifier submitLoanApplication(LoanApplicationCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_LOAN', 'CREATEHISTORIC_LOAN')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'UPDATE_LOAN', 'UPDATEHISTORIC_LOAN')")
|
||||||
EntityIdentifier modifyLoanApplication(LoanApplicationCommand command);
|
EntityIdentifier modifyLoanApplication(LoanApplicationCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'DELETE_LOAN')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'DELETE_LOAN')")
|
||||||
EntityIdentifier deleteLoan(Long loanId);
|
EntityIdentifier deleteLoan(Long loanId);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'APPROVE_LOAN', 'APPROVEINPAST_LOAN')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'APPROVE_LOAN', 'APPROVEINPAST_LOAN')")
|
||||||
EntityIdentifier approveLoanApplication(LoanStateTransitionCommand command);
|
EntityIdentifier approveLoanApplication(LoanStateTransitionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'APPROVALUNDO_LOAN')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'APPROVALUNDO_LOAN')")
|
||||||
EntityIdentifier undoLoanApproval(UndoStateTransitionCommand command);
|
EntityIdentifier undoLoanApproval(UndoStateTransitionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'REJECT_LOAN', 'REJECTINPAST_LOAN')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'REJECT_LOAN', 'REJECTINPAST_LOAN')")
|
||||||
EntityIdentifier rejectLoan(LoanStateTransitionCommand command);
|
EntityIdentifier rejectLoan(LoanStateTransitionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'WITHDRAW_LOAN', 'WITHDRAWINPAST_LOAN')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'WITHDRAW_LOAN', 'WITHDRAWINPAST_LOAN')")
|
||||||
EntityIdentifier withdrawLoan(LoanStateTransitionCommand command);
|
EntityIdentifier withdrawLoan(LoanStateTransitionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'DISBURSE_LOAN', 'DISBURSEINPAST_LOAN')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'DISBURSE_LOAN', 'DISBURSEINPAST_LOAN')")
|
||||||
EntityIdentifier disburseLoan(LoanStateTransitionCommand command);
|
EntityIdentifier disburseLoan(LoanStateTransitionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'DISBURSALUNDO_LOAN')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'DISBURSALUNDO_LOAN')")
|
||||||
public EntityIdentifier undoLoanDisbursal(UndoStateTransitionCommand command);
|
public EntityIdentifier undoLoanDisbursal(UndoStateTransitionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'REPAYMENT_LOAN', 'REPAYMENTINPAST_LOAN')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'REPAYMENT_LOAN', 'REPAYMENTINPAST_LOAN')")
|
||||||
public EntityIdentifier makeLoanRepayment(LoanTransactionCommand command);
|
public EntityIdentifier makeLoanRepayment(LoanTransactionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'ADJUST_LOAN')")
|
||||||
EntityIdentifier adjustLoanTransaction(AdjustLoanTransactionCommand command);
|
EntityIdentifier adjustLoanTransaction(AdjustLoanTransactionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'WAIVEINTERESTPORTION_LOAN')")
|
||||||
EntityIdentifier waiveInterestOnLoan(LoanTransactionCommand command);
|
EntityIdentifier waiveInterestOnLoan(LoanTransactionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'WRITEOFF_LOAN')")
|
||||||
EntityIdentifier writeOff(LoanTransactionCommand command);
|
EntityIdentifier writeOff(LoanTransactionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'CLOSE_LOAN')")
|
||||||
EntityIdentifier closeLoan(LoanTransactionCommand command);
|
EntityIdentifier closeLoan(LoanTransactionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'CLOSEASRESCHEDULED_LOAN')")
|
||||||
EntityIdentifier closeAsRescheduled(LoanTransactionCommand command);
|
EntityIdentifier closeAsRescheduled(LoanTransactionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_LOANCHARGE')")
|
||||||
EntityIdentifier addLoanCharge(LoanChargeCommand command);
|
EntityIdentifier addLoanCharge(LoanChargeCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'UPDATE_LOANCHARGE')")
|
||||||
EntityIdentifier updateLoanCharge(LoanChargeCommand command);
|
EntityIdentifier updateLoanCharge(LoanChargeCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'DELETE_LOANCHARGE')")
|
||||||
EntityIdentifier deleteLoanCharge(final Long loanId, final Long loanChargeId);
|
EntityIdentifier deleteLoanCharge(final Long loanId, final Long loanChargeId);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'WAIVE_LOANCHARGE')")
|
||||||
EntityIdentifier waiveLoanCharge(LoanChargeCommand command);
|
EntityIdentifier waiveLoanCharge(LoanChargeCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'BULKREASSIGN_LOAN')")
|
||||||
EntityIdentifier bulkLoanReassignment(final BulkLoanReassignmentCommand command);
|
EntityIdentifier bulkLoanReassignment(final BulkLoanReassignmentCommand command);
|
||||||
}
|
}
|
||||||
+2
-3
@@ -116,7 +116,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
validator.validate();
|
validator.validate();
|
||||||
|
|
||||||
LocalDate submittedOn = command.getSubmittedOnDate();
|
LocalDate submittedOn = command.getSubmittedOnDate();
|
||||||
if (this.isBeforeToday(submittedOn) && currentUser.hasNotPermissionForAnyOf("CREATEHISTORIC_LOAN", "PORTFOLIO_MANAGEMENT_SUPER_USER")) {
|
if (this.isBeforeToday(submittedOn) && currentUser.hasNotPermissionForAnyOf("ALL_FUNCTIONS", "CREATEHISTORIC_LOAN", "PORTFOLIO_MANAGEMENT_SUPER_USER")) {
|
||||||
throw new NoAuthorizationException("Cannot add backdated loan.");
|
throw new NoAuthorizationException("Cannot add backdated loan.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,9 +140,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
LoanApplicationCommandValidator validator = new LoanApplicationCommandValidator(command);
|
LoanApplicationCommandValidator validator = new LoanApplicationCommandValidator(command);
|
||||||
validator.validate();
|
validator.validate();
|
||||||
|
|
||||||
// TODO - fix up permissions for loan modification
|
|
||||||
final LocalDate submittedOn = command.getSubmittedOnDate();
|
final LocalDate submittedOn = command.getSubmittedOnDate();
|
||||||
if (this.isBeforeToday(submittedOn) && currentUser.hasNotPermissionForAnyOf("CREATEHISTORIC_LOAN", "PORTFOLIO_MANAGEMENT_SUPER_USER")) {
|
if (this.isBeforeToday(submittedOn) && currentUser.hasNotPermissionForAnyOf("ALL_FUNCTIONS", "UPDATEHISTORIC_LOAN", "PORTFOLIO_MANAGEMENT_SUPER_USER")) {
|
||||||
throw new NoAuthorizationException("Cannot modify backdated loan.");
|
throw new NoAuthorizationException("Cannot modify backdated loan.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -6,9 +6,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface LoanProductWritePlatformService {
|
public interface LoanProductWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'CREATE_LOANPRODUCT')")
|
||||||
EntityIdentifier createLoanProduct(LoanProductCommand command);
|
EntityIdentifier createLoanProduct(LoanProductCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'UPDATE_LOANPRODUCT')")
|
||||||
EntityIdentifier updateLoanProduct(LoanProductCommand command);
|
EntityIdentifier updateLoanProduct(LoanProductCommand command);
|
||||||
}
|
}
|
||||||
@@ -236,27 +236,27 @@ public class AppUser extends AbstractAuditableCustom<AppUser, Long> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canNotApproveLoanInPast() {
|
public boolean canNotApproveLoanInPast() {
|
||||||
return hasNotPermissionForAnyOf("APPROVEINPAST_LOAN",
|
return hasNotPermissionForAnyOf("ALL_FUNCTIONS", "APPROVEINPAST_LOAN",
|
||||||
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canNotRejectLoanInPast() {
|
public boolean canNotRejectLoanInPast() {
|
||||||
return hasNotPermissionForAnyOf("REJECTINPAST_LOAN",
|
return hasNotPermissionForAnyOf("ALL_FUNCTIONS", "REJECTINPAST_LOAN",
|
||||||
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canNotWithdrawByClientLoanInPast() {
|
public boolean canNotWithdrawByClientLoanInPast() {
|
||||||
return hasNotPermissionForAnyOf("WITHDRAWINPAST_LOAN",
|
return hasNotPermissionForAnyOf("ALL_FUNCTIONS", "WITHDRAWINPAST_LOAN",
|
||||||
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canNotDisburseLoanInPast() {
|
public boolean canNotDisburseLoanInPast() {
|
||||||
return hasNotPermissionForAnyOf("DISBURSEINPAST_LOAN",
|
return hasNotPermissionForAnyOf("ALL_FUNCTIONS", "DISBURSEINPAST_LOAN",
|
||||||
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canNotMakeRepaymentOnLoanInPast() {
|
public boolean canNotMakeRepaymentOnLoanInPast() {
|
||||||
return hasNotPermissionForAnyOf("REPAYMENTINPAST_LOAN",
|
return hasNotPermissionForAnyOf("ALL_FUNCTIONS", "REPAYMENTINPAST_LOAN",
|
||||||
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,6 +350,12 @@ public class AppUser extends AbstractAuditableCustom<AppUser, Long> implements
|
|||||||
higherPermission = "PORTFOLIO_MANAGEMENT_SUPER_USER";
|
higherPermission = "PORTFOLIO_MANAGEMENT_SUPER_USER";
|
||||||
} else if (entityType.equalsIgnoreCase("FUND")) {
|
} else if (entityType.equalsIgnoreCase("FUND")) {
|
||||||
higherPermission = "ORGANISATION_ADMINISTRATION_SUPER_USER";
|
higherPermission = "ORGANISATION_ADMINISTRATION_SUPER_USER";
|
||||||
|
} else if (entityType.equalsIgnoreCase("GROUP")) {
|
||||||
|
higherPermission = "PORTFOLIO_MANAGEMENT_SUPER_USER";
|
||||||
|
} else if (entityType.equalsIgnoreCase("LOANPRODUCT")) {
|
||||||
|
higherPermission = "ORGANISATION_ADMINISTRATION_SUPER_USER";
|
||||||
|
} else if (entityType.equalsIgnoreCase("LOAN")) {
|
||||||
|
higherPermission = "PORTFOLIO_MANAGEMENT_SUPER_USER";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(higherPermission.equals(""))) {
|
if (!(higherPermission.equals(""))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user