Search in sources :

Example 1 with UserRoleLoginException

use of org.codelibs.fess.exception.UserRoleLoginException in project fess by codelibs.

the class FessLoginAssist method checkPermission.

@Override
protected void checkPermission(final LoginHandlingResource resource) throws LoginRequiredException {
    if (FessAdminAction.class.isAssignableFrom(resource.getActionClass())) {
        getSavedUserBean().ifPresent(user -> {
            if (user.hasRoles(fessConfig.getAuthenticationAdminRolesAsArray())) {
                return;
            }
            final Method executeMethod = resource.getExecuteMethod();
            final Secured secured = executeMethod.getAnnotation(Secured.class);
            if (secured != null && user.hasRoles(secured.value())) {
                return;
            }
            throw new UserRoleLoginException(RootAction.class);
        });
    }
}
Also used : Secured(org.codelibs.fess.annotation.Secured) UserRoleLoginException(org.codelibs.fess.exception.UserRoleLoginException) Method(java.lang.reflect.Method)

Aggregations

Method (java.lang.reflect.Method)1 Secured (org.codelibs.fess.annotation.Secured)1 UserRoleLoginException (org.codelibs.fess.exception.UserRoleLoginException)1