Interface PermissionsEngine

    • Method Detail

      • fallbacks

        SubjectTypeCollection<SubjectType<?>> fallbacks()
        Subjects holding data that will be applied to subjects of each type when no other data is available.
        Returns:
        the fallback subject type
        Since:
        2.0.0
      • registerSubjectTypes

        void registerSubjectTypes​(SubjectType<?>... types)
        Register subject types with the engine.
        Parameters:
        types - the types to register
        Since:
        2.0.0
      • subjects

        <I> SubjectTypeCollection<I> subjects​(SubjectType<I> type)
        Get a subject type by name.

        If this subject type has not been seen before, it will be registered.

        Parameters:
        type - the type identifier
        Returns:
        a subject type instance, never null
        Since:
        2.0.0
      • subject

        default <I> CompletableFuture<CalculatedSubjectsubject​(SubjectRef<I> reference)
        Resolve a subject from a reference.
        Type Parameters:
        I - identifier type
        Parameters:
        reference - the subject reference to resolve
        Returns:
        a future providing the resolved subject
        Since:
        2.0.0
      • ladders

        RankLadderCollection ladders()
        Get a cache for rank ladders known by the engine.

        Rank ladders allow for promotion and demotion of a subject among a set of ranked parents.

        Returns:
        the ladder cache
        Since:
        2.0.0
      • doBulkOperation

        <V> CompletableFuture<V> doBulkOperation​(Function<DataStore,​CompletableFuture<V>> actor)
        Perform a low-level bulk operation.

        This can be used for transforming subjects if the subject type definition changes, and any large data changes that require information that may no longer be valid with current subject type options.

        When possible, higher-level bulk query API (not yet written) should be used instead.

        Type Parameters:
        V - the result type
        Parameters:
        actor - the action to perform
        Returns:
        a future completing with the result of the action
      • contextInheritance

        CompletableFuture<ContextInheritancecontextInheritance​(@Nullable Consumer<ContextInheritance> listener)
        Get context inheritance data.

        The result of the future is immutable -- to take effect, the object returned by any update methods in ContextInheritance must be passed to contextInheritance(ContextInheritance). It follows that anybody else's changes will not appear in the returned inheritance object -- so if updates are desired providing a callback function is important.

        Parameters:
        listener - A callback function that will be triggered whenever there is a change to the context inheritance
        Returns:
        A future providing the current context inheritance data
        Since:
        2.0.0
      • debugMode

        boolean debugMode()
        Get whether or not debug mode is enabled.

        When debug mode is enabled, all permission queries will be logged to the engine's active logger.

        Returns:
        the debug mode state
        Since:
        2.0.0
      • debugMode

        void debugMode​(boolean enabled,
                       @Nullable Pattern filter)
        Set the active debug mode state, and a filter.
        Parameters:
        enabled - whether debug mode is enabled
        filter - a filter for values (permissions, options, and subject names) that will be logged by debug mode.
        Since:
        2.0.0
        See Also:
        for information on the consequences of debug mode