Package com.griefdefender.api.permission
Interface PermissionManager
public interface PermissionManager
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddItemEnchantmentContexts(Object item, Set<Context> contexts) Checks for enchantments in item and adds them to context set.Adds a value to a multi option with contexts to a holder.clearAllFlagPermissions(Subject subject) Clears permissions on theSubject.clearFlagPermissions(Subject subject, Set<Context> contexts) clearFlagPermissions(Set<Context> contexts) Clear all options.clearOptions(Set<Context> contexts) Clear all options in the given context combination.default TristategetActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Object source, Object target, Set<Context> contexts) default TristategetActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Object source, Object target, Set<Context> contexts, boolean checkOverride) getActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Object source, Object target, Set<Context> contexts, TrustType type, boolean checkOverride) default Tristatedefault TristategetActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Set<Context> contexts, boolean checkOverride) default TristategetActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Set<Context> contexts, TrustType type) default TristategetActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Set<Context> contexts, TrustType type, boolean checkOverride) 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) getActiveFlagPermissionValue(Object event, Object location, Claim claim, Subject subject, Flag flag, Object source, Object target, Set<Context> contexts, TrustType type, boolean checkOverride) getActiveOptionDefinitionValue(Claim claim, OptionDefinition definition) Gets the activeOptionDefinitionvalue inClaim.getActiveOptionDefinitionValue(Claim claim, Subject subject, OptionDefinition definition) Gets the activeOptionDefinitionvalue inClaim.default <T> TgetActiveOptionValue(io.leangen.geantyref.TypeToken<T> type, Option<T> option, Claim claim, Set<Context> contexts) default <T> TgetActiveOptionValue(io.leangen.geantyref.TypeToken<T> type, Option<T> option, Subject subject, Claim claim) <T> TgetActiveOptionValue(io.leangen.geantyref.TypeToken<T> type, Option<T> option, Subject subject, Claim claim, Set<Context> contexts) getFlagPermissions(Subject subject, Set<Context> contexts) getFlagPermissions(Set<Context> contexts) Gets all flag permissions withContext's.getFlagPermissionValue(Flag flag, Subject subject, Set<Context> contexts) getFlagPermissionValue(Flag flag, Set<Context> contexts) default @Nullable StringgetOptionValue(Option option) Gets the globalOptionoption value in the default subject's current context.@Nullable StringgetOptionValue(Option option, Set<Context> contexts) default @Nullable StringgetOptionValue(Subject subject, Option option) @Nullable StringgetOptionValue(Subject subject, Option option, Set<Context> contexts) default <T> TgetOptionValue(io.leangen.geantyref.TypeToken<T> type, Option<T> option) Gets the globalOptionoption value in the default subject's current context.<T> TgetOptionValue(io.leangen.geantyref.TypeToken<T> type, Option<T> option, Set<Context> contexts) default <T> TgetOptionValue(io.leangen.geantyref.TypeToken<T> type, Subject subject, Option<T> option) <T> TgetOptionValue(io.leangen.geantyref.TypeToken<T> type, Subject subject, Option<T> option, Set<Context> contexts) getPermissionValue(Subject subject, String permission) Gets the permission value ofSubject.Removes a value from a multi option with contexts to a holder.default CompletableFuture<PermissionResult> setFlagDefinition(FlagDefinition definition, Tristate value) SetsFlagDefinitionon defaultSubject.setFlagDefinition(Subject subject, FlagDefinition definition, Tristate value) SetFlagDefinitiononSubject.setFlagPermission(Flag flag, Tristate value, Set<Context> contexts) SetsOptionto a value.default CompletableFuture<PermissionResult> setOptionDefinition(OptionDefinition definition, String value) SetsOptionDefinitionon defaultSubject.setOptionDefinition(Subject subject, OptionDefinition definition, String value) SetOptionDefinitiononSubject.
-
Method Details
-
getActiveFlagPermissionValue
default Tristate getActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Set<Context> contexts) - Parameters:
claim- The target claimsubject- The subjectflag- The flagcontexts- The contexts- Returns:
- The active flag value
-
getActiveFlagPermissionValue
default Tristate getActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Set<Context> contexts, TrustType type) - Parameters:
claim- The target claimsubject- The subjectflag- The flagcontexts- The contextstype- The trust type- Returns:
- The active flag value
-
getActiveFlagPermissionValue
default Tristate getActiveFlagPermissionValue(Claim claim, Subject subject, Flag flag, Set<Context> contexts, boolean checkOverride) - Parameters:
claim- The target claimsubject- The subjectflag- The flagcontexts- The contextscheckOverride- 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) - Parameters:
claim- The target claimsubject- The subjectflag- The flagcontexts- The contextstype- The trust typecheckOverride- 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) - Parameters:
claim- The target claimsubject- The subjectflag- The flagsource- The sourcetarget- The targetcontexts- 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) - Parameters:
claim- The target claimsubject- The subjectflag- The flagsource- The sourcetarget- The targetcontexts- The contextscheckOverride- 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) - Parameters:
claim- The target claimsubject- The subjectflag- The flagsource- The sourcetarget- The targetcontexts- The contextstype- The trust typecheckOverride- 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) - Parameters:
event- The eventlocation- The locationclaim- The target claimsubject- The subjectflag- The flagsource- The sourcetarget- The targetcontexts- The contextstype- The trust typecheckOverride- 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) - Parameters:
event- The eventblockX- The block X positionblockY- The block Y positionblockZ- The block Z positionclaim- The target claimsubject- The subjectflag- The flagsource- The sourcetarget- The targetcontexts- The contextstype- The trust typecheckOverride- Whether to check override- Returns:
-
getActiveOptionDefinitionValue
Gets the activeOptionDefinitionvalue inClaim.- Parameters:
definition- The option definition- Returns:
- The active value
-
getActiveOptionDefinitionValue
Gets the activeOptionDefinitionvalue inClaim.- Parameters:
definition- The option definition- Returns:
- The active value
-
clearAllFlagPermissions
Clears permissions on theSubject. Note: All claim specific permissions will be cleared on subject. If you require specific contexts, useclearFlagPermissions(Subject, Set).- Parameters:
subject- The subjectclaim- The claim- Returns:
- The permission result future
-
clearFlagPermissions
Clears permissions from specifiedContext's on the defaultSubject. 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
- Parameters:
subject- The subjectcontexts- The contexts holding the permissions- Returns:
- The result of clear
-
getFlagPermissionValue
Gets theFlagpermission value withContext's. Note: This uses the default subject which applies to all users.- Parameters:
flag- The claim flagcontexts- The claim contexts- Returns:
- The permission value, or
Tristate.UNDEFINEDif none
-
getFlagPermissionValue
Gets theFlagpermission value withContext's ofSubject. Note: Only the default subject supports default and override context. Attempting to pass another subject with these specific contexts will always returnTristate.UNDEFINED.- Parameters:
flag- The claim flagsubject- The subjectcontexts- The claim contexts- Returns:
- The permission value, or
Tristate.UNDEFINEDif none
-
getFlagPermissions
Gets all flag permissions withContext's.- Parameters:
contexts- The claim contexts- Returns:
- A map containing all permissions, empty if none
-
getFlagPermissions
- Parameters:
subject- The subjectcontexts- The claim contexts- Returns:
- A map containing all permissions, empty if none
-
setFlagPermission
CompletableFuture<PermissionResult> setFlagPermission(Flag flag, Tristate value, Set<Context> contexts) SetsFlagpermission withContext's. Note: This uses the default subject which applies to all users.- Parameters:
flag- The claim flagvalue- The new valuescontexts- The claim contexts- Returns:
- The permission result future
-
setFlagPermission
CompletableFuture<PermissionResult> setFlagPermission(Flag flag, Subject subject, Tristate value, Set<Context> contexts) - Parameters:
flag- The claim flagsubject- The subject identifiervalue- The new valuecontexts- The claim contexts- Returns:
- The permission result future
-
setFlagDefinition
default CompletableFuture<PermissionResult> setFlagDefinition(FlagDefinition definition, Tristate value) SetsFlagDefinitionon defaultSubject.- Parameters:
definition- The flag definitionvalue- The new value- Returns:
- The permission result future
-
setFlagDefinition
CompletableFuture<PermissionResult> setFlagDefinition(Subject subject, FlagDefinition definition, Tristate value) SetFlagDefinitiononSubject.- Parameters:
subject- The subjectdefinition- The flag definitionvalue- The new value- Returns:
- The permission result future
-
setOptionDefinition
default CompletableFuture<PermissionResult> setOptionDefinition(OptionDefinition definition, String value) SetsOptionDefinitionon defaultSubject.- Parameters:
definition- The option definitionvalue- The new value- Returns:
- The permission result future
-
setOptionDefinition
CompletableFuture<PermissionResult> setOptionDefinition(Subject subject, OptionDefinition definition, String value) SetOptionDefinitiononSubject.- Parameters:
subject- The subjectdefinition- The option definitionvalue- 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) - Parameters:
type- The option typeoption- The optionclaim- The claimcontexts- 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) - Parameters:
type- The option typeoption- The optionsubject- The subjectclaim- The claimcontexts- 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) - Parameters:
type- The option typeoption- The optionsubject- The subjectclaim- The claimcontexts- The contexts- Returns:
- The active option value
-
setOption
SetsOptionto 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) - Parameters:
option- The option to set. Case-insensitive.subject- The subject identifiervalue- 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 subjectoption- The multi option to updatevalue- The value to addcontexts- 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 subjectoption- The multi option to updatevalue- The value to removecontexts- The contexts- Returns:
- The permission result future
-
getOptionValue
Gets the globalOptionoption 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
Gets the globalOptionoption 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
Gets the globalOptionoption value withContext's. Note: This uses the default subject which applies to all users in all claims.- Parameters:
option- The claim optioncontexts- 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 globalOptionoption value withContext's. Note: This uses the default subject which applies to all users in all claims.- Parameters:
option- The claim optioncontexts- The claim contexts- Returns:
- The option value
-
getOptionValue
Gets the globalOptionoption value for subject withContext's. Note: This is only the default value for option. Options set in claims will override this unless theis used.invalid reference
ClaimContexts#CLAIM_OVERRIDE_CONTEXT- Parameters:
subject- The subjectoption- The claim optioncontexts- The claim contexts- Returns:
- The option value
-
getOptionValue
default <T> T getOptionValue(io.leangen.geantyref.TypeToken<T> type, Subject subject, Option<T> option) - Parameters:
subject- The subjectoption- The claim optioncontexts- The claim contexts- Returns:
- The option value
-
getOptionValue
- Parameters:
subject- The subjectoption- The claim optioncontexts- 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) - Parameters:
subject- The subjectoption- The claim optioncontexts- The claim contexts- Returns:
- The option value
-
getPermissionValue
Gets the permission value ofSubject.- Parameters:
subject- The subjectpermission- The permission- Returns:
- The permission value
-
clearOptions
CompletableFuture<PermissionResult> clearOptions()Clear all options.- Returns:
- Whether the operation was successful
-
clearOptions
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
Checks for enchantments in item and adds them to context set.- Parameters:
contexts- The context set to useitemstack- The item to check
-