Class DelegatedAccessAdapter

  • All Implemented Interfaces:
    Function<Map<String,​Object>,​Boolean>

    public class DelegatedAccessAdapter
    extends Object
    implements Function<Map<String,​Object>,​Boolean>
    A default adapter for delegated access checks.

    This class implements the OOTB Java Function interface to allow it to be shared across plugins without relying on reflection.

    The input contains various arguments for the access check. In particular, it contains an ‘action’ and an optional ‘name’. These will be concatenated with a ‘:’ to form the purpose string. For example, ‘view:field:myField’, where ‘view:field’ is the action and ‘myField’ is the name.

    Certain actions can bypass the DA checks, deferring to a default ThingAccessUtils checks. This is particularly useful if the particular thing has good inline configuration that doesn’t need to be shared or nested.

    The output is a Boolean indicating whether the access is DENIED - i.e., true = deny, false = allow.

    • Method Detail

      • apply

        public Boolean apply​(Map<String,​Object> input)
        Applies the delegated access check to the input.

        The input is expected to contain the configuration arguments in DelegatedAccessConstants. The output indicates whether the access check DENIES access (true = deny).

        Specified by:
        apply in interface Function<Map<String,​Object>,​Boolean>
        Parameters:
        input - the map containing configuration arguments
        Returns:
        true if the access check is DENIED, false if the access check is ALLOWED