Interface PermissionManager


public interface PermissionManager
  • Method Details

    • getActiveFlagPermissionValue

      default Tristate getActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Set<Context> contexts)
      Gets the active Flag permission value for Subject in Claim.
      Parameters:
      claim - The target claim
      subject - The subject
      flag - The flag
      contexts - The contexts
      Returns:
      The active flag value
    • getActiveFlagPermissionValue

      default Tristate getActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Set<Context> contexts, TrustType type)
      Gets the active Flag permission value for Subject in Claim.
      Parameters:
      claim - The target claim
      subject - The subject
      flag - The flag
      contexts - The contexts
      type - The trust type
      Returns:
      The active flag value
    • getActiveFlagPermissionValue

      default Tristate getActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Set<Context> contexts, boolean checkOverride)
      Gets the active Flag permission value for Subject in Claim.
      Parameters:
      claim - The target claim
      subject - The subject
      flag - The flag
      contexts - The contexts
      checkOverride - Whether to check override
      Returns:
      The active flag value
    • getActiveFlagPermissionValue

      default Tristate getActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Set<Context> contexts, TrustType type, boolean checkOverride)
      Gets the active Flag permission value for Subject in Claim.
      Parameters:
      claim - The target claim
      subject - The subject
      flag - The flag
      contexts - The contexts
      type - The trust type
      checkOverride - Whether to check override
      Returns:
      The active flag value
    • getActiveFlagPermissionValue

      default Tristate getActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Object source, Object target, Set<Context> contexts)
      Gets the active Flag permission value for Subject in Claim.
      Parameters:
      claim - The target claim
      subject - The subject
      flag - The flag
      source - The source
      target - The target
      contexts - The contexts
      Returns:
      The active flag value
    • getActiveFlagPermissionValue

      default Tristate getActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Object source, Object target, Set<Context> contexts, boolean checkOverride)
      Gets the active Flag permission value for Subject in Claim.
      Parameters:
      claim - The target claim
      subject - The subject
      flag - The flag
      source - The source
      target - The target
      contexts - The contexts
      checkOverride - Whether to check override
      Returns:
      The active flag value
    • getActiveFlagPermissionValue

      Tristate getActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Object source, Object target, Set<Context> contexts, TrustType type, boolean checkOverride)
      Gets the active Flag permission value for Subject in Claim.
      Parameters:
      claim - The target claim
      subject - The subject
      flag - The flag
      source - The source
      target - The target
      contexts - The contexts
      type - The trust type
      checkOverride - Whether to check override
      Returns:
      The active flag value
    • getActiveFlagPermissionValue

      Tristate getActiveFlagPermissionValue(Object event, Object location, Claim claim, Subject subject, Flag flag, Object source, Object target, Set<Context> contexts, TrustType type, boolean checkOverride)
      Gets the active Flag permission value for Subject in Claim.
      Parameters:
      event - The event
      location - The location
      claim - The target claim
      subject - The subject
      flag - The flag
      source - The source
      target - The target
      contexts - The contexts
      type - The trust type
      checkOverride - Whether to check override
      Returns:
      The active flag value
    • getActiveFlagPermissionValue

      Tristate getActiveFlagPermissionValue(Object event, int blockX, int blockY, int blockZ, Claim claim, Subject subject, Flag flag, Object source, Object target, Set<Context> contexts, TrustType type, boolean checkOverride)
      Gets the active Flag permission value for Subject in Claim.
      Parameters:
      event - The event
      blockX - The block X position
      blockY - The block Y position
      blockZ - The block Z position
      claim - The target claim
      subject - The subject
      flag - The flag
      source - The source
      target - The target
      contexts - The contexts
      type - The trust type
      checkOverride - Whether to check override
      Returns:
    • getActiveOptionDefinitionValue

      String getActiveOptionDefinitionValue(Claim claim, OptionDefinition definition)
      Gets the active OptionDefinition value in Claim.
      Parameters:
      definition - The option definition
      Returns:
      The active value
    • getActiveOptionDefinitionValue

      String getActiveOptionDefinitionValue(Claim claim, Subject subject, OptionDefinition definition)
      Gets the active OptionDefinition value in Claim.
      Parameters:
      definition - The option definition
      Returns:
      The active value
    • clearAllFlagPermissions

      CompletableFuture<PermissionResult> clearAllFlagPermissions(Subject subject)
      Clears permissions on the Subject. Note: All claim specific permissions will be cleared on subject. If you require specific contexts, use clearFlagPermissions(Subject, Set).
      Parameters:
      subject - The subject
      claim - The claim
      Returns:
      The permission result future
    • clearFlagPermissions

      CompletableFuture<PermissionResult> clearFlagPermissions(Set<Context> contexts)
      Clears permissions from specified Context's on the default Subject. Note: This uses the default subject which applies to all users in claim.
      Parameters:
      contexts - The contexts holding the permissions
      Returns:
      The result of clear
    • clearFlagPermissions

      CompletableFuture<PermissionResult> clearFlagPermissions(Subject subject, Set<Context> contexts)
      Clears permissions from specified Context's on the Subject.
      Parameters:
      subject - The subject
      contexts - The contexts holding the permissions
      Returns:
      The result of clear
    • getFlagPermissionValue

      Tristate getFlagPermissionValue(Flag flag, Set<Context> contexts)
      Gets the Flag permission value with Context's. Note: This uses the default subject which applies to all users.
      Parameters:
      flag - The claim flag
      contexts - The claim contexts
      Returns:
      The permission value, or Tristate.UNDEFINED if none
    • getFlagPermissionValue

      Tristate getFlagPermissionValue(Flag flag, Subject subject, Set<Context> contexts)
      Gets the Flag permission value with Context's of Subject. Note: Only the default subject supports default and override context. Attempting to pass another subject with these specific contexts will always return Tristate.UNDEFINED.
      Parameters:
      flag - The claim flag
      subject - The subject
      contexts - The claim contexts
      Returns:
      The permission value, or Tristate.UNDEFINED if none
    • getFlagPermissions

      Map<String,Boolean> getFlagPermissions(Set<Context> contexts)
      Gets all flag permissions with Context's.
      Parameters:
      contexts - The claim contexts
      Returns:
      A map containing all permissions, empty if none
    • getFlagPermissions

      Map<String,Boolean> getFlagPermissions(Subject subject, Set<Context> contexts)
      Gets the Subject's flag permissions with Context.
      Parameters:
      subject - The subject
      contexts - The claim contexts
      Returns:
      A map containing all permissions, empty if none
    • setFlagPermission

      CompletableFuture<PermissionResult> setFlagPermission(Flag flag, Tristate value, Set<Context> contexts)
      Sets Flag permission with Context's. Note: This uses the default subject which applies to all users.
      Parameters:
      flag - The claim flag
      value - The new values
      contexts - The claim contexts
      Returns:
      The permission result future
    • setFlagPermission

      CompletableFuture<PermissionResult> setFlagPermission(Flag flag, Subject subject, Tristate value, Set<Context> contexts)
      Sets Flag permission with Context's on Subject.
      Parameters:
      flag - The claim flag
      subject - The subject identifier
      value - The new value
      contexts - The claim contexts
      Returns:
      The permission result future
    • setFlagDefinition

      default CompletableFuture<PermissionResult> setFlagDefinition(FlagDefinition definition, Tristate value)
      Sets FlagDefinition on default Subject.
      Parameters:
      definition - The flag definition
      value - The new value
      Returns:
      The permission result future
    • setFlagDefinition

      CompletableFuture<PermissionResult> setFlagDefinition(Subject subject, FlagDefinition definition, Tristate value)
      Parameters:
      subject - The subject
      definition - The flag definition
      value - The new value
      Returns:
      The permission result future
    • setOptionDefinition

      default CompletableFuture<PermissionResult> setOptionDefinition(OptionDefinition definition, String value)
      Sets OptionDefinition on default Subject.
      Parameters:
      definition - The option definition
      value - The new value
      Returns:
      The permission result future
    • setOptionDefinition

      CompletableFuture<PermissionResult> setOptionDefinition(Subject subject, OptionDefinition definition, String value)
      Parameters:
      subject - The subject
      definition - The option definition
      value - The new value
      Returns:
      The permission result future
    • getActiveOptionValue

      default <T> T getActiveOptionValue(io.leangen.geantyref.TypeToken<T> type, Option<T> option, Claim claim, Set<Context> contexts)
      Gets the active Option value with Context's.
      Parameters:
      type - The option type
      option - The option
      claim - The claim
      contexts - The contexts
      Returns:
      The active option value
    • getActiveOptionValue

      default <T> T getActiveOptionValue(io.leangen.geantyref.TypeToken<T> type, Option<T> option, Subject subject, Claim claim)
      Gets the active Option value with Context's.
      Parameters:
      type - The option type
      option - The option
      subject - The subject
      claim - The claim
      contexts - The contexts
      Returns:
      The active option value
    • getActiveOptionValue

      <T> T getActiveOptionValue(io.leangen.geantyref.TypeToken<T> type, Option<T> option, Subject subject, Claim claim, Set<Context> contexts)
      Gets the active Option value with Context's.
      Parameters:
      type - The option type
      option - The option
      subject - The subject
      claim - The claim
      contexts - The contexts
      Returns:
      The active option value
    • setOption

      CompletableFuture<PermissionResult> setOption(Option option, String value, Set<Context> contexts)
      Sets Option to a value.

      Passing a null value will unset the option.

      Parameters:
      option - The option to set. Case-insensitive.
      value - The value to set.
      contexts - The context combination to set the given option in
      Returns:
      The permission result future
    • setOption

      CompletableFuture<PermissionResult> setOption(Option option, Subject subject, String value, Set<Context> contexts)
      Sets Option with Context's on Subject.

      Passing a null value will unset the option.

      Parameters:
      option - The option to set. Case-insensitive.
      subject - The subject identifier
      value - The value to set.
      contexts - The context combination to set the given option in
      Returns:
      The permission result future
    • addOptionListValue

      CompletableFuture<PermissionResult> addOptionListValue(Subject subject, Option option, String value, Set<Context> contexts)
      Adds a value to a multi option with contexts to a holder.
      Parameters:
      subject - The subject
      option - The multi option to update
      value - The value to add
      contexts - The contexts
      Returns:
      The permission result future
    • removeOptionListValue

      CompletableFuture<PermissionResult> removeOptionListValue(Subject subject, Option option, String value, Set<Context> contexts)
      Removes a value from a multi option with contexts to a holder.
      Parameters:
      subject - The subject
      option - The multi option to update
      value - The value to remove
      contexts - The contexts
      Returns:
      The permission result future
    • getOptionValue

      default @Nullable String getOptionValue(Option option)
      Gets the global Option option value in the default subject's current context. Note: This uses the default subject which applies to all users in all claims.
      Parameters:
      option - The claim option
      Returns:
      The option value
    • getOptionValue

      default <T> T getOptionValue(io.leangen.geantyref.TypeToken<T> type, Option<T> option)
      Gets the global Option option value in the default subject's current context. Note: This uses the default subject which applies to all users in all claims.
      Type Parameters:
      T -
      Parameters:
      option - The claim option
      Returns:
      The option value
    • getOptionValue

      @Nullable String getOptionValue(Option option, Set<Context> contexts)
      Gets the global Option option value with Context's. Note: This uses the default subject which applies to all users in all claims.
      Parameters:
      option - The claim option
      contexts - The claim contexts
      Returns:
      The option value
    • getOptionValue

      <T> T getOptionValue(io.leangen.geantyref.TypeToken<T> type, Option<T> option, Set<Context> contexts)
      Gets the global Option option value with Context's. Note: This uses the default subject which applies to all users in all claims.
      Parameters:
      option - The claim option
      contexts - The claim contexts
      Returns:
      The option value
    • getOptionValue

      default @Nullable String getOptionValue(Subject subject, Option option)
      Gets the global Option option value for subject with Context's. Note: This is only the default value for option. Options set in claims will override this unless the
      invalid reference
      ClaimContexts#CLAIM_OVERRIDE_CONTEXT
      is used.
      Parameters:
      subject - The subject
      option - The claim option
      contexts - The claim contexts
      Returns:
      The option value
    • getOptionValue

      default <T> T getOptionValue(io.leangen.geantyref.TypeToken<T> type, Subject subject, Option<T> option)
      Gets the Option option value with Context's on Subject.
      Parameters:
      subject - The subject
      option - The claim option
      contexts - The claim contexts
      Returns:
      The option value
    • getOptionValue

      @Nullable String getOptionValue(Subject subject, Option option, Set<Context> contexts)
      Gets the Option option value with Context's on Subject.
      Parameters:
      subject - The subject
      option - The claim option
      contexts - The claim contexts
      Returns:
      The option value
    • getOptionValue

      <T> T getOptionValue(io.leangen.geantyref.TypeToken<T> type, Subject subject, Option<T> option, Set<Context> contexts)
      Gets the Option option value with Context's on Subject.
      Parameters:
      subject - The subject
      option - The claim option
      contexts - The claim contexts
      Returns:
      The option value
    • getPermissionValue

      Tristate getPermissionValue(Subject subject, String permission)
      Gets the permission value of Subject.
      Parameters:
      subject - The subject
      permission - The permission
      Returns:
      The permission value
    • clearOptions

      Clear all options.
      Returns:
      Whether the operation was successful
    • clearOptions

      CompletableFuture<PermissionResult> clearOptions(Set<Context> contexts)
      Clear all options in the given context combination.

      Passing an empty context set clears options in the global context.

      Parameters:
      contexts - The context combination
      Returns:
      Whether the operation was successful (any options were removed)
    • addItemEnchantmentContexts

      void addItemEnchantmentContexts(Object item, Set<Context> contexts)
      Checks for enchantments in item and adds them to context set.
      Parameters:
      contexts - The context set to use
      itemstack - The item to check