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.ChargeReadPlatformService;
|
||||||
import org.mifosng.platform.charge.service.ChargeWritePlatformService;
|
import org.mifosng.platform.charge.service.ChargeWritePlatformService;
|
||||||
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
|
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
|
||||||
|
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;
|
||||||
@@ -45,11 +46,21 @@ public class ChargesApiResource {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PortfolioApiJsonSerializerService apiJsonSerializerService;
|
private PortfolioApiJsonSerializerService apiJsonSerializerService;
|
||||||
|
|
||||||
|
private final String entityType = "CHARGE";
|
||||||
|
private final PlatformSecurityContext context;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ChargesApiResource(final PlatformSecurityContext context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Consumes({MediaType.APPLICATION_JSON})
|
@Consumes({MediaType.APPLICATION_JSON})
|
||||||
@Produces({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
public String retrieveAllCharges(@Context final UriInfo uriInfo){
|
public String retrieveAllCharges(@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());
|
||||||
|
|
||||||
@@ -64,6 +75,8 @@ public class ChargesApiResource {
|
|||||||
@Produces({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
public String retrieveCharge(@PathParam("chargeId") final Long chargeId, @Context final UriInfo uriInfo){
|
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 Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||||
@@ -84,6 +97,8 @@ public class ChargesApiResource {
|
|||||||
@Produces({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
public String retrieveNewChargeDetails(@Context final UriInfo uriInfo) {
|
public String retrieveNewChargeDetails(@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());
|
||||||
|
|||||||
+15
@@ -28,6 +28,7 @@ import org.mifosng.platform.client.service.ClientReadPlatformService;
|
|||||||
import org.mifosng.platform.client.service.ClientWritePlatformService;
|
import org.mifosng.platform.client.service.ClientWritePlatformService;
|
||||||
import org.mifosng.platform.exceptions.DuplicateClientIdentifierException;
|
import org.mifosng.platform.exceptions.DuplicateClientIdentifierException;
|
||||||
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
|
import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
|
||||||
|
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;
|
||||||
@@ -53,12 +54,22 @@ public class ClientIdentifiersApiResource {
|
|||||||
Arrays.asList("id", "clientId", "documentTypeId", "description",
|
Arrays.asList("id", "clientId", "documentTypeId", "description",
|
||||||
"documentKey", "documentTypeName"));
|
"documentKey", "documentTypeName"));
|
||||||
|
|
||||||
|
private final String entityType = "CLIENTIDENTIFIER";
|
||||||
|
private final PlatformSecurityContext context;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ClientIdentifiersApiResource(final PlatformSecurityContext context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String retrieveAllClientIdentifiers(@Context final UriInfo uriInfo,
|
public String retrieveAllClientIdentifiers(@Context final UriInfo uriInfo,
|
||||||
@PathParam("clientId") final Long clientId) {
|
@PathParam("clientId") final Long clientId) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission(entityType);
|
||||||
|
|
||||||
Set<String> responseParameters = ApiParameterHelper
|
Set<String> responseParameters = ApiParameterHelper
|
||||||
.extractFieldsForResponseIfProvided(uriInfo
|
.extractFieldsForResponseIfProvided(uriInfo
|
||||||
.getQueryParameters());
|
.getQueryParameters());
|
||||||
@@ -82,6 +93,8 @@ public class ClientIdentifiersApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String newClientDetails(@Context final UriInfo uriInfo) {
|
public String newClientDetails(@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission(entityType);
|
||||||
|
|
||||||
Set<String> responseParameters = ApiParameterHelper
|
Set<String> responseParameters = ApiParameterHelper
|
||||||
.extractFieldsForResponseIfProvided(uriInfo
|
.extractFieldsForResponseIfProvided(uriInfo
|
||||||
.getQueryParameters());
|
.getQueryParameters());
|
||||||
@@ -132,6 +145,8 @@ public class ClientIdentifiersApiResource {
|
|||||||
@PathParam("identifierId") final Long clientIdentifierId,
|
@PathParam("identifierId") final Long clientIdentifierId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission(entityType);
|
||||||
|
|
||||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
if (responseParameters.isEmpty()) {
|
if (responseParameters.isEmpty()) {
|
||||||
responseParameters.addAll(typicalResponseParameters);
|
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.PortfolioMakerCheckerReadPlatformService;
|
||||||
import org.mifosng.platform.makerchecker.service.PortfolioMakerCheckerWriteService;
|
import org.mifosng.platform.makerchecker.service.PortfolioMakerCheckerWriteService;
|
||||||
import org.mifosng.platform.organisation.service.OfficeReadPlatformService;
|
import org.mifosng.platform.organisation.service.OfficeReadPlatformService;
|
||||||
|
import org.mifosng.platform.security.PlatformSecurityContext;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -84,6 +85,13 @@ public class ClientsApiResource {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PortfolioMakerCheckerReadPlatformService makerCheckerReadPlatformService;
|
private PortfolioMakerCheckerReadPlatformService makerCheckerReadPlatformService;
|
||||||
|
|
||||||
|
private final PlatformSecurityContext context;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ClientsApiResource(final PlatformSecurityContext context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Consumes({MediaType.APPLICATION_JSON})
|
@Consumes({MediaType.APPLICATION_JSON})
|
||||||
@Produces({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
@@ -96,6 +104,8 @@ public class ClientsApiResource {
|
|||||||
@QueryParam("lastName") final String lastName,
|
@QueryParam("lastName") final String lastName,
|
||||||
@QueryParam("underHierarchy") final String hierarchy) {
|
@QueryParam("underHierarchy") final String hierarchy) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("CLIENT");
|
||||||
|
|
||||||
final String extraCriteria = getClientCriteria(sqlSearch, officeId, externalId, displayName, firstName, lastName, hierarchy);
|
final String extraCriteria = getClientCriteria(sqlSearch, officeId, externalId, displayName, firstName, lastName, hierarchy);
|
||||||
|
|
||||||
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
|
||||||
@@ -158,6 +168,8 @@ public class ClientsApiResource {
|
|||||||
@PathParam("clientId") final Long clientId,
|
@PathParam("clientId") final Long clientId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("CLIENT");
|
||||||
|
|
||||||
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());
|
||||||
@@ -177,6 +189,8 @@ public class ClientsApiResource {
|
|||||||
@Produces({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
public String newClientDetails(@Context final UriInfo uriInfo) {
|
public String newClientDetails(@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("CLIENT");
|
||||||
|
|
||||||
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 Long makerCheckerId = ApiParameterHelper.makerCheckerId(uriInfo.getQueryParameters());
|
final Long makerCheckerId = ApiParameterHelper.makerCheckerId(uriInfo.getQueryParameters());
|
||||||
@@ -246,6 +260,8 @@ public class ClientsApiResource {
|
|||||||
public String retrieveClientAccount(@PathParam("clientId") final Long clientId,
|
public String retrieveClientAccount(@PathParam("clientId") final Long clientId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("CLIENT");
|
||||||
|
|
||||||
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", "activeLoanCount", "closedLoanCount",
|
"anyLoanCount", "pendingApprovalLoanCount", "awaitingDisbursalLoanCount", "activeLoanCount", "closedLoanCount",
|
||||||
@@ -271,6 +287,8 @@ public class ClientsApiResource {
|
|||||||
@Produces({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
||||||
public String retrieveAllClientNotes(@PathParam("clientId") final Long clientId, @Context final UriInfo uriInfo) {
|
public String retrieveAllClientNotes(@PathParam("clientId") final Long clientId, @Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("CLIENTNOTE");
|
||||||
|
|
||||||
Set<String> typicalResponseParameters = new HashSet<String>(
|
Set<String> typicalResponseParameters = new HashSet<String>(
|
||||||
Arrays.asList("id", "clientId", "loanId", "loanTransactionId", "noteType", "note", "createdById", "createdByUsername",
|
Arrays.asList("id", "clientId", "loanId", "loanTransactionId", "noteType", "note", "createdById", "createdByUsername",
|
||||||
"createdOn", "updatedById", "updatedByUsername", "updatedOn")
|
"createdOn", "updatedById", "updatedByUsername", "updatedOn")
|
||||||
@@ -309,6 +327,8 @@ public class ClientsApiResource {
|
|||||||
@PathParam("noteId") final Long noteId,
|
@PathParam("noteId") final Long noteId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("CLIENTNOTE");
|
||||||
|
|
||||||
Set<String> typicalResponseParameters = new HashSet<String>(
|
Set<String> typicalResponseParameters = new HashSet<String>(
|
||||||
Arrays.asList("id", "clientId", "loanId", "loanTransactionId", "noteType", "note", "createdById", "createdByUsername",
|
Arrays.asList("id", "clientId", "loanId", "loanTransactionId", "noteType", "note", "createdById", "createdByUsername",
|
||||||
"createdOn", "updatedById", "updatedByUsername", "updatedOn")
|
"createdOn", "updatedById", "updatedByUsername", "updatedOn")
|
||||||
@@ -415,6 +435,8 @@ public class ClientsApiResource {
|
|||||||
public Response retrieveClientImage(
|
public Response retrieveClientImage(
|
||||||
@PathParam("clientId") final Long clientId) {
|
@PathParam("clientId") final Long clientId) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission("CLIENTIMAGE");
|
||||||
|
|
||||||
final ClientData clientData = this.clientReadPlatformService.retrieveIndividualClient(clientId);
|
final ClientData clientData = this.clientReadPlatformService.retrieveIndividualClient(clientId);
|
||||||
//validate if client does not exist or image key is null
|
//validate if client does not exist or image key is null
|
||||||
if(clientData == null){
|
if(clientData == null){
|
||||||
|
|||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
package org.mifosng.platform.charge.service;
|
package org.mifosng.platform.charge.service;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.mifosng.platform.api.data.ChargeData;
|
import org.mifosng.platform.api.data.ChargeData;
|
||||||
import org.mifosng.platform.api.data.LoanChargeData;
|
import org.mifosng.platform.api.data.LoanChargeData;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public interface ChargeReadPlatformService {
|
public interface ChargeReadPlatformService {
|
||||||
|
|
||||||
Collection<ChargeData> retrieveAllCharges();
|
Collection<ChargeData> retrieveAllCharges();
|
||||||
|
|||||||
+3
-3
@@ -5,12 +5,12 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface ChargeWritePlatformService {
|
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);
|
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);
|
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);
|
Long deleteCharge(final Long chargeId);
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-21
@@ -11,36 +11,36 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface ClientWritePlatformService {
|
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);
|
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);
|
EntityIdentifier updateClientDetails(ClientCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER', 'DELETE_CLIENT')")
|
||||||
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')")
|
|
||||||
EntityIdentifier deleteClient(Long clientId);
|
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);
|
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);
|
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);
|
EntityIdentifier deleteClientIdentifier(Long clientIdentifierId);
|
||||||
}
|
}
|
||||||
+3
-3
@@ -8,14 +8,14 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface DocumentWritePlatformService {
|
public interface DocumentWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||||
Long createDocument(DocumentCommand documentCommand, InputStream inputStream);
|
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,
|
EntityIdentifier updateDocument(DocumentCommand documentCommand,
|
||||||
InputStream inputStream);
|
InputStream inputStream);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||||
EntityIdentifier deleteDocument(DocumentCommand documentCommand);
|
EntityIdentifier deleteDocument(DocumentCommand documentCommand);
|
||||||
|
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,9 +5,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface FundWritePlatformService {
|
public interface FundWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
Long createFund(final FundCommand command);
|
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);
|
Long updateFund(final FundCommand command);
|
||||||
}
|
}
|
||||||
+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_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||||
EntityIdentifier createGroup(GroupCommand command);
|
EntityIdentifier createGroup(GroupCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||||
EntityIdentifier updateGroup(GroupCommand command);
|
EntityIdentifier updateGroup(GroupCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||||
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_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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
public EntityIdentifier makeLoanRepayment(LoanTransactionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||||
EntityIdentifier adjustLoanTransaction(AdjustLoanTransactionCommand command);
|
EntityIdentifier adjustLoanTransaction(AdjustLoanTransactionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||||
EntityIdentifier waiveInterestOnLoan(LoanTransactionCommand command);
|
EntityIdentifier waiveInterestOnLoan(LoanTransactionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||||
EntityIdentifier writeOff(LoanTransactionCommand command);
|
EntityIdentifier writeOff(LoanTransactionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||||
EntityIdentifier closeLoan(LoanTransactionCommand command);
|
EntityIdentifier closeLoan(LoanTransactionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||||
EntityIdentifier closeAsRescheduled(LoanTransactionCommand command);
|
EntityIdentifier closeAsRescheduled(LoanTransactionCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||||
EntityIdentifier addLoanCharge(LoanChargeCommand command);
|
EntityIdentifier addLoanCharge(LoanChargeCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||||
EntityIdentifier updateLoanCharge(LoanChargeCommand command);
|
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);
|
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);
|
EntityIdentifier waiveLoanCharge(LoanChargeCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER')")
|
||||||
EntityIdentifier bulkLoanReassignment(final BulkLoanReassignmentCommand command);
|
EntityIdentifier bulkLoanReassignment(final BulkLoanReassignmentCommand command);
|
||||||
}
|
}
|
||||||
+2
-2
@@ -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("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.");
|
throw new NoAuthorizationException("Cannot add backdated loan.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
|
|
||||||
// TODO - fix up permissions for loan modification
|
// TODO - fix up permissions for loan modification
|
||||||
final LocalDate submittedOn = command.getSubmittedOnDate();
|
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.");
|
throw new NoAuthorizationException("Cannot modify backdated loan.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -6,9 +6,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface LoanProductWritePlatformService {
|
public interface LoanProductWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier createLoanProduct(LoanProductCommand command);
|
EntityIdentifier createLoanProduct(LoanProductCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier updateLoanProduct(LoanProductCommand command);
|
EntityIdentifier updateLoanProduct(LoanProductCommand command);
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,9 +5,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface CodeWritePlatformService {
|
public interface CodeWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
Long createCode(final CodeCommand command);
|
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);
|
Long updateCode(final CodeCommand command);
|
||||||
}
|
}
|
||||||
+3
-3
@@ -6,12 +6,12 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface OfficeWritePlatformService {
|
public interface OfficeWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
Long createOffice(final OfficeCommand command);
|
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);
|
Long updateOffice(final OfficeCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
Long externalBranchMoneyTransfer(BranchMoneyTransferCommand command);
|
Long externalBranchMoneyTransfer(BranchMoneyTransferCommand command);
|
||||||
}
|
}
|
||||||
+11
-11
@@ -11,36 +11,36 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface DepositAccountWritePlatformService {
|
public interface DepositAccountWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier createDepositAccount(DepositAccountCommand command);
|
EntityIdentifier createDepositAccount(DepositAccountCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier deleteDepositAccount(Long productId);
|
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);
|
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);
|
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);
|
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);
|
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);*/
|
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);
|
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);
|
EntityIdentifier withdrawDepositAccountInterestMoney(DepositAccountWithdrawInterestCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier renewDepositAccount(DepositAccountCommand command);
|
EntityIdentifier renewDepositAccount(DepositAccountCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier updateDepositAccount(DepositAccountCommand command);
|
EntityIdentifier updateDepositAccount(DepositAccountCommand command);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -6,9 +6,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface SavingAccountWritePlatformService {
|
public interface SavingAccountWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier createSavingAccount(SavingAccountCommand command);
|
EntityIdentifier createSavingAccount(SavingAccountCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier updateSavingAccount(SavingAccountCommand command);
|
EntityIdentifier updateSavingAccount(SavingAccountCommand command);
|
||||||
}
|
}
|
||||||
+3
-3
@@ -6,13 +6,13 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface DepositProductWritePlatformService {
|
public interface DepositProductWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier createDepositProduct(DepositProductCommand command);
|
EntityIdentifier createDepositProduct(DepositProductCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier updateDepositProduct(DepositProductCommand command);
|
EntityIdentifier updateDepositProduct(DepositProductCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier deleteDepositProduct(Long productId);
|
EntityIdentifier deleteDepositProduct(Long productId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -5,12 +5,12 @@ import org.mifosng.platform.api.data.EntityIdentifier;
|
|||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
|
||||||
public interface SavingProductWritePlatformService {
|
public interface SavingProductWritePlatformService {
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier createSavingProduct(SavingProductCommand command);
|
EntityIdentifier createSavingProduct(SavingProductCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier updateSavingProduct(SavingProductCommand command);
|
EntityIdentifier updateSavingProduct(SavingProductCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
EntityIdentifier deleteSavingProduct(Long productId);
|
EntityIdentifier deleteSavingProduct(Long productId);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -5,9 +5,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface StaffWritePlatformService {
|
public interface StaffWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
Long createStaff(final StaffCommand command);
|
Long createStaff(final StaffCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER')")
|
||||||
Long updateStaff(final StaffCommand command);
|
Long updateStaff(final StaffCommand command);
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@ import javax.persistence.Table;
|
|||||||
import javax.persistence.UniqueConstraint;
|
import javax.persistence.UniqueConstraint;
|
||||||
|
|
||||||
import org.mifosng.platform.api.commands.UserCommand;
|
import org.mifosng.platform.api.commands.UserCommand;
|
||||||
|
import org.mifosng.platform.exceptions.NoAuthorizationException;
|
||||||
import org.mifosng.platform.infrastructure.AbstractAuditableCustom;
|
import org.mifosng.platform.infrastructure.AbstractAuditableCustom;
|
||||||
import org.mifosng.platform.infrastructure.PlatformUser;
|
import org.mifosng.platform.infrastructure.PlatformUser;
|
||||||
import org.mifosng.platform.organisation.domain.Office;
|
import org.mifosng.platform.organisation.domain.Office;
|
||||||
@@ -235,29 +236,28 @@ public class AppUser extends AbstractAuditableCustom<AppUser, Long> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canNotApproveLoanInPast() {
|
public boolean canNotApproveLoanInPast() {
|
||||||
return hasNotPermissionForAnyOf("CAN_APPROVE_LOAN_IN_THE_PAST_ROLE",
|
return hasNotPermissionForAnyOf("APPROVEINPAST_LOAN",
|
||||||
"PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE");
|
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canNotRejectLoanInPast() {
|
public boolean canNotRejectLoanInPast() {
|
||||||
return hasNotPermissionForAnyOf("CAN_REJECT_LOAN_IN_THE_PAST_ROLE",
|
return hasNotPermissionForAnyOf("REJECTINPAST_LOAN",
|
||||||
"PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE");
|
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canNotWithdrawByClientLoanInPast() {
|
public boolean canNotWithdrawByClientLoanInPast() {
|
||||||
return hasNotPermissionForAnyOf("CAN_WITHDRAW_LOAN_IN_THE_PAST_ROLE",
|
return hasNotPermissionForAnyOf("WITHDRAWINPAST_LOAN",
|
||||||
"PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE");
|
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canNotDisburseLoanInPast() {
|
public boolean canNotDisburseLoanInPast() {
|
||||||
return hasNotPermissionForAnyOf("CAN_DISBURSE_LOAN_IN_THE_PAST_ROLE",
|
return hasNotPermissionForAnyOf("DISBURSEINPAST_LOAN",
|
||||||
"PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE");
|
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canNotMakeRepaymentOnLoanInPast() {
|
public boolean canNotMakeRepaymentOnLoanInPast() {
|
||||||
return hasNotPermissionForAnyOf(
|
return hasNotPermissionForAnyOf("REPAYMENTINPAST_LOAN",
|
||||||
"CAN_MAKE_LOAN_REPAYMENT_IN_THE_PAST_ROLE",
|
"PORTFOLIO_MANAGEMENT_SUPER_USER");
|
||||||
"PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasNotPermissionForReport(String reportName) {
|
public boolean hasNotPermissionForReport(String reportName) {
|
||||||
@@ -321,6 +321,35 @@ public class AppUser extends AbstractAuditableCustom<AppUser, Long> implements
|
|||||||
return hasNotPermission;
|
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) {
|
private boolean hasPermissionTo(final String permissionCode) {
|
||||||
boolean match = false;
|
boolean match = false;
|
||||||
for (Role role : this.roles) {
|
for (Role role : this.roles) {
|
||||||
|
|||||||
+3
-3
@@ -5,13 +5,13 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
|
|
||||||
public interface AppUserWritePlatformService {
|
public interface AppUserWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER')")
|
||||||
Long createUser(final UserCommand command);
|
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);
|
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);
|
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).
|
// 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 {
|
public interface RoleWritePlatformService {
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER')")
|
||||||
Long createRole(RoleCommand command);
|
Long createRole(RoleCommand command);
|
||||||
|
|
||||||
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER_ROLE')")
|
@PreAuthorize(value = "hasRole('USER_ADMINISTRATION_SUPER_USER')")
|
||||||
Long updateRole(RoleCommand command);
|
Long updateRole(RoleCommand command);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user