Search in sources :

Example 1 with Enabled

use of eu.bcvsolutions.idm.core.security.api.domain.Enabled in project CzechIdMng by bcvsolutions.

the class DefaultEnabledEvaluator method isEnabled.

/**
 * Returns true, if given class is enabled (or does not have enabled annotation defined).
 *
 * @param bean service, manager etc.
 * @return
 */
@Override
public boolean isEnabled(Class<?> clazz) {
    Assert.notNull(clazz, "Class is required.");
    // 
    Enabled enabled = clazz.getAnnotation(Enabled.class);
    if (enabled == null) {
        // bean is enabled
        return true;
    }
    return isEnabled(enabled);
}
Also used : Enabled(eu.bcvsolutions.idm.core.security.api.domain.Enabled)

Example 2 with Enabled

use of eu.bcvsolutions.idm.core.security.api.domain.Enabled in project CzechIdMng by bcvsolutions.

the class DefaultEnabledEvaluatorUnitTest method testEmptyAsTrue.

/**
 * Empty annotation will be ignored
 */
@Test
public void testEmptyAsTrue() {
    // no exception occurs
    Enabled enabled = prepareAnnotation(null, null, false);
    evaluator.checkEnabled(enabled);
    assertTrue(evaluator.isEnabled(enabled));
}
Also used : Enabled(eu.bcvsolutions.idm.core.security.api.domain.Enabled) AbstractVerifiableUnitTest(eu.bcvsolutions.idm.test.api.AbstractVerifiableUnitTest) Test(org.junit.Test)

Aggregations

Enabled (eu.bcvsolutions.idm.core.security.api.domain.Enabled)2 AbstractVerifiableUnitTest (eu.bcvsolutions.idm.test.api.AbstractVerifiableUnitTest)1 Test (org.junit.Test)1