Class PermissionHolder
java.lang.Object
com.github.darksoulq.abyssallib.server.permission.PermissionHolder
- Direct Known Subclasses:
PermissionGroup, PermissionUser
An abstract base for objects that can hold permissions and inherit from
parent nodes (typically groups).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a parent group to this holder via a Node.booleanRemoves nodes and parents that have exceeded their expiry time.Calculates and returns the map of all permissions active for this holder, including inherited ones.getNodes()booleanChecks if this holder has a direct (non-inherited) permission set to true.booleanChecks if this holder has a specific parent group assigned.voidClears the effective permission cache and triggers custom invalidation logic.voidremoveParent(String key) Removes a parent group by its key.abstract voidsave()Abstract hook for subclasses to handle data persistence.voidsetPermission(Node node) Sets a permission node on this holder and invalidates the cache.voidunsetPermission(String key) Removes a permission node by its key.
-
Field Details
-
permissions
-
parents
-
-
Constructor Details
-
PermissionHolder
public PermissionHolder()
-
-
Method Details
-
setPermission
-
unsetPermission
Removes a permission node by its key.- Parameters:
key- The node key to remove.
-
addParent
Adds a parent group to this holder via a Node.- Parameters:
node- The node representing group inheritance.
-
removeParent
Removes a parent group by its key.- Parameters:
key- The key of the parent to remove.
-
hasDirectPermission
Checks if this holder has a direct (non-inherited) permission set to true.- Parameters:
key- The permission key.- Returns:
- True if directly set, not expired, and true.
-
hasParent
Checks if this holder has a specific parent group assigned.- Parameters:
key- The group key.- Returns:
- True if assigned and not expired.
-
getNodes
- Returns:
- An unmodifiable collection of direct permission nodes.
-
getParentNodes
- Returns:
- An unmodifiable collection of parent group nodes.
-
clearExpired
public boolean clearExpired()Removes nodes and parents that have exceeded their expiry time.- Returns:
- True if any entries were removed.
-
invalidateCache
public void invalidateCache()Clears the effective permission cache and triggers custom invalidation logic. -
save
public abstract void save()Abstract hook for subclasses to handle data persistence. -
getEffectivePermissions
-