use of gov.ca.cwds.security.realm.PerryAccount in project api-core by ca-cwds.
the class BaseDocToolRulesTest method getPrincipal.
private static PerryAccount getPrincipal(String privilege) {
PerryAccount perryAccount = new PerryAccount();
Set<String> privileges = new HashSet<>();
privileges.add(privilege);
perryAccount.setPrivileges(privileges);
return perryAccount;
}
use of gov.ca.cwds.security.realm.PerryAccount in project api-core by ca-cwds.
the class DataAccessServiceBase method update.
@Override
public T update(P entityAwareDTO) throws DataAccessServicesException, DroolsException {
try {
DataAccessBundle<P> dataAccessBundle = new DataAccessBundle<>(entityAwareDTO);
updateLifecycle.beforeDataProcessing(dataAccessBundle);
PerryAccount perryAccount = PrincipalUtils.getPrincipal();
updateLifecycle.dataProcessing(dataAccessBundle, perryAccount);
updateLifecycle.afterDataProcessing(dataAccessBundle);
updateLifecycle.beforeBusinessValidation(dataAccessBundle);
updateLifecycle.businessValidation(dataAccessBundle, perryAccount);
updateLifecycle.afterBusinessValidation(dataAccessBundle);
T t = crudDao.update(entityAwareDTO.getEntity());
updateLifecycle.afterStore(dataAccessBundle);
return t;
} catch (DroolsException e) {
throw new DataAccessServicesException(e);
}
}
use of gov.ca.cwds.security.realm.PerryAccount in project api-core by ca-cwds.
the class DataAccessServiceBase method create.
@Override
public T create(P entityAwareDTO) throws DataAccessServicesException {
try {
DataAccessBundle<P> dataAccessBundle = new DataAccessBundle<>(entityAwareDTO);
createLifecycle.beforeDataProcessing(dataAccessBundle);
PerryAccount perryAccount = PrincipalUtils.getPrincipal();
createLifecycle.dataProcessing(dataAccessBundle, perryAccount);
createLifecycle.afterDataProcessing(dataAccessBundle);
createLifecycle.beforeBusinessValidation(dataAccessBundle);
createLifecycle.businessValidation(dataAccessBundle, perryAccount);
createLifecycle.afterBusinessValidation(dataAccessBundle);
T t = crudDao.create(entityAwareDTO.getEntity());
createLifecycle.afterStore(dataAccessBundle);
return t;
} catch (DroolsException e) {
throw new DataAccessServicesException(e);
}
}
use of gov.ca.cwds.security.realm.PerryAccount in project api-core by ca-cwds.
the class ClientAbstractReadAuthorizerTest method initUserAccount.
private void initUserAccount(String userCountyCwsCode, String userCountyName, String... privileges) {
final PerryAccount perryAccount = initPerryAccountWithPrivileges(privileges);
perryAccount.setCountyCwsCode(userCountyCwsCode);
perryAccount.setCountyName(userCountyName);
mockStatic(PerrySubject.class);
when(PerrySubject.getPerryAccount()).thenReturn(perryAccount);
}
use of gov.ca.cwds.security.realm.PerryAccount in project api-core by ca-cwds.
the class PlacementHomeCreateAuthorizerTest method checkInstance_returnFalse_whenPerryPrivilegesAreNull.
@Test
public void checkInstance_returnFalse_whenPerryPrivilegesAreNull() {
final PerryAccount perryAccount = new PerryAccount();
final boolean expectedResult = false;
checkInstance_returnExpected_withPreparedPerryAccount(perryAccount, expectedResult);
}
Aggregations