Class DotNamedPermissionType

    • Constructor Detail

      • DotNamedPermissionType

        public DotNamedPermissionType​(String type)
    • Method Detail

      • getType

        public String getType()
        Description copied from interface: PermissionType
        An string identifier that acts as a unique identifier for the permission type.
        Specified by:
        getType in interface PermissionType
        Returns:
        The permission type unique identifier
      • supportsPermission

        public boolean supportsPermission​(String name)
        Description copied from interface: PermissionType
        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.
        Specified by:
        supportsPermission in interface PermissionType
        Parameters:
        name - The permission name to check
        Returns:
        true is such permission is supported or false otherwise.
      • createPermission

        public Permission createPermission​(String name,
                                           boolean granted)
        Description copied from interface: PermissionType
        Creates a permission instance.
        Specified by:
        createPermission in interface PermissionType
        Parameters:
        name - The name of the permission to create.
        granted - true=granted, false=denied
        Returns:
        A permission instance
      • createPermission

        public Permission createPermission​(org.uberfire.security.ResourceType resourceType,
                                           org.uberfire.security.ResourceAction action,
                                           boolean granted)
        Description copied from interface: PermissionType
        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")
        Specified by:
        createPermission in interface PermissionType
        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

        public Permission createPermission​(org.uberfire.security.Resource resource,
                                           org.uberfire.security.ResourceAction action,
                                           boolean granted)
        Description copied from interface: PermissionType
        Creates a permission instance representing an action on a given resource..
        Specified by:
        createPermission in interface PermissionType
        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

        public String resolveResourceId​(Permission permission)
        Description copied from interface: PermissionType
        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 PermissionType.createPermission(Resource, ResourceAction, boolean). In such case the identifier of the Resource instance is the value returned.

        Specified by:
        resolveResourceId in interface PermissionType
        Parameters:
        permission - The permission which resource id. has to be inferred.
        Returns:
        A resource id. or null if it can bot be inferred.
      • buildPermissionName

        protected String buildPermissionName​(org.uberfire.security.ResourceType type,
                                             String action,
                                             String resourceId)