use hasAnyRole instead of hasRole expression when checking against multiple permissions.

This commit is contained in:
Keith Woodlock
2012-11-17 14:25:22 +00:00
parent 015400b08e
commit f73ef79add
6 changed files with 19 additions and 22 deletions
@@ -6,12 +6,12 @@ import org.springframework.security.access.prepost.PreAuthorize;
public interface CodeWritePlatformService { public interface CodeWritePlatformService {
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'CREATE_CODE')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'CREATE_CODE')")
Long createCode(final CodeCommand command); Long createCode(final CodeCommand command);
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'UPDATE_CODE)") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'UPDATE_CODE)")
Long updateCode(final CodeCommand command); Long updateCode(final CodeCommand command);
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')") @PreAuthorize(value = "hasAnyRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
EntityIdentifier deleteCode(Long codeId); EntityIdentifier deleteCode(Long codeId);
} }
@@ -11,13 +11,13 @@ import org.springframework.security.access.prepost.PreAuthorize;
public interface DepositAccountWritePlatformService { public interface DepositAccountWritePlatformService {
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_DEPOSITACCOUNT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_DEPOSITACCOUNT')")
EntityIdentifier createDepositAccount(DepositAccountCommand command); EntityIdentifier createDepositAccount(DepositAccountCommand command);
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'UPDATE_DEPOSITACCOUNT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'UPDATE_DEPOSITACCOUNT')")
EntityIdentifier updateDepositAccount(DepositAccountCommand command); EntityIdentifier updateDepositAccount(DepositAccountCommand command);
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'DELETE_DEPOSITACCOUNT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'DELETE_DEPOSITACCOUNT')")
EntityIdentifier deleteDepositAccount(Long productId); EntityIdentifier deleteDepositAccount(Long productId);
// NOTE - took out permissions relating to doing things with deposit // NOTE - took out permissions relating to doing things with deposit
@@ -45,14 +45,11 @@ public interface DepositAccountWritePlatformService {
*/ */
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'WITHDRAWAL_DEPOSITACCOUNT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'WITHDRAWAL_DEPOSITACCOUNT')")
EntityIdentifier withdrawDepositAccountMoney( EntityIdentifier withdrawDepositAccountMoney(DepositAccountWithdrawalCommand command);
DepositAccountWithdrawalCommand command);
@PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'INTEREST_DEPOSITACCOUNT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'INTEREST_DEPOSITACCOUNT')")
EntityIdentifier withdrawDepositAccountInterestMoney( EntityIdentifier withdrawDepositAccountInterestMoney(DepositAccountWithdrawInterestCommand command);
DepositAccountWithdrawInterestCommand command);
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'RENEW_DEPOSITACCOUNT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'RENEW_DEPOSITACCOUNT')")
EntityIdentifier renewDepositAccount(DepositAccountCommand command); EntityIdentifier renewDepositAccount(DepositAccountCommand command);
} }
@@ -6,9 +6,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
public interface SavingAccountWritePlatformService { public interface SavingAccountWritePlatformService {
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_SAVINGSACCOUNT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'CREATE_SAVINGSACCOUNT')")
EntityIdentifier createSavingAccount(SavingAccountCommand command); EntityIdentifier createSavingAccount(SavingAccountCommand command);
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'UPDATE_SAVINGSACCOUNT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'PORTFOLIO_MANAGEMENT_SUPER_USER', 'UPDATE_SAVINGSACCOUNT')")
EntityIdentifier updateSavingAccount(SavingAccountCommand command); EntityIdentifier updateSavingAccount(SavingAccountCommand command);
} }
@@ -6,13 +6,13 @@ import org.springframework.security.access.prepost.PreAuthorize;
public interface DepositProductWritePlatformService { public interface DepositProductWritePlatformService {
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'CREATE_DEPOSITPRODUCT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'CREATE_DEPOSITPRODUCT')")
EntityIdentifier createDepositProduct(DepositProductCommand command); EntityIdentifier createDepositProduct(DepositProductCommand command);
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'UPDATE_DEPOSITPRODUCT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'UPDATE_DEPOSITPRODUCT')")
EntityIdentifier updateDepositProduct(DepositProductCommand command); EntityIdentifier updateDepositProduct(DepositProductCommand command);
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'DELETE_DEPOSITPRODUCT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'DELETE_DEPOSITPRODUCT')")
EntityIdentifier deleteDepositProduct(Long productId); EntityIdentifier deleteDepositProduct(Long productId);
} }
@@ -6,12 +6,12 @@ import org.springframework.security.access.prepost.PreAuthorize;
public interface SavingProductWritePlatformService { public interface SavingProductWritePlatformService {
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'CREATE_SAVINGSPRODUCT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'CREATE_SAVINGSPRODUCT')")
EntityIdentifier createSavingProduct(SavingProductCommand command); EntityIdentifier createSavingProduct(SavingProductCommand command);
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'UPDATE_SAVINGSPRODUCT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'UPDATE_SAVINGSPRODUCT')")
EntityIdentifier updateSavingProduct(SavingProductCommand command); EntityIdentifier updateSavingProduct(SavingProductCommand command);
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'DELETE_SAVINGSPRODUCT')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'DELETE_SAVINGSPRODUCT')")
EntityIdentifier deleteSavingProduct(Long productId); EntityIdentifier deleteSavingProduct(Long productId);
} }
@@ -5,9 +5,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
public interface StaffWritePlatformService { public interface StaffWritePlatformService {
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'CREATE_STAFF')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'CREATE_STAFF')")
Long createStaff(final StaffCommand command); Long createStaff(final StaffCommand command);
@PreAuthorize(value = "hasRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'UPDATE_STAFF')") @PreAuthorize(value = "hasAnyRole('ALL_FUNCTIONS', 'ORGANISATION_ADMINISTRATION_SUPER_USER', 'UPDATE_STAFF')")
Long updateStaff(final StaffCommand command); Long updateStaff(final StaffCommand command);
} }