Interface Permissible
- All Superinterfaces:
Comparable<Permissible>,DocPropertyHolder,eu.cloudnetservice.common.Named
- All Known Implementing Classes:
AbstractPermissible,PermissionGroup,PermissionUser
public interface Permissible
extends eu.cloudnetservice.common.Named, DocPropertyHolder, Comparable<Permissible>
The permissible represents the base for any permission holding object. The permissible is mutable, but any changes to
the permissible itself do not have any effect without updating the permissible using the permission management.
- Since:
- 4.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface eu.cloudnetservice.driver.document.property.DocPropertyHolder
DocPropertyHolder.Mutable<S extends DocPropertyHolder.Mutable<S>> -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPermission(@NonNull Permission permission) Adds the given permission to this permissible.default voidaddPermission(@NonNull String permission) Adds the given permission with a potency of 0 to this permissible.voidaddPermission(@NonNull String group, @NonNull Permission permission) Adds the given permission to this permissible for the specified target group.default voidaddPermission(@NonNull String group, @NonNull String permission) Adds the given permission to this permissible for the specified target group, the potency is set to 0.default intlongGets the creation time as unix timestamp of this permissible.default @Nullable PermissionfindMatchingPermission(@NonNull Collection<Permission> permissions, @NonNull Permission permission) Finds the best matching permission in the given permissions by logically checking the absolute potency against each other to find the permission with the highest positive or negative potency.Collects all group names of this permissible.Gets all group specific permissions.default @NonNull PermissionCheckResulthasPermission(@NonNull Permission permission) Checks if this permissible has the given permission.default @NonNull PermissionCheckResulthasPermission(@NonNull String permission) Checks if this permissible has the given permission with a potency of 0.default @NonNull PermissionCheckResulthasPermission(@NonNull String group, @NonNull Permission permission) Checks if this permissible has the given permission for the specified target group.default @NonNull PermissionCheckResulthasPermission(@NonNull Collection<Permission> permissions, @NonNull Permission permission) Checks if the collection of given permissions contains a permission that matches the given permission.default booleanisPermissionSet(@NonNull String name) Checks if the permission has the given permission.default @Nullable Permissionpermission(@Nullable String name) Gets a permission of this permissible by its name.default @Unmodifiable @NonNull Collection<String>Gets an unmodifiable collection of all global permission names.Gets all global permissions of this permissible.intpotency()Gets the potency of this permissible.booleanremovePermission(@NonNull String permission) Removes the given permission from this permissible.booleanremovePermission(@NonNull String permission, @NonNull String group) Removes the given permission from this permissible and the given target group.Methods inherited from interface eu.cloudnetservice.driver.document.property.DocPropertyHolder
propertyAbsent, propertyHolder, propertyPresent, readProperty, readPropertyOrDefault, readPropertyOrGet, readPropertyOrThrow, readPropertyOrThrowMethods inherited from interface eu.cloudnetservice.common.Named
name
-
Method Details
-
potency
int potency()Gets the potency of this permissible. The potency is used for comparison of permissibles. A higher potency results in higher significance.- Returns:
- the potency of this permissible.
- See Also:
-
removePermission
Removes the given permission from this permissible. This only removes global permissions, not group specific ones.After removing the permission an update is required.
- Parameters:
permission- the permission to remove.- Returns:
- true if any permission was removed, false otherwise.
- Throws:
NullPointerException- if the given permission is null.
-
removePermission
Removes the given permission from this permissible and the given target group. This only removes group specific permissions, not global ones.After removing the permission an update is required.
- Parameters:
permission- the permission to remove.group- the target group to remove the permission from.- Returns:
- true if any permission was removed, false otherwise.
- Throws:
NullPointerException- if the given group or permission is null.
-
permissions
Gets all global permissions of this permissible. Specific group permissions are not included.- Returns:
- all global permissions.
-
groupPermissions
Gets all group specific permissions. Global permissions are not included.- Returns:
- all group specific permissions.
-
groupNames
Collects all group names of this permissible.- Returns:
- all groups names.
-
permission
Gets a permission of this permissible by its name.- Parameters:
name- the name of the permission.- Returns:
- the permission with the given name or null if the name is null or no permission was found.
-
isPermissionSet
Checks if the permission has the given permission.- Parameters:
name- the case-insensitive name of the permission.- Returns:
- true if the permissible has the given permission, false otherwise.
- Throws:
NullPointerException- if the given name is null.
-
creationTime
long creationTime()Gets the creation time as unix timestamp of this permissible.- Returns:
- the creation time of this permissible.
-
addPermission
Adds the given permission to this permissible. If a permission with the same name already exists the permission is replaced with the given one.After adding the permission an update is required.
- Parameters:
permission- the permission to add.- Throws:
NullPointerException- if the given permission is null.
-
addPermission
Adds the given permission with a potency of 0 to this permissible. If a permission with the same name already exists the permission is replaced with the given one.After adding the permission an update is required.
- Parameters:
permission- the permission to add.- Throws:
NullPointerException- if the given permission is null.
-
addPermission
Adds the given permission to this permissible for the specified target group. If a permission with the same name already exists the permission is replaced with the given one.After adding the permission an update is required.
- Parameters:
group- the group to add the permission for.permission- the permission to add.- Throws:
NullPointerException- if the given group or permission is null.
-
addPermission
Adds the given permission to this permissible for the specified target group, the potency is set to 0. If a permission with the same name already exists the permission is replaced with the given one.After adding the permission an update is required.
- Parameters:
group- the group to add the permission for.permission- the permission to add.- Throws:
NullPointerException- if the given group or permission is null.
-
permissionNames
Gets an unmodifiable collection of all global permission names.- Returns:
- all global permissions
-
hasPermission
@NonNull default @NonNull PermissionCheckResult hasPermission(@NonNull @NonNull Collection<Permission> permissions, @NonNull @NonNull Permission permission) Checks if the collection of given permissions contains a permission that matches the given permission.- Parameters:
permissions- the permissions to search in.permission- the permission to check for.- Returns:
- the result of the permission search.
- Throws:
NullPointerException- if the given permissions or permission is null.
-
findMatchingPermission
@Nullable default @Nullable Permission findMatchingPermission(@NonNull @NonNull Collection<Permission> permissions, @NonNull @NonNull Permission permission) Finds the best matching permission in the given permissions by logically checking the absolute potency against each other to find the permission with the highest positive or negative potency.- Parameters:
permissions- the permission to check for.permission- the initial permission to check against.- Returns:
- the logic permission which has the highest potency, null if none matches.
- Throws:
NullPointerException- if the given permissions or permission is null.- See Also:
-
hasPermission
@NonNull default @NonNull PermissionCheckResult hasPermission(@NonNull @NonNull String group, @NonNull @NonNull Permission permission) Checks if this permissible has the given permission for the specified target group. Only group permissions are included in this check, global permissions don't have any effect.- Parameters:
group- the target group of the permission.permission- the permission to check for.- Returns:
- the result of the permission check.
- Throws:
NullPointerException- if the given group or permission is null.
-
hasPermission
@NonNull default @NonNull PermissionCheckResult hasPermission(@NonNull @NonNull Permission permission) Checks if this permissible has the given permission. Only global permissions are included in this check.- Parameters:
permission- the permission to check for.- Returns:
- the result of the permission check.
- Throws:
NullPointerException- if the given permission is null.
-
hasPermission
Checks if this permissible has the given permission with a potency of 0. Only global permissions are included in this check.- Parameters:
permission- the permission to check for.- Returns:
- the result of the permission check.
- Throws:
NullPointerException- if the given permission is null.
-
compareTo
- Specified by:
compareToin interfaceComparable<Permissible>
-