Interface PermissionsEngine
-
- All Superinterfaces:
ContextDefinitionProvider
public interface PermissionsEngine extends ContextDefinitionProvider
A PermissionsEx engine.- Since:
- 2.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static SubjectType<String>SUBJECTS_DEFAULTSA subject type where subjects arestatic SubjectType<String>SUBJECTS_FALLBACKstatic StringSUBJECTS_GROUPDeprecated.static StringSUBJECTS_USERDeprecated.-
Fields inherited from interface ca.stellardrift.permissionsex.context.ContextDefinitionProvider
GLOBAL_CONTEXT
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default CompletableFuture<ContextInheritance>contextInheritance()Get the current context inheritance.CompletableFuture<ContextInheritance>contextInheritance(@Nullable Consumer<ContextInheritance> listener)Get context inheritance data.CompletableFuture<ContextInheritance>contextInheritance(ContextInheritance newInheritance)Update the context inheritance when values have been changedbooleandebugMode()Get whether or not debug mode is enabled.default voiddebugMode(boolean enabled)Set the active debug mode state.voiddebugMode(boolean enabled, @Nullable Pattern filter)Set the active debug mode state, and a filter.<V> CompletableFuture<V>doBulkOperation(Function<DataStore,CompletableFuture<V>> actor)Perform a low-level bulk operation.Set<SubjectType<?>>knownSubjectTypes()Get all registered subject typesRankLadderCollectionladders()Get a cache for rank ladders known by the engine.Collection<? extends SubjectTypeCollection<?>>loadedSubjectTypes()Get subject types with actively stored data.default <I> CompletableFuture<CalculatedSubject>subject(SubjectRef<I> reference)Resolve a subject from a reference.<I> SubjectTypeCollection<I>subjects(SubjectType<I> type)Get a subject type by name.-
Methods inherited from interface ca.stellardrift.permissionsex.context.ContextDefinitionProvider
contextDefinition, contextDefinition, registerContextDefinition, registerContextDefinitions, registeredContextTypes, usedContextTypes
-
-
-
-
Field Detail
-
SUBJECTS_USER
@Deprecated static final String SUBJECTS_USER
Deprecated.- See Also:
- Constant Field Values
-
SUBJECTS_GROUP
@Deprecated static final String SUBJECTS_GROUP
Deprecated.- See Also:
- Constant Field Values
-
SUBJECTS_DEFAULTS
static final SubjectType<String> SUBJECTS_DEFAULTS
A subject type where subjects are
-
SUBJECTS_FALLBACK
static final SubjectType<String> SUBJECTS_FALLBACK
-
-
Method Detail
-
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<CalculatedSubject> subject(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
-
loadedSubjectTypes
Collection<? extends SubjectTypeCollection<?>> loadedSubjectTypes()
Get subject types with actively stored data.- Returns:
- an unmodifiable view of the actively loaded subject types
-
knownSubjectTypes
Set<SubjectType<?>> knownSubjectTypes()
Get all registered subject types- Returns:
- a stream producing all subject types
- 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
default CompletableFuture<ContextInheritance> contextInheritance()
Get the current context inheritance.No update listener will be registered
- Returns:
- a future providing the current context inheritance data
- Since:
- 2.0.0
- See Also:
for more details on context inheritance
-
contextInheritance
CompletableFuture<ContextInheritance> contextInheritance(@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
ContextInheritancemust be passed tocontextInheritance(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
-
contextInheritance
CompletableFuture<ContextInheritance> contextInheritance(ContextInheritance newInheritance)
Update the context inheritance when values have been changed- Parameters:
newInheritance- The modified inheritance object- Returns:
- A future containing the latest context inheritance object
- 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
default void debugMode(boolean enabled)
Set the active debug mode state.- Parameters:
enabled- whether debug mode is enabled- Since:
- 2.0.0
- See Also:
for information on the consequences of debug mode
-
debugMode
void debugMode(boolean enabled, @Nullable Pattern filter)
Set the active debug mode state, and a filter.- Parameters:
enabled- whether debug mode is enabledfilter- 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
-
-