Interface UiComponentPolicyApplier

All Known Implementing Classes:
DefaultUiComponentPolicyApplier

@NullMarked public interface UiComponentPolicyApplier
Interface for applying UI component policies assigned to the current user to a given view.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    applyUiComponentPolicies(com.vaadin.flow.component.Component component)
    Applies UI component policies assigned to the current user to the given component and its children.
    void
    Applies UI component policies assigned to the current user to the given view.
    default void
    applyUiComponentPolicies(View<?> view, com.vaadin.flow.component.Component component)
    Applies UI component policies assigned to the current user to the given component and its children within the given view.
  • Method Details

    • applyUiComponentPolicies

      void applyUiComponentPolicies(View<?> view)
      Applies UI component policies assigned to the current user to the given view.
      Parameters:
      view - view the view to which the security policies should be applied
    • applyUiComponentPolicies

      default void applyUiComponentPolicies(com.vaadin.flow.component.Component component)
      Applies UI component policies assigned to the current user to the given component and its children. Intended for content created after the view has been opened, for example the content of a lazy tab or components added programmatically.

      The component must be reachable from its view through the component tree: the policies address components by a path relative to the view, so an owner has to be found for it. Nothing is applied otherwise.

      The content of a tab is the notable exception, because a JmixTabSheet keeps only the content of the selected tab in the tree, and attaches even that before the client response rather than when it is added. Use applyUiComponentPolicies(View, Component) for content installed into a tab.

      Parameters:
      component - the component to apply the policies to
    • applyUiComponentPolicies

      default void applyUiComponentPolicies(View<?> view, com.vaadin.flow.component.Component component)
      Applies UI component policies assigned to the current user to the given component and its children within the given view.

      Unlike applyUiComponentPolicies(Component), the component does not have to be reachable from the view through the component tree. That matters for the content of a tab: a JmixTabSheet keeps only the content of the selected tab in the tree, so content installed into a tab that is not open can only be handed over this way. The default implementation applies the policies to the whole view, which is correct but wider than asked: an implementation that supports subtrees is expected to override it.

      Parameters:
      view - the view the component belongs to
      component - the component to apply the policies to