Package io.jmix.flowui.sys
Class UiAccessChecker
java.lang.Object
io.jmix.flowui.sys.UiAccessChecker
Class checks UI access permission.
-
Field Summary
Modifier and TypeFieldDescriptionprotected com.vaadin.flow.server.auth.AccessAnnotationChecker
protected AccessManager
protected ViewRegistry
-
Constructor Summary
ConstructorDescriptionUiAccessChecker
(com.vaadin.flow.server.auth.AccessAnnotationChecker accessAnnotationChecker, AccessManager accessManager, ViewRegistry viewRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkViewPermitted
(Class<?> target) Checks for access to the view.getControllerClass
(MenuItem menuItem) protected boolean
isMenuItemHasSecurityPermission
(MenuItem menuItem) boolean
isMenuPermitted
(MenuItem menuItem) FirstlyAccessAnnotationChecker
checks annotation constraints, if menu item is not permitted thenAccessManager
checks granted permissions.protected boolean
isSupportedView
(Class<?> targetView) protected boolean
isViewHasSecurityPermission
(Class<?> target) boolean
isViewPermitted
(Class<?> target) FirstlyAccessAnnotationChecker
checks annotation constraints, if view is not permitted thenAccessManager
checks granted permissions.boolean
The current method is used instead ofisViewPermitted(Class)
whenVaadinRequest
is not available.
-
Field Details
-
accessAnnotationChecker
protected com.vaadin.flow.server.auth.AccessAnnotationChecker accessAnnotationChecker -
accessManager
-
viewRegistry
-
-
Constructor Details
-
UiAccessChecker
public UiAccessChecker(@Nullable com.vaadin.flow.server.auth.AccessAnnotationChecker accessAnnotationChecker, AccessManager accessManager, ViewRegistry viewRegistry)
-
-
Method Details
-
isViewPermitted
FirstlyAccessAnnotationChecker
checks annotation constraints, if view is not permitted thenAccessManager
checks granted permissions.- Parameters:
target
- class to check- Returns:
true
if view is permitted
-
isViewPermitted
public boolean isViewPermitted(Class<?> target, Principal principal, Function<String, Boolean> roleChecker) The current method is used instead ofisViewPermitted(Class)
whenVaadinRequest
is not available.- See Also:
-
checkViewPermitted
Checks for access to the view. Throws exception if no access.- Parameters:
target
- class to check- Throws:
AccessDeniedException
- if the user does not have access to the view
-
isSupportedView
-
isViewHasSecurityPermission