public class BankAccount {
public void transfer(BigDecimal amount, BankAccount recipient) {
SecurityManager.hasPermission(this, Permission.TRANSFER, SecurityContext.getCurrentUser());
recipient.deposit(this.withdraw(amount));
}
public void closeOut() {
SecurityManager.hasPermission(this, Permission.CLOSE_OUT, SecurityContext.getCurrentUser());
this.open = false;
}
public void changeRates(BigDecimal newRate) {
SecurityManager.hasPermission(this, Permission.CHANGE_RATES, SecurityContext.getCurrentUser());
this.rate = newRate;
}
}
|