Search in sources :

Example 1 with AuthorizationAction

use of com.evolveum.midpoint.web.application.AuthorizationAction in project midpoint by Evolveum.

the class SecurityUtils method isPageAuthorized.

public static boolean isPageAuthorized(Class page) {
    if (page == null) {
        return false;
    }
    PageDescriptor descriptor = (PageDescriptor) page.getAnnotation(PageDescriptor.class);
    if (descriptor == null) {
        return false;
    }
    AuthorizationAction[] actions = descriptor.action();
    List<String> list = new ArrayList<>();
    if (actions != null) {
        for (AuthorizationAction action : actions) {
            list.add(action.actionUri());
        }
    }
    return WebComponentUtil.isAuthorized(list.toArray(new String[list.size()]));
}
Also used : PageDescriptor(com.evolveum.midpoint.web.application.PageDescriptor) AuthorizationAction(com.evolveum.midpoint.web.application.AuthorizationAction) ArrayList(java.util.ArrayList)

Aggregations

AuthorizationAction (com.evolveum.midpoint.web.application.AuthorizationAction)1 PageDescriptor (com.evolveum.midpoint.web.application.PageDescriptor)1 ArrayList (java.util.ArrayList)1