Interface PermissionType

  • All Known Implementing Classes:
    DotNamedPermissionType

    public interface PermissionType
    A PermissionType provides factory services for the creation of permission instances as well as services for controlling the access to Resource instances.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Permission createPermission​(String name, boolean granted)
      Creates a permission instance.
      Permission createPermission​(org.uberfire.security.Resource resource, org.uberfire.security.ResourceAction action, boolean granted)
      Creates a permission instance representing an action on a given resource..
      Permission createPermission​(org.uberfire.security.ResourceType resourceType, org.uberfire.security.ResourceAction action, boolean granted)
      Creates a permission instance representing a "global" action that can be applied to any resource instance (for instance, "edit an invoice") or an action that is not related to any specific instance (for instance, "create a new invoice")
      String getType()
      An string identifier that acts as a unique identifier for the permission type.
      String resolveResourceId​(Permission permission)
      Given a permission it tries to determine what is the resource the permission refers to.
      boolean supportsPermission​(String name)
      Checks if the given permission name is supported by this type.
    • Method Detail

      • getType

        String getType()
        An string identifier that acts as a unique identifier for the permission type.
        Returns:
        The permission type unique identifier
      • supportsPermission

        boolean supportsPermission​(String name)
        Checks if the given permission name is supported by this type. That means basically that such name does follow a specific nomenclature for the formatting of its permission names.
        Parameters:
        name - The permission name to check
        Returns:
        true is such permission is supported or false otherwise.
      • createPermission

        Permission createPermission​(String name,
                                    boolean granted)
        Creates a permission instance.
        Parameters:
        name - The name of the permission to create.
        granted - true=granted, false=denied
        Returns:
        A permission instance
      • createPermission

        Permission createPermission​(org.uberfire.security.ResourceType resourceType,
                                    org.uberfire.security.ResourceAction action,
                                    boolean granted)
        Creates a permission instance representing a "global" action that can be applied to any resource instance (for instance, "edit an invoice") or an action that is not related to any specific instance (for instance, "create a new invoice")
        Parameters:
        resourceType - The resource type
        action - The action to check. If null then an "access" permission is created. The term access refers to the ability to reach, read, view ... the resource, depending on the resource type.
        Returns:
        A permission instance
      • createPermission

        Permission createPermission​(org.uberfire.security.Resource resource,
                                    org.uberfire.security.ResourceAction action,
                                    boolean granted)
        Creates a permission instance representing an action on a given resource..
        Parameters:
        resource - The resource instance
        action - The action to check. If null then an "access" permission is created. The term access refers to the ability to reach, read, view ... the resource, depending on the resource type.
        Returns:
        A permission instance
      • resolveResourceId

        String resolveResourceId​(Permission permission)
        Given a permission it tries to determine what is the resource the permission refers to.

        The resolution mechanism works only if the permission instance was created by a previous call to createPermission(Resource, ResourceAction, boolean). In such case the identifier of the Resource instance is the value returned.

        Parameters:
        permission - The permission which resource id. has to be inferred.
        Returns:
        A resource id. or null if it can bot be inferred.