WIP permissions redo - only use mifos user until finished - also some changes that were pulled but show as changed
This commit is contained in:
@@ -24,6 +24,7 @@ import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService
|
||||
import org.mifosng.platform.charge.service.ChargeReadPlatformService;
|
||||
import org.mifosng.platform.charge.service.ChargeWritePlatformService;
|
||||
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
|
||||
import org.mifosng.platform.security.PlatformSecurityContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -32,7 +33,7 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
public class ChargesApiResource {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ChargeReadPlatformService chargeReadPlatformService;
|
||||
|
||||
@@ -44,12 +45,22 @@ public class ChargesApiResource {
|
||||
|
||||
@Autowired
|
||||
private PortfolioApiJsonSerializerService apiJsonSerializerService;
|
||||
|
||||
private final String entityType = "CHARGE";
|
||||
private final PlatformSecurityContext context;
|
||||
|
||||
@Autowired
|
||||
public ChargesApiResource(final PlatformSecurityContext context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Consumes({MediaType.APPLICATION_JSON})
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
public String retrieveAllCharges(@Context final UriInfo uriInfo){
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission(entityType);
|
||||
|
||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
|
||||
@@ -63,7 +74,9 @@ public class ChargesApiResource {
|
||||
@Consumes({MediaType.APPLICATION_JSON})
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
public String retrieveCharge(@PathParam("chargeId") final Long chargeId, @Context final UriInfo uriInfo){
|
||||
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission(entityType);
|
||||
|
||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||
|
||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
@@ -83,7 +96,9 @@ public class ChargesApiResource {
|
||||
@Consumes({MediaType.APPLICATION_JSON})
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
public String retrieveNewChargeDetails(@Context final UriInfo uriInfo) {
|
||||
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission(entityType);
|
||||
|
||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||
|
||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
|
||||
+15
@@ -28,6 +28,7 @@ import org.mifosng.platform.client.service.ClientReadPlatformService;
|
||||
import org.mifosng.platform.client.service.ClientWritePlatformService;
|
||||
import org.mifosng.platform.exceptions.DuplicateClientIdentifierException;
|
||||
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
|
||||
import org.mifosng.platform.security.PlatformSecurityContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -52,13 +53,23 @@ public class ClientIdentifiersApiResource {
|
||||
private static final Set<String> typicalResponseParameters = new HashSet<String>(
|
||||
Arrays.asList("id", "clientId", "documentTypeId", "description",
|
||||
"documentKey", "documentTypeName"));
|
||||
|
||||
private final String entityType = "CLIENTIDENTIFIER";
|
||||
private final PlatformSecurityContext context;
|
||||
|
||||
@Autowired
|
||||
public ClientIdentifiersApiResource(final PlatformSecurityContext context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveAllClientIdentifiers(@Context final UriInfo uriInfo,
|
||||
@PathParam("clientId") final Long clientId) {
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission(entityType);
|
||||
|
||||
Set<String> responseParameters = ApiParameterHelper
|
||||
.extractFieldsForResponseIfProvided(uriInfo
|
||||
.getQueryParameters());
|
||||
@@ -82,6 +93,8 @@ public class ClientIdentifiersApiResource {
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String newClientDetails(@Context final UriInfo uriInfo) {
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission(entityType);
|
||||
|
||||
Set<String> responseParameters = ApiParameterHelper
|
||||
.extractFieldsForResponseIfProvided(uriInfo
|
||||
.getQueryParameters());
|
||||
@@ -132,6 +145,8 @@ public class ClientIdentifiersApiResource {
|
||||
@PathParam("identifierId") final Long clientIdentifierId,
|
||||
@Context final UriInfo uriInfo) {
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission(entityType);
|
||||
|
||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||
if (responseParameters.isEmpty()) {
|
||||
responseParameters.addAll(typicalResponseParameters);
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
|
||||
import org.mifosng.platform.makerchecker.service.PortfolioMakerCheckerReadPlatformService;
|
||||
import org.mifosng.platform.makerchecker.service.PortfolioMakerCheckerWriteService;
|
||||
import org.mifosng.platform.organisation.service.OfficeReadPlatformService;
|
||||
import org.mifosng.platform.security.PlatformSecurityContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -84,6 +85,13 @@ public class ClientsApiResource {
|
||||
@Autowired
|
||||
private PortfolioMakerCheckerReadPlatformService makerCheckerReadPlatformService;
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
|
||||
@Autowired
|
||||
public ClientsApiResource(final PlatformSecurityContext context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Consumes({MediaType.APPLICATION_JSON})
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
@@ -96,6 +104,8 @@ public class ClientsApiResource {
|
||||
@QueryParam("lastName") final String lastName,
|
||||
@QueryParam("underHierarchy") final String hierarchy) {
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission("CLIENT");
|
||||
|
||||
final String extraCriteria = getClientCriteria(sqlSearch, officeId, externalId, displayName, firstName, lastName, hierarchy);
|
||||
|
||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||
@@ -157,6 +167,8 @@ public class ClientsApiResource {
|
||||
public String retrieveClientData(
|
||||
@PathParam("clientId") final Long clientId,
|
||||
@Context final UriInfo uriInfo) {
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission("CLIENT");
|
||||
|
||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
@@ -176,6 +188,8 @@ public class ClientsApiResource {
|
||||
@Consumes({MediaType.APPLICATION_JSON})
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
public String newClientDetails(@Context final UriInfo uriInfo) {
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission("CLIENT");
|
||||
|
||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
@@ -246,6 +260,8 @@ public class ClientsApiResource {
|
||||
public String retrieveClientAccount(@PathParam("clientId") final Long clientId,
|
||||
@Context final UriInfo uriInfo) {
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission("CLIENT");
|
||||
|
||||
Set<String> typicalResponseParameters = new HashSet<String>(
|
||||
Arrays.asList("pendingApprovalLoans", "awaitingDisbursalLoans", "openLoans", "closedLoans",
|
||||
"anyLoanCount", "pendingApprovalLoanCount", "awaitingDisbursalLoanCount", "activeLoanCount", "closedLoanCount",
|
||||
@@ -271,6 +287,8 @@ public class ClientsApiResource {
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
public String retrieveAllClientNotes(@PathParam("clientId") final Long clientId, @Context final UriInfo uriInfo) {
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission("CLIENTNOTE");
|
||||
|
||||
Set<String> typicalResponseParameters = new HashSet<String>(
|
||||
Arrays.asList("id", "clientId", "loanId", "loanTransactionId", "noteType", "note", "createdById", "createdByUsername",
|
||||
"createdOn", "updatedById", "updatedByUsername", "updatedOn")
|
||||
@@ -308,6 +326,8 @@ public class ClientsApiResource {
|
||||
@PathParam("clientId") final Long clientId,
|
||||
@PathParam("noteId") final Long noteId,
|
||||
@Context final UriInfo uriInfo) {
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission("CLIENTNOTE");
|
||||
|
||||
Set<String> typicalResponseParameters = new HashSet<String>(
|
||||
Arrays.asList("id", "clientId", "loanId", "loanTransactionId", "noteType", "note", "createdById", "createdByUsername",
|
||||
@@ -414,6 +434,8 @@ public class ClientsApiResource {
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
public Response retrieveClientImage(
|
||||
@PathParam("clientId") final Long clientId) {
|
||||
|
||||
context.authenticatedUser().validateHasReadPermission("CLIENTIMAGE");
|
||||
|
||||
final ClientData clientData = this.clientReadPlatformService.retrieveIndividualClient(clientId);
|
||||
//validate if client does not exist or image key is null
|
||||
|
||||
+6
-6
@@ -1,18 +1,18 @@
|
||||
package org.mifosng.platform.charge.service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.mifosng.platform.api.data.ChargeData;
|
||||
import org.mifosng.platform.api.data.LoanChargeData;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface ChargeReadPlatformService {
|
||||
|
||||
Collection<ChargeData> retrieveAllCharges();
|
||||
|
||||
|
||||
ChargeData retrieveCharge(Long chargeId);
|
||||
|
||||
|
||||
ChargeData retrieveNewChargeDetails();
|
||||
|
||||
|
||||
Collection<ChargeData> retrieveLoanApplicableCharges(boolean feeChargesOnly);
|
||||
|
||||
Collection<ChargeData> retrieveLoanProductCharges(Long loanProductId);
|
||||
@@ -20,6 +20,6 @@ public interface ChargeReadPlatformService {
|
||||
Collection<LoanChargeData> retrieveLoanCharges(Long loanId);
|
||||
|
||||
LoanChargeData retrieveLoanChargeDetails(Long loanChargeId, Long loanId);
|
||||
|
||||
|
||||
ChargeData retrieveLoanChargeTemplate();
|
||||
}
|
||||
|
||||
+3
-3
@@ -5,12 +5,12 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface ChargeWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('ORGANISATION_ADMINISTRATION_SUPER_USER', 'CREATE_CHARGE')")
|
||||
Long createCharge(final ChargeCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('ORGANISATION_ADMINISTRATION_SUPER_USER', 'UPDATE_CHARGE')")
|
||||
Long updateCharge(final ChargeCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('ORGANISATION_ADMINISTRATION_SUPER_USER', 'DELETE_CHARGE')")
|
||||
Long deleteCharge(final Long chargeId);
|
||||
}
|
||||
|
||||
+21
-21
@@ -11,36 +11,36 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface ClientWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_ENROLL_NEW_CLIENT_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_CLIENT')")
|
||||
Long enrollClient(ClientCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'UPDATE_CLIENT')")
|
||||
EntityIdentifier updateClientDetails(ClientCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
EntityIdentifier saveOrUpdateClientImage(Long clientId, String imageName, InputStream inputStream);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
EntityIdentifier saveOrUpdateClientImage(Long clientId, Base64EncodedImage encodedImage);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
EntityIdentifier deleteClientImage(Long clientId);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
EntityIdentifier addClientNote(NoteCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
EntityIdentifier updateNote(NoteCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_DELETE_CLIENT_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'DELETE_CLIENT')")
|
||||
EntityIdentifier deleteClient(Long clientId);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_CLIENTIMAGE')")
|
||||
EntityIdentifier saveOrUpdateClientImage(Long clientId, String imageName, InputStream inputStream);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_CLIENTIMAGE')")
|
||||
EntityIdentifier saveOrUpdateClientImage(Long clientId, Base64EncodedImage encodedImage);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'DELETE_CLIENTIMAGE')")
|
||||
EntityIdentifier deleteClientImage(Long clientId);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_CLIENTNOTE')")
|
||||
EntityIdentifier addClientNote(NoteCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'UPDATE_CLIENTNOTE')")
|
||||
EntityIdentifier updateNote(NoteCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_CLIENTIDENTIFIER')")
|
||||
Long addClientIdentifier(ClientIdentifierCommand clientIdentifierCommand);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'UPDATE_CLIENTIDENTIFIER')")
|
||||
EntityIdentifier updateClientIdentifier(ClientIdentifierCommand clientIdentifierCommand);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'DELETE_CLIENTIDENTIFIER')")
|
||||
EntityIdentifier deleteClientIdentifier(Long clientIdentifierId);
|
||||
}
|
||||
+3
-3
@@ -8,14 +8,14 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface DocumentWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
Long createDocument(DocumentCommand documentCommand, InputStream inputStream);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier updateDocument(DocumentCommand documentCommand,
|
||||
InputStream inputStream);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier deleteDocument(DocumentCommand documentCommand);
|
||||
|
||||
}
|
||||
+2
-2
@@ -5,9 +5,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface FundWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
Long createFund(final FundCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
Long updateFund(final FundCommand command);
|
||||
}
|
||||
+3
-3
@@ -6,13 +6,13 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface GroupWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier createGroup(GroupCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier updateGroup(GroupCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier deleteGroup(Long groupId);
|
||||
|
||||
}
|
||||
|
||||
+20
-20
@@ -12,63 +12,63 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface LoanWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_SUBMIT_NEW_LOAN_APPLICATION_ROLE', 'CAN_SUBMIT_HISTORIC_LOAN_APPLICATION_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_LOAN', 'CREATEHISTORIC_LOAN')")
|
||||
EntityIdentifier submitLoanApplication(LoanApplicationCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_SUBMIT_NEW_LOAN_APPLICATION_ROLE', 'CAN_SUBMIT_HISTORIC_LOAN_APPLICATION_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_LOAN', 'CREATEHISTORIC_LOAN')")
|
||||
EntityIdentifier modifyLoanApplication(LoanApplicationCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_DELETE_LOAN_THAT_IS_SUBMITTED_AND_NOT_APPROVED')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'DELETE_LOAN')")
|
||||
EntityIdentifier deleteLoan(Long loanId);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_APPROVE_LOAN_ROLE', 'CAN_APPROVE_LOAN_IN_THE_PAST_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'APPROVE_LOAN', 'APPROVEINPAST_LOAN')")
|
||||
EntityIdentifier approveLoanApplication(LoanStateTransitionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_UNDO_LOAN_APPROVAL_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'APPROVALUNDO_LOAN')")
|
||||
EntityIdentifier undoLoanApproval(UndoStateTransitionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_REJECT_LOAN_ROLE', 'CAN_REJECT_LOAN_IN_THE_PAST_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'REJECT_LOAN', 'REJECTINPAST_LOAN')")
|
||||
EntityIdentifier rejectLoan(LoanStateTransitionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_WITHDRAW_LOAN_ROLE', 'CAN_WITHDRAW_LOAN_IN_THE_PAST_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'WITHDRAW_LOAN', 'WITHDRAWINPAST_LOAN')")
|
||||
EntityIdentifier withdrawLoan(LoanStateTransitionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_DISBURSE_LOAN_ROLE', 'CAN_DISBURSE_LOAN_IN_THE_PAST_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'DISBURSE_LOAN', 'DISBURSEINPAST_LOAN')")
|
||||
EntityIdentifier disburseLoan(LoanStateTransitionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_UNDO_LOAN_DISBURSAL_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'DISBURSALUNDO_LOAN')")
|
||||
public EntityIdentifier undoLoanDisbursal(UndoStateTransitionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_MAKE_LOAN_REPAYMENT_ROLE', 'CAN_MAKE_LOAN_REPAYMENT_IN_THE_PAST_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'REPAYMENT_LOAN', 'REPAYMENTINPAST_LOAN')")
|
||||
public EntityIdentifier makeLoanRepayment(LoanTransactionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier adjustLoanTransaction(AdjustLoanTransactionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier waiveInterestOnLoan(LoanTransactionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier writeOff(LoanTransactionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier closeLoan(LoanTransactionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier closeAsRescheduled(LoanTransactionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier addLoanCharge(LoanChargeCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier updateLoanCharge(LoanChargeCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier deleteLoanCharge(final Long loanId, final Long loanChargeId);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier waiveLoanCharge(LoanChargeCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||
EntityIdentifier bulkLoanReassignment(final BulkLoanReassignmentCommand command);
|
||||
}
|
||||
+2
-2
@@ -116,7 +116,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
validator.validate();
|
||||
|
||||
LocalDate submittedOn = command.getSubmittedOnDate();
|
||||
if (this.isBeforeToday(submittedOn) && currentUser.hasNotPermissionForAnyOf("CAN_SUBMIT_HISTORIC_LOAN_APPLICATION_ROLE", "PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE")) {
|
||||
if (this.isBeforeToday(submittedOn) && currentUser.hasNotPermissionForAnyOf("CREATEHISTORIC_LOAN", "PORTFOLIO_MANAGEMENT_SUPER_USER")) {
|
||||
throw new NoAuthorizationException("Cannot add backdated loan.");
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
// TODO - fix up permissions for loan modification
|
||||
final LocalDate submittedOn = command.getSubmittedOnDate();
|
||||
if (this.isBeforeToday(submittedOn) && currentUser.hasNotPermissionForAnyOf("CAN_SUBMIT_HISTORIC_LOAN_APPLICATION_ROLE", "PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE")) {
|
||||
if (this.isBeforeToday(submittedOn) && currentUser.hasNotPermissionForAnyOf("CREATEHISTORIC_LOAN", "PORTFOLIO_MANAGEMENT_SUPER_USER")) {
|
||||
throw new NoAuthorizationException("Cannot modify backdated loan.");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -6,9 +6,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface LoanProductWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier createLoanProduct(LoanProductCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier updateLoanProduct(LoanProductCommand command);
|
||||
}
|
||||
+2
-2
@@ -5,9 +5,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface CodeWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
Long createCode(final CodeCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
Long updateCode(final CodeCommand command);
|
||||
}
|
||||
+3
-3
@@ -6,12 +6,12 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface OfficeWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
Long createOffice(final OfficeCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
Long updateOffice(final OfficeCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
Long externalBranchMoneyTransfer(BranchMoneyTransferCommand command);
|
||||
}
|
||||
+11
-11
@@ -11,36 +11,36 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface DepositAccountWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier createDepositAccount(DepositAccountCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier deleteDepositAccount(Long productId);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
EntityIdentifier approveDepositApplication(DepositStateTransitionApprovalCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
EntityIdentifier rejectDepositApplication(DepositStateTransitionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
EntityIdentifier withdrawDepositApplication(DepositStateTransitionCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
EntityIdentifier undoDepositApproval(UndoStateTransitionCommand undoCommand);
|
||||
|
||||
/*@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
/*@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
EntityIdentifier matureDepositApplication(DepositStateTransitionCommand command);*/
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
EntityIdentifier withdrawDepositAccountMoney(DepositAccountWithdrawalCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'CAN_APPROVE_DEPOSIT_ROLE', 'CAN_APPROVE_DEPOSIT_IN_THE_PAST_ROLE')")
|
||||
EntityIdentifier withdrawDepositAccountInterestMoney(DepositAccountWithdrawInterestCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier renewDepositAccount(DepositAccountCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier updateDepositAccount(DepositAccountCommand command);
|
||||
}
|
||||
|
||||
+2
-2
@@ -6,9 +6,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface SavingAccountWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier createSavingAccount(SavingAccountCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier updateSavingAccount(SavingAccountCommand command);
|
||||
}
|
||||
+3
-3
@@ -6,13 +6,13 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface DepositProductWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier createDepositProduct(DepositProductCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier updateDepositProduct(DepositProductCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier deleteDepositProduct(Long productId);
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -5,12 +5,12 @@ import org.mifosng.platform.api.data.EntityIdentifier;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface SavingProductWritePlatformService {
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier createSavingProduct(SavingProductCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier updateSavingProduct(SavingProductCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
EntityIdentifier deleteSavingProduct(Long productId);
|
||||
}
|
||||
|
||||
+12
-12
@@ -1,13 +1,13 @@
|
||||
package org.mifosng.platform.staff.service;
|
||||
|
||||
import org.mifosng.platform.api.commands.StaffCommand;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface StaffWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
Long createStaff(final StaffCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
Long updateStaff(final StaffCommand command);
|
||||
package org.mifosng.platform.staff.service;
|
||||
|
||||
import org.mifosng.platform.api.commands.StaffCommand;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface StaffWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
Long createStaff(final StaffCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||
Long updateStaff(final StaffCommand command);
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
|
||||
import org.mifosng.platform.api.commands.UserCommand;
|
||||
import org.mifosng.platform.exceptions.NoAuthorizationException;
|
||||
import org.mifosng.platform.infrastructure.AbstractAuditableCustom;
|
||||
import org.mifosng.platform.infrastructure.PlatformUser;
|
||||
import org.mifosng.platform.organisation.domain.Office;
|
||||
@@ -235,29 +236,28 @@ public class AppUser extends AbstractAuditableCustom<AppUser, Long> implements
|
||||
}
|
||||
|
||||
public boolean canNotApproveLoanInPast() {
|
||||
return hasNotPermissionForAnyOf("CAN_APPROVE_LOAN_IN_THE_PAST_ROLE",
|
||||
"PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE");
|
||||
return hasNotPermissionForAnyOf("APPROVEINPAST_LOAN",
|
||||
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||
}
|
||||
|
||||
public boolean canNotRejectLoanInPast() {
|
||||
return hasNotPermissionForAnyOf("CAN_REJECT_LOAN_IN_THE_PAST_ROLE",
|
||||
"PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE");
|
||||
return hasNotPermissionForAnyOf("REJECTINPAST_LOAN",
|
||||
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||
}
|
||||
|
||||
public boolean canNotWithdrawByClientLoanInPast() {
|
||||
return hasNotPermissionForAnyOf("CAN_WITHDRAW_LOAN_IN_THE_PAST_ROLE",
|
||||
"PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE");
|
||||
return hasNotPermissionForAnyOf("WITHDRAWINPAST_LOAN",
|
||||
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||
}
|
||||
|
||||
public boolean canNotDisburseLoanInPast() {
|
||||
return hasNotPermissionForAnyOf("CAN_DISBURSE_LOAN_IN_THE_PAST_ROLE",
|
||||
"PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE");
|
||||
return hasNotPermissionForAnyOf("DISBURSEINPAST_LOAN",
|
||||
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||
}
|
||||
|
||||
public boolean canNotMakeRepaymentOnLoanInPast() {
|
||||
return hasNotPermissionForAnyOf(
|
||||
"CAN_MAKE_LOAN_REPAYMENT_IN_THE_PAST_ROLE",
|
||||
"PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE");
|
||||
return hasNotPermissionForAnyOf("REPAYMENTINPAST_LOAN",
|
||||
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||
}
|
||||
|
||||
public boolean hasNotPermissionForReport(String reportName) {
|
||||
@@ -321,6 +321,35 @@ public class AppUser extends AbstractAuditableCustom<AppUser, Long> implements
|
||||
return hasNotPermission;
|
||||
}
|
||||
|
||||
public void validateHasReadPermission(final String entityType) {
|
||||
|
||||
String authorizationMessage = "User has no authority to view "
|
||||
+ entityType.toLowerCase() + "s";
|
||||
String matchPermission = "READ_" + entityType.toUpperCase();
|
||||
|
||||
if (hasNotPermissionForAnyOf("ALL_FUNCTIONS_READ", matchPermission))
|
||||
throw new NoAuthorizationException(authorizationMessage);
|
||||
|
||||
String higherPermission = "";
|
||||
if (entityType.equalsIgnoreCase("CHARGE")) {
|
||||
higherPermission = "ORGANISATION_ADMINISTRATION_SUPER_USER";
|
||||
} else if (entityType.equalsIgnoreCase("CLIENT")) {
|
||||
higherPermission = "PORTFOLIO_MANAGEMENT_SUPER_USER";
|
||||
} else if (entityType.equalsIgnoreCase("CLIENTNOTE")) {
|
||||
higherPermission = "PORTFOLIO_MANAGEMENT_SUPER_USER";
|
||||
} else if (entityType.equalsIgnoreCase("CLIENTIDENTIFIER")) {
|
||||
higherPermission = "PORTFOLIO_MANAGEMENT_SUPER_USER";
|
||||
} else if (entityType.equalsIgnoreCase("CLIENTIMAGE")) {
|
||||
higherPermission = "PORTFOLIO_MANAGEMENT_SUPER_USER";
|
||||
}
|
||||
|
||||
if (!(higherPermission.equals(""))) {
|
||||
if (hasNotPermissionForAnyOf(higherPermission))
|
||||
throw new NoAuthorizationException(authorizationMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean hasPermissionTo(final String permissionCode) {
|
||||
boolean match = false;
|
||||
for (Role role : this.roles) {
|
||||
|
||||
+3
-3
@@ -5,13 +5,13 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface AppUserWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER')")
|
||||
Long createUser(final UserCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER')")
|
||||
Long updateUser(final UserCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER')")
|
||||
void deleteUser(final Long userId);
|
||||
|
||||
// we dont put any permissions on this e.g. a user with no admin rights can change their own details (email, username, password etc).
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface RoleWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER')")
|
||||
Long createRole(RoleCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER')")
|
||||
Long updateRole(RoleCommand command);
|
||||
}
|
||||
Reference in New Issue
Block a user