Class PermissionGroup
java.lang.Object
eu.cloudnetservice.driver.permission.AbstractPermissible
eu.cloudnetservice.driver.permission.PermissionGroup
- All Implemented Interfaces:
eu.cloudnetservice.common.Named,DefaultedDocPropertyHolder,DocPropertyHolder,Permissible,Comparable<Permissible>
A permission group is an implementation of the permissible that extends the permissible in the sense that it adds
cosmetic options that can be used by other systems. The permission group allows permission inheritance by specifying
the parents using
groupNames().- Since:
- 4.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder for permission groups.Nested classes/interfaces inherited from interface eu.cloudnetservice.driver.document.property.DefaultedDocPropertyHolder
DefaultedDocPropertyHolder.Mutable<S extends DocPropertyHolder.Mutable<S>>Nested classes/interfaces inherited from interface eu.cloudnetservice.driver.document.property.DocPropertyHolder
DocPropertyHolder.Mutable<S extends DocPropertyHolder.Mutable<S>> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Typeprivate final Stringprivate final booleanprivate final Stringprivate final Stringprivate final intprivate final StringFields inherited from class eu.cloudnetservice.driver.permission.AbstractPermissible
createdTime, groupPermissions, name, permissions, potency, properties -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPermissionGroup(@NonNull String color, @NonNull String prefix, @NonNull String suffix, @NonNull String display, int sortId, boolean defaultGroup, @NonNull Set<String> groups, @NonNull String name, int potency, long createdTime, @NonNull Set<Permission> permissions, @NonNull Map<String, Set<Permission>> groupPermissions, @NonNull Document properties) Constructs a new permission group. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull PermissionGroup.Builderbuilder()Creates a new permission group builder instance with all default values.static @NonNull PermissionGroup.Builderbuilder(@NonNull PermissionGroup group) Creates a new permission group builder instance and copies all values from the given permission group.color()Gets the color of the group.booleanGets whether this group is the default group or not.display()Gets the display of the group.Gets all parent groups of this group.prefix()Gets the prefix of the group.intsortId()Gets the prefix of the group.suffix()Gets the suffix of the group.Methods inherited from class eu.cloudnetservice.driver.permission.AbstractPermissible
addPermission, addPermission, creationTime, groupPermissions, name, permissions, potency, propertyHolder, removePermission, removePermissionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface eu.cloudnetservice.driver.document.property.DefaultedDocPropertyHolder
propertyAbsent, propertyPresent, readProperty, readPropertyOrDefault, readPropertyOrGet, readPropertyOrThrow, readPropertyOrThrowMethods inherited from interface eu.cloudnetservice.driver.permission.Permissible
addPermission, addPermission, compareTo, findMatchingPermission, hasPermission, hasPermission, hasPermission, hasPermission, isPermissionSet, permission, permissionNames
-
Field Details
-
COL_GROUPS
-
color
-
prefix
-
suffix
-
display
-
sortId
private final int sortId -
defaultGroup
private final boolean defaultGroup -
groups
-
-
Constructor Details
-
PermissionGroup
protected PermissionGroup(@NonNull @NonNull String color, @NonNull @NonNull String prefix, @NonNull @NonNull String suffix, @NonNull @NonNull String display, int sortId, boolean defaultGroup, @NonNull @NonNull Set<String> groups, @NonNull @NonNull String name, int potency, long createdTime, @NonNull @NonNull Set<Permission> permissions, @NonNull @NonNull Map<String, Set<Permission>> groupPermissions, @NonNull @NonNull Document properties) Constructs a new permission group. The group is not saved or updated in any way beforePermissionManagement.addPermissionGroup(PermissionGroup)is called.- Parameters:
color- the color of the group.prefix- the prefix of the group.suffix- the suffix of the group.display- the chat display of the group.sortId- the sort id of the group.defaultGroup- whether the group is the default group or not.groups- the parent groups used for permission inheritance.name- the name of the group.potency- the potency of the group.createdTime- the timestamp at the creation.permissions- all permissions the group has.groupPermissions- all group specific permissions the group has.properties- extra properties for the group.- Throws:
NullPointerException- if one of the given parameters is null.
-
-
Method Details
-
builder
Creates a new permission group builder instance with all default values.- Returns:
- the new builder instance.
-
builder
@NonNull public static @NonNull PermissionGroup.Builder builder(@NonNull @NonNull PermissionGroup group) Creates a new permission group builder instance and copies all values from the given permission group.- Parameters:
group- the group to copy from.- Returns:
- the new builder instance.
- Throws:
NullPointerException- if the given group is null.
-
prefix
Gets the prefix of the group.- Returns:
- the prefix of the group.
-
color
Gets the color of the group.- Returns:
- the color of the group.
-
suffix
Gets the suffix of the group.- Returns:
- the suffix of the group.
-
display
Gets the display of the group.- Returns:
- the display of the group.
-
sortId
public int sortId()Gets the prefix of the group.- Returns:
- the prefix of the group.
-
defaultGroup
public boolean defaultGroup()Gets whether this group is the default group or not.Note: There might be multiple default groups, but always the first one is chosen as default group without being deterministic.
- Returns:
- whether this group is the default group or not.
-
groupNames
Gets all parent groups of this group. This group inherits all permissions of the parent groups.- Returns:
- all parent groups.
-