-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: proper implementation for auditor access
- Loading branch information
1 parent
e0e6964
commit 48fbf31
Showing
2 changed files
with
5 additions
and
30 deletions.
There are no files selected for viewing
33 changes: 4 additions & 29 deletions
33
...ount-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/AuditorAccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,17 @@ | ||
package de.adorsys.ledgers.baam.db.domain; | ||
|
||
import jakarta.persistence.*; | ||
import java.util.logging.Logger; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Table; | ||
|
||
@Entity | ||
@Table(name = "auditor_access") | ||
public class AuditorAccess extends BankAccountAccess { | ||
private static final Logger logger = Logger.getLogger(AuditorAccess.class.getName()); | ||
|
||
// Constructor sets default values | ||
public AuditorAccess() { | ||
super(); | ||
this.setStatus(AccessStatus.ACTIVE); // By default, AuditorAccess is active | ||
this.setWeight(1.0); // Weight is always 1 for AuditorAccess | ||
logger.info("AuditorAccess created with default active status and weight of 1"); | ||
this.setWeight(1.0); // Weight is always 1 for Auditor Access | ||
} | ||
|
||
public boolean allowsAction(String action) { | ||
// Only allow read actions such as viewing transactions and balances | ||
return switch (action) { | ||
case "VIEW_ACCOUNT_BALANCES", "VIEW_TRANSACTION_HISTORY", "VIEW_ACCESS_LOGS" -> true; | ||
default -> false; // No modifications are allowed | ||
}; | ||
} | ||
|
||
// Overriding status management to ensure that AuditorAccess can be restricted or suspended | ||
public void suspendAccess() { | ||
this.setStatus(AccessStatus.SUSPENDED); | ||
logger.info("AuditorAccess has been suspended."); | ||
} | ||
|
||
public void activateAccess() { | ||
this.setStatus(AccessStatus.ACTIVE); | ||
logger.info("AuditorAccess has been reactivated."); | ||
} | ||
|
||
public void restrictAccess() { | ||
this.setStatus(AccessStatus.RESTRICTED); | ||
logger.info("AuditorAccess has been restricted."); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters