Interface IPermissionManagement
-
- All Known Subinterfaces:
CachedPermissionManagement,DefaultSynchronizedPermissionManagement
- All Known Implementing Classes:
DefaultCachedPermissionManagement,DefaultPermissionManagement
public interface IPermissionManagement
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description IPermissionGroupaddGroup(@NotNull IPermissionGroup permissionGroup)Adds a new permission group to the list of groups.IPermissionGroupaddGroup(@NotNull java.lang.String role, int potency)Adds a new permission group if it does not already exists.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionGroup>addGroupAsync(@NotNull IPermissionGroup permissionGroup)Adds a new permission group to the list of groups.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionGroup>addGroupAsync(@NotNull java.lang.String role, int potency)Adds a new permission group to the list of groups.IPermissionUseraddUser(@NotNull IPermissionUser permissionUser)Adds a new user to the database.IPermissionUseraddUser(@NotNull java.lang.String name, @NotNull java.lang.String password, int potency)Adds a new permission user if it does not already exists.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionUser>addUserAsync(@NotNull IPermissionUser permissionUser)Adds a new user to the database.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionUser>addUserAsync(@NotNull java.lang.String name, @NotNull java.lang.String password, int potency)Adds a new user to the database.booleancanBeOverwritten()Gets if this permission management can be overridden.booleancontainsGroup(@NotNull java.lang.String group)Checks if a specific group exists.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean>containsGroupAsync(@NotNull java.lang.String group)Checks if a specific group exists.booleancontainsUser(@NotNull java.lang.String name)Checks if at least one user with the given name is stored in the database.booleancontainsUser(@NotNull java.util.UUID uniqueId)Checks if a user with the given uniqueId is stored in the database.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean>containsUserAsync(@NotNull java.lang.String name)Checks if at least one user with the given name is stored in the database.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean>containsUserAsync(@NotNull java.util.UUID uniqueId)Checks if a user with the given uniqueId is stored in the database.voiddeleteGroup(@NotNull IPermissionGroup permissionGroup)Deletes a group by its name out of the list of groups.voiddeleteGroup(@NotNull java.lang.String name)Deletes a group by its name out of the list of groups.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>deleteGroupAsync(@NotNull IPermissionGroup permissionGroup)Deletes a group by its name out of the list of groups.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>deleteGroupAsync(@NotNull java.lang.String name)Deletes a group by its name out of the list of groups.booleandeleteUser(@NotNull IPermissionUser permissionUser)Deletes one user with the uniqueId of the given user.booleandeleteUser(@NotNull java.lang.String name)Deletes all users in the database matching the given name.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean>deleteUserAsync(@NotNull IPermissionUser permissionUser)Deletes one user with the uniqueId of the given user.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean>deleteUserAsync(@NotNull java.lang.String name)Deletes all users in the database matching the given name.@Nullable PermissionfindHighestPermission(@NotNull java.util.Collection<Permission> permissions, @NotNull Permission permission)Finds the highest permission (sorted by the potency) in the givenpermissionsarray using the givenpermissionpotency as the starting point.@NotNull java.util.Collection<Permission>getAllPermissions(@NotNull IPermissible permissible)Gets all permission of the specifiedpermissible@NotNull java.util.Collection<Permission>getAllPermissions(@NotNull IPermissible permissible, @Nullable java.lang.String group)Gets all permission of the specifiedpermissibleon the givengroup.@Nullable IPermissionManagementgetChildPermissionManagement()Get the child permission management ornullif there is no child permission management.IPermissionGroupgetDefaultPermissionGroup()Gets the default permission group.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionGroup>getDefaultPermissionGroupAsync()Gets the default permission group.java.util.Collection<IPermissionGroup>getExtendedGroups(@Nullable IPermissionGroup group)Deprecated.Replace withgetGroups(IPermissible)IPermissionUsergetFirstUser(java.lang.String name)Gets the first permission user with the givenname.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionUser>getFirstUserAsync(java.lang.String name)Gets the first user with the specifiedname.@Nullable IPermissionGroupgetGroup(@NotNull java.lang.String name)Gets a specific group by its name.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionGroup>getGroupAsync(@NotNull java.lang.String name)Gets a specific group by its name.java.util.Collection<IPermissionGroup>getGroups()Gets the list of all groups in the Cloud.@NotNull java.util.Collection<IPermissionGroup>getGroups(@Nullable IPermissible permissible)Gets the extended groups of the specifiedgroup.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<IPermissionGroup>>getGroupsAsync()Gets the list of all groups in the Cloud.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<IPermissionGroup>>getGroupsAsync(@Nullable IPermissionUser permissionUser)Retrieves every permission group object of the specifiedpermissionUser.IPermissionGroupgetHighestPermissionGroup(@NotNull IPermissionUser permissionUser)Gets the highest permission group of the specified user, evaluated by using the group potency.@NotNull IPermissionUsergetOrCreateUser(@NotNull java.util.UUID uniqueId, @NotNull java.lang.String name)Gets a user with the given uniqueId out of the database or creates a new one if the database contains no such entry.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionUser>getOrCreateUserAsync(@NotNull java.util.UUID uniqueId, @NotNull java.lang.String name)Gets a user with the given uniqueId out of the database or creates a new one if the database contains no such entry.@NotNull PermissionCheckResultgetPermissionResult(@NotNull IPermissible permissible, @NotNull Permission permission)Checks if the givenpermissiblehas the givenpermission.@NotNull PermissionCheckResultgetPermissionResult(@NotNull IPermissible permissible, @NotNull java.lang.Iterable<java.lang.String> groups, @NotNull Permission permission)Checks if the givenpermissiblehas the givenpermission.@NotNull PermissionCheckResultgetPermissionResult(@NotNull IPermissible permissible, @NotNull java.lang.String permission)Checks if the givenpermissiblehas the givenpermission.@NotNull PermissionCheckResultgetPermissionResult(@NotNull IPermissible permissible, @NotNull java.lang.String[] groups, @NotNull Permission permission)Checks if the givenpermissiblehas the givenpermission.@NotNull PermissionCheckResultgetPermissionResult(@NotNull IPermissible permissible, @NotNull java.lang.String group, @NotNull Permission permission)Checks if the givenpermissiblehas the givenpermission.@Nullable IPermissionUsergetUser(@NotNull java.util.UUID uniqueId)Gets a user with the given uniqueId out of the database.java.util.List<IPermissionUser>getUser(java.lang.String name)Deprecated.usegetUsers(String)instead@NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionUser>getUserAsync(@NotNull java.util.UUID uniqueId)Gets a user with the given uniqueId out of the database.@NotNull java.util.Collection<IPermissionUser>getUsers()Gets a list of all users stored in the database.@NotNull java.util.List<IPermissionUser>getUsers(@NotNull java.lang.String name)Gets a list of all users with the given name out of the database.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<IPermissionUser>>getUsersAsync()Gets a list of all users stored in the database.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.List<IPermissionUser>>getUsersAsync(@NotNull java.lang.String name)Gets a list of all users with the given name out of the database.java.util.Collection<IPermissionUser>getUsersByGroup(@NotNull java.lang.String group)Gets a list of all users stored in the database with the given group.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<IPermissionUser>>getUsersByGroupAsync(@NotNull java.lang.String group)Gets a list of all users stored in the database with the given group.default booleanhasPermission(@NotNull IPermissible permissible, @NotNull Permission permission)Checks if the givenpermissiblehas the givenpermission.default booleanhasPermission(@NotNull IPermissible permissible, @NotNull java.lang.String permission)Checks if the givenpermissiblehas the givenpermission.default booleanhasPermission(@NotNull IPermissible permissible, @NotNull java.lang.String group, @NotNull Permission permission)Checks if the givenpermissiblehas the givenpermission.voidinit()Initializes this permission management.IPermissionGroupmodifyGroup(@NotNull java.lang.String name, @NotNull java.util.function.Consumer<IPermissionGroup> modifier)Gets the permission group with the given name by usinggetGroup(String)and, if not null, puts it into the consumer, after that, the group will be updated by usingupdateGroup(IPermissionGroup).@NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionGroup>modifyGroupAsync(@NotNull java.lang.String name, @NotNull java.util.function.Consumer<IPermissionGroup> modifier)Gets the permission group with the given name by usinggetGroupAsync(String)and, if not null, puts it into the consumer, after that, the group will be updated by usingupdateGroup(IPermissionGroup).IPermissionUsermodifyUser(@NotNull java.util.UUID uniqueId, @NotNull java.util.function.Consumer<IPermissionUser> modifier)Gets the permission user with the given uniqueId by usinggetUser(UUID)and, if not null, puts them into the consumer, after that, the user will be updated by usingupdateUser(IPermissionUser).@NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionUser>modifyUserAsync(@NotNull java.util.UUID uniqueId, @NotNull java.util.function.Consumer<IPermissionUser> modifier)Gets the permission user with the given uniqueId by usinggetUserAsync(UUID)and, if not null, puts them into the consumer, after that, the user will be updated by usingupdateUser(IPermissionUser).java.util.List<IPermissionUser>modifyUsers(@NotNull java.lang.String name, @NotNull java.util.function.Consumer<IPermissionUser> modifier)Gets every user matching the given name by usinggetUsers(String)and puts them into the consumer, after that, every user will be updated by usingupdateUser(IPermissionUser).@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.List<IPermissionUser>>modifyUsersAsync(@NotNull java.lang.String name, @NotNull java.util.function.Consumer<IPermissionUser> modifier)Gets every user matching the given name by usinggetUsersAsync(String)and puts them into the consumer, after that, every user will be updated by usingupdateUser(IPermissionUser).booleanreload()Reloads this permission managementvoidsetGroups(@Nullable java.util.Collection<? extends IPermissionGroup> groups)Clears all groups in the Cloud and sets given groups.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>setGroupsAsync(@Nullable java.util.Collection<? extends IPermissionGroup> groups)Clears all groups in the Cloud and sets given groups.voidsetUsers(@NotNull java.util.Collection<? extends IPermissionUser> users)Clears all users stored in the database and inserts the given list.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>setUsersAsync(@NotNull java.util.Collection<? extends IPermissionUser> users)Clears all users stored in the database and inserts the given list.booleantestPermissible(@Nullable IPermissible permissible)Removes the timed-out permissions of the givenpermissible.booleantestPermissionGroup(@Nullable IPermissionGroup permissionGroup)Deprecated.UsetestPermissible(IPermissible)instead.booleantestPermissionUser(@Nullable IPermissionUser permissionUser)Removes all timed-out permissions and groups of the givenpermissionUser.voidupdateGroup(@NotNull IPermissionGroup permissionGroup)Updates a permission group in the list of groups.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>updateGroupAsync(@NotNull IPermissionGroup permissionGroup)Updates a permission group in the list of groups.voidupdateUser(@NotNull IPermissionUser permissionUser)Updates an already existing user in the database.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>updateUserAsync(@NotNull IPermissionUser permissionUser)Updates an already existing user in the database.
-
-
-
Method Detail
-
getChildPermissionManagement
@Nullable @Nullable IPermissionManagement getChildPermissionManagement()
Get the child permission management ornullif there is no child permission management.- Returns:
- the child permission management or
nullif there is no child permission management.
-
canBeOverwritten
boolean canBeOverwritten()
Gets if this permission management can be overridden.- Returns:
- if this permission management can be overridden.
-
getUser
@Deprecated @ScheduledForRemoval(inVersion="3.5") java.util.List<IPermissionUser> getUser(java.lang.String name)
Deprecated.usegetUsers(String)insteadGets all users with the givenname.- Parameters:
name- the name of the permission users to get.- Returns:
- all permission users with the given
name.
-
getFirstUser
IPermissionUser getFirstUser(java.lang.String name)
Gets the first permission user with the givenname.- Parameters:
name- the name of the user to get.- Returns:
- the first permission user or
nullif no user with this name exists.
-
init
@Internal void init()
Initializes this permission management.
-
reload
boolean reload()
Reloads this permission management- Returns:
trueif the reload was successful
-
getHighestPermissionGroup
IPermissionGroup getHighestPermissionGroup(@NotNull @NotNull IPermissionUser permissionUser)
Gets the highest permission group of the specified user, evaluated by using the group potency.- Parameters:
permissionUser- the user- Returns:
- the highest permission group.
-
getDefaultPermissionGroup
IPermissionGroup getDefaultPermissionGroup()
Gets the default permission group.- Returns:
- the default permission group.
-
testPermissionGroup
@Deprecated @ScheduledForRemoval boolean testPermissionGroup(@Nullable @Nullable IPermissionGroup permissionGroup)Deprecated.UsetestPermissible(IPermissible)instead.Removes the timed-out permissions of the givenpermissionGroup.- Parameters:
permissionGroup- the group to check.- Returns:
trueif at least one permission was removed.
-
testPermissionUser
boolean testPermissionUser(@Nullable @Nullable IPermissionUser permissionUser)Removes all timed-out permissions and groups of the givenpermissionUser.- Parameters:
permissionUser- the permission user to check.- Returns:
trueif at least one permission was removed.
-
testPermissible
boolean testPermissible(@Nullable @Nullable IPermissible permissible)Removes the timed-out permissions of the givenpermissible.- Parameters:
permissible- the permissible to check.- Returns:
trueif at least one permission was removed.
-
addUser
IPermissionUser addUser(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String password, int potency)
Adds a new permission user if it does not already exists.- Parameters:
name- the name of the new user.password- the password of the new user.potency- the potency of the new user.- Returns:
- the newly created permission user.
-
addGroup
IPermissionGroup addGroup(@NotNull @NotNull java.lang.String role, int potency)
Adds a new permission group if it does not already exists.- Parameters:
role- the case-sensitive name of the new grouppotency- the potency of the new group- Returns:
- the newly created permission group
-
getGroups
@NotNull @NotNull java.util.Collection<IPermissionGroup> getGroups(@Nullable @Nullable IPermissible permissible)
Gets the extended groups of the specifiedgroup.- Parameters:
permissible- the permissible to get the extended groups of.- Returns:
- the extended groups of the given
permissible.
-
getExtendedGroups
@Deprecated @ScheduledForRemoval java.util.Collection<IPermissionGroup> getExtendedGroups(@Nullable @Nullable IPermissionGroup group)
Deprecated.Replace withgetGroups(IPermissible)Gets the extended groups of the specifiedgroup.- Parameters:
group- the group to get the extended groups of.- Returns:
- the extended groups of the given
group.
-
hasPermission
default boolean hasPermission(@NotNull @NotNull IPermissible permissible, @NotNull @NotNull java.lang.String permission)Checks if the givenpermissiblehas the givenpermission.- Parameters:
permissible- the permissible to check if the permission is set.permission- the permission to check.- Returns:
- the check result.
- See Also:
getPermissionResult(IPermissible, String)
-
hasPermission
default boolean hasPermission(@NotNull @NotNull IPermissible permissible, @NotNull @NotNull Permission permission)Checks if the givenpermissiblehas the givenpermission.- Parameters:
permissible- the permissible to check if the permission is set.permission- the permission to check.- Returns:
- the check result.
- See Also:
getPermissionResult(IPermissible, Permission)
-
hasPermission
default boolean hasPermission(@NotNull @NotNull IPermissible permissible, @NotNull @NotNull java.lang.String group, @NotNull @NotNull Permission permission)Checks if the givenpermissiblehas the givenpermission.- Parameters:
permissible- the permissible to check if the permission is set.group- the group to get the permissions on.permission- the permission to check.- Returns:
- the check result.
- See Also:
getPermissionResult(IPermissible, String, Permission)
-
getPermissionResult
@NotNull @NotNull PermissionCheckResult getPermissionResult(@NotNull @NotNull IPermissible permissible, @NotNull @NotNull java.lang.String permission)
Checks if the givenpermissiblehas the givenpermission.- Parameters:
permissible- the permissible to check if the permission is set.permission- the permission to check.- Returns:
- the check result.
PermissionCheckResult.DENIEDindicates that there was no allowing/forbidding permission.
-
getPermissionResult
@NotNull @NotNull PermissionCheckResult getPermissionResult(@NotNull @NotNull IPermissible permissible, @NotNull @NotNull Permission permission)
Checks if the givenpermissiblehas the givenpermission.- Parameters:
permissible- the permissible to check if the permission is set.permission- the permission to check.- Returns:
- the check result.
PermissionCheckResult.DENIEDindicates that there was no allowing/forbidding permission.
-
getPermissionResult
@NotNull @NotNull PermissionCheckResult getPermissionResult(@NotNull @NotNull IPermissible permissible, @NotNull @NotNull java.lang.String group, @NotNull @NotNull Permission permission)
Checks if the givenpermissiblehas the givenpermission.- Parameters:
permissible- the permissible to check if the permission is set.group- the group to get the permissions on.permission- the permission to check.- Returns:
- the check result.
PermissionCheckResult.DENIEDindicates that there was no allowing/forbidding permission.
-
getPermissionResult
@NotNull @NotNull PermissionCheckResult getPermissionResult(@NotNull @NotNull IPermissible permissible, @NotNull @NotNull java.lang.Iterable<java.lang.String> groups, @NotNull @NotNull Permission permission)
Checks if the givenpermissiblehas the givenpermission.- Parameters:
permissible- the permissible to check if the permission is set.groups- the groups to get the permissions on.permission- the permission to check.- Returns:
- the check result.
PermissionCheckResult.DENIEDindicates that there was no allowing/forbidding permission.
-
getPermissionResult
@NotNull @NotNull PermissionCheckResult getPermissionResult(@NotNull @NotNull IPermissible permissible, @NotNull @NotNull java.lang.String[] groups, @NotNull @NotNull Permission permission)
Checks if the givenpermissiblehas the givenpermission.- Parameters:
permissible- the permissible to check if the permission is set.groups- the groups to get the permissions on.permission- the permission to check.- Returns:
- the check result.
PermissionCheckResult.DENIEDindicates that there was no allowing/forbidding permission.
-
findHighestPermission
@Nullable @Nullable Permission findHighestPermission(@NotNull @NotNull java.util.Collection<Permission> permissions, @NotNull @NotNull Permission permission)
Finds the highest permission (sorted by the potency) in the givenpermissionsarray using the givenpermissionpotency as the starting point.- Parameters:
permissions- the permissions to check through.permission- the starting point for the check to run.- Returns:
- the highest permission in the given
permissionornullif there is no permission with a higher potency in the given collection
-
getAllPermissions
@NotNull @NotNull java.util.Collection<Permission> getAllPermissions(@NotNull @NotNull IPermissible permissible)
Gets all permission of the specifiedpermissible- Parameters:
permissible- the permissible to get the permission of.- Returns:
- all permissions of the permissible
-
getAllPermissions
@NotNull @NotNull java.util.Collection<Permission> getAllPermissions(@NotNull @NotNull IPermissible permissible, @Nullable @Nullable java.lang.String group)
Gets all permission of the specifiedpermissibleon the givengroup.- Parameters:
permissible- the permissible to get the permission of.group- the group to get the permission on ornullif no specific group should be used.- Returns:
- all permissions of the permissible on the specified group if provided
-
addUser
IPermissionUser addUser(@NotNull @NotNull IPermissionUser permissionUser)
Adds a new user to the database.- Parameters:
permissionUser- the user to be added- Returns:
- the new user
-
updateUser
void updateUser(@NotNull @NotNull IPermissionUser permissionUser)Updates an already existing user in the database.- Parameters:
permissionUser- the user to be updated
-
deleteUser
boolean deleteUser(@NotNull @NotNull java.lang.String name)Deletes all users in the database matching the given name. This method is case-sensitive.- Parameters:
name- the name of the users to be deleted
-
deleteUser
boolean deleteUser(@NotNull @NotNull IPermissionUser permissionUser)Deletes one user with the uniqueId of the given user.- Parameters:
permissionUser- the user to be deleted
-
containsUser
boolean containsUser(@NotNull @NotNull java.util.UUID uniqueId)Checks if a user with the given uniqueId is stored in the database.- Parameters:
uniqueId- the uniqueId of the user- Returns:
trueif there is a user with that uniqueId,falseotherwise
-
containsUser
boolean containsUser(@NotNull @NotNull java.lang.String name)Checks if at least one user with the given name is stored in the database. This method is case-sensitive.- Parameters:
name- the name of the user- Returns:
trueif there is a user with that name,falseotherwise
-
getUser
@Nullable @Nullable IPermissionUser getUser(@NotNull @NotNull java.util.UUID uniqueId)
Gets a user with the given uniqueId out of the database.- Parameters:
uniqueId- the uniqueId of the user- Returns:
- the
IPermissionUserfrom the database ornullif there is no user with that uniqueId stored
-
getOrCreateUser
@NotNull @NotNull IPermissionUser getOrCreateUser(@NotNull @NotNull java.util.UUID uniqueId, @NotNull @NotNull java.lang.String name)
Gets a user with the given uniqueId out of the database or creates a new one if the database contains no such entry.- Parameters:
uniqueId- the uniqueId of the username- the name of the permission user- Returns:
- the
IPermissionUserfrom the database or a newly created one.
-
getUsers
@NotNull @NotNull java.util.List<IPermissionUser> getUsers(@NotNull @NotNull java.lang.String name)
Gets a list of all users with the given name out of the database. This can only return null when the connection to the database (or when it is executed in a Wrapper instance the connection to the cloud) times out.- Parameters:
name- the name of the users- Returns:
- a list of all
IPermissionUsers stored in the database or an empty list if there is no user with that name stored.
-
getUsers
@NotNull @NotNull java.util.Collection<IPermissionUser> getUsers()
Gets a list of all users stored in the database. This can only return null when the connection to the database (or when it is executed in a Wrapper instance the connection to the cloud) times out.This method shouldn't be used when there are many users stored in the database, because that takes a lot of memory.
- Returns:
- a list of all
IPermissionUsers stored in the database or an empty list if there is no user with that name stored.
-
setUsers
void setUsers(@NotNull @NotNull java.util.Collection<? extends IPermissionUser> users)Clears all users stored in the database and inserts the given list.- Parameters:
users- the newIPermissionUsers to be stored in the database
-
getUsersByGroup
java.util.Collection<IPermissionUser> getUsersByGroup(@NotNull @NotNull java.lang.String group)
Gets a list of all users stored in the database with the given group. This can only return null when the connection to the database (or when it is executed in a Wrapper instance the connection to the cloud) times out.This method shouldn't be used when there are many users with that group stored in the database, because that takes a lot of memory.
- Returns:
- a list of all
IPermissionUsers stored in the database or an empty list if there is no user with that name stored.
-
addGroup
IPermissionGroup addGroup(@NotNull @NotNull IPermissionGroup permissionGroup)
Adds a new permission group to the list of groups. If a group with that name already exists, it will be deleted and created again.- Parameters:
permissionGroup- theIPermissionGroupto be added- Returns:
- the new group
-
updateGroup
void updateGroup(@NotNull @NotNull IPermissionGroup permissionGroup)Updates a permission group in the list of groups. If a group with that name doesn't exist, it will be created.- Parameters:
permissionGroup- theIPermissionGroupto be updated
-
deleteGroup
void deleteGroup(@NotNull @NotNull java.lang.String name)Deletes a group by its name out of the list of groups. If a group with that name doesn't exist, nothing happens.- Parameters:
name- the case-sensitive name of the group
-
deleteGroup
void deleteGroup(@NotNull @NotNull IPermissionGroup permissionGroup)Deletes a group by its name out of the list of groups. If a group with that name doesn't exist, nothing happens.- Parameters:
permissionGroup- theIPermissionGroupto be deleted
-
containsGroup
boolean containsGroup(@NotNull @NotNull java.lang.String group)Checks if a specific group exists.- Parameters:
group- the case-sensitive name of the group- Returns:
trueif the group exists,falseotherwise
-
getGroup
@Nullable @Nullable IPermissionGroup getGroup(@NotNull @NotNull java.lang.String name)
Gets a specific group by its name.- Parameters:
name- the case-sensitive name of the group- Returns:
- the
IPermissionUserif it exists,nullotherwise
-
getGroups
java.util.Collection<IPermissionGroup> getGroups()
Gets the list of all groups in the Cloud.- Returns:
- a list of
IPermissionGroups registered in the cloud or an empty list if there is no group registered
-
setGroups
void setGroups(@Nullable @Nullable java.util.Collection<? extends IPermissionGroup> groups)Clears all groups in the Cloud and sets given groups.- Parameters:
groups- the new groups
-
modifyGroup
IPermissionGroup modifyGroup(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.util.function.Consumer<IPermissionGroup> modifier)
Gets the permission group with the given name by usinggetGroup(String)and, if not null, puts it into the consumer, after that, the group will be updated by usingupdateGroup(IPermissionGroup).- Parameters:
name- the name of the groupmodifier- the Consumer to modify the user- Returns:
- the modified user
-
modifyUser
IPermissionUser modifyUser(@NotNull @NotNull java.util.UUID uniqueId, @NotNull @NotNull java.util.function.Consumer<IPermissionUser> modifier)
Gets the permission user with the given uniqueId by usinggetUser(UUID)and, if not null, puts them into the consumer, after that, the user will be updated by usingupdateUser(IPermissionUser).- Parameters:
uniqueId- the uniqueId of the usermodifier- the Consumer to modify the user- Returns:
- the modified user
-
modifyUsers
java.util.List<IPermissionUser> modifyUsers(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.util.function.Consumer<IPermissionUser> modifier)
Gets every user matching the given name by usinggetUsers(String)and puts them into the consumer, after that, every user will be updated by usingupdateUser(IPermissionUser).- Parameters:
name- the name of the usersmodifier- the Consumer to modify the available users- Returns:
- a list of all modified users
-
getGroupsAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<IPermissionGroup>> getGroupsAsync(@Nullable @Nullable IPermissionUser permissionUser)
Retrieves every permission group object of the specifiedpermissionUser.- Parameters:
permissionUser- the user to get the groups of- Returns:
- a collection of all group objects the user is in
-
addUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionUser> addUserAsync(@NotNull @NotNull IPermissionUser permissionUser)
Adds a new user to the database.- Parameters:
permissionUser- the user to be added- Returns:
- the created permission user
-
addUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionUser> addUserAsync(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String password, int potency)
Adds a new user to the database.- Parameters:
name- the name of the new userpassword- the password of the new userpotency- the potency of the new user- Returns:
- the created permission user
-
updateUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> updateUserAsync(@NotNull @NotNull IPermissionUser permissionUser)Updates an already existing user in the database.- Parameters:
permissionUser- the user to be updated- Returns:
- a task completed when the operation was executed
-
deleteUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> deleteUserAsync(@NotNull @NotNull java.lang.String name)Deletes all users in the database matching the given name. This method is case-sensitive.- Parameters:
name- the name of the users to be deleted- Returns:
- if the operation was successful
-
deleteUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> deleteUserAsync(@NotNull @NotNull IPermissionUser permissionUser)Deletes one user with the uniqueId of the given user.- Parameters:
permissionUser- the user to be deleted- Returns:
- if the operation was successful
-
containsUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> containsUserAsync(@NotNull @NotNull java.util.UUID uniqueId)Checks if a user with the given uniqueId is stored in the database.- Parameters:
uniqueId- the uniqueId of the user- Returns:
trueif there is a user with that uniqueId,falseotherwise
-
containsUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> containsUserAsync(@NotNull @NotNull java.lang.String name)Checks if at least one user with the given name is stored in the database. This method is case-sensitive.- Parameters:
name- the name of the user- Returns:
trueif there is a user with that name,falseotherwise
-
getUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionUser> getUserAsync(@NotNull @NotNull java.util.UUID uniqueId)
Gets a user with the given uniqueId out of the database.- Parameters:
uniqueId- the uniqueId of the user- Returns:
- the
IPermissionUserfrom the database ornullif there is no user with that uniqueId stored
-
getOrCreateUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionUser> getOrCreateUserAsync(@NotNull @NotNull java.util.UUID uniqueId, @NotNull @NotNull java.lang.String name)
Gets a user with the given uniqueId out of the database or creates a new one if the database contains no such entry.- Parameters:
uniqueId- the uniqueId of the username- the name of the permission user- Returns:
- the
IPermissionUserfrom the database or a newly created one.
-
getUsersAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.List<IPermissionUser>> getUsersAsync(@NotNull @NotNull java.lang.String name)
Gets a list of all users with the given name out of the database. This can only return null when the connection to the database (or when it is executed in a Wrapper instance the connection to the cloud) times out.- Parameters:
name- the name of the users- Returns:
- a list of all
IPermissionUsers stored in the database or an empty list if there is no user with that name stored.
-
getFirstUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionUser> getFirstUserAsync(java.lang.String name)
Gets the first user with the specifiedname.- Parameters:
name- the name of the user to get.- Returns:
- the
IPermissionUserfrom the database ornullif there is no user with that name stored
-
getUsersAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<IPermissionUser>> getUsersAsync()
Gets a list of all users stored in the database. This can only return null when the connection to the database (or when it is executed in a Wrapper instance the connection to the cloud) times out.This method shouldn't be used when there are many users stored in the database, because that takes a lot of memory.
- Returns:
- a list of all
IPermissionUsers stored in the database or an empty list if there is no user with that name stored.
-
setUsersAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> setUsersAsync(@NotNull @NotNull java.util.Collection<? extends IPermissionUser> users)Clears all users stored in the database and inserts the given list.- Parameters:
users- the newIPermissionUsers to be stored in the database- Returns:
- a task completed when the operation was executed
-
getUsersByGroupAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<IPermissionUser>> getUsersByGroupAsync(@NotNull @NotNull java.lang.String group)
Gets a list of all users stored in the database with the given group. This can only return null when the connection to the database (or when it is executed in a Wrapper instance the connection to the cloud) times out.This method shouldn't be used when there are many users with that group stored in the database, because that takes a lot of memory.
- Parameters:
group- the name of the group to get the users of.- Returns:
- a list of all
IPermissionUsers stored in the database or an empty list if there is no user with that name stored.
-
addGroupAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionGroup> addGroupAsync(@NotNull @NotNull IPermissionGroup permissionGroup)
Adds a new permission group to the list of groups. If a group with that name already exists, it will be deleted and created again.- Parameters:
permissionGroup- theIPermissionGroupto be added- Returns:
- the created permission group.
-
addGroupAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionGroup> addGroupAsync(@NotNull @NotNull java.lang.String role, int potency)
Adds a new permission group to the list of groups. If a group with that name already exists, it will be deleted and created again.- Parameters:
role- the name of the group to create.potency- the potency of the new group.- Returns:
- the created permission group.
-
updateGroupAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> updateGroupAsync(@NotNull @NotNull IPermissionGroup permissionGroup)Updates a permission group in the list of groups. If a group with that name doesn't exist, it will be created.- Parameters:
permissionGroup- theIPermissionGroupto be updated- Returns:
- a task completed when the operation was executed
-
deleteGroupAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> deleteGroupAsync(@NotNull @NotNull java.lang.String name)Deletes a group by its name out of the list of groups. If a group with that name doesn't exist, nothing happens.- Parameters:
name- the case-sensitive name of the group- Returns:
- a task completed when the operation was executed
-
deleteGroupAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> deleteGroupAsync(@NotNull @NotNull IPermissionGroup permissionGroup)Deletes a group by its name out of the list of groups. If a group with that name doesn't exist, nothing happens.- Parameters:
permissionGroup- theIPermissionGroupto be deleted- Returns:
- a task completed when the operation was executed
-
containsGroupAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Boolean> containsGroupAsync(@NotNull @NotNull java.lang.String group)Checks if a specific group exists.- Parameters:
group- the case-sensitive name of the group- Returns:
trueif the group exists,falseotherwise
-
getGroupAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionGroup> getGroupAsync(@NotNull @NotNull java.lang.String name)
Gets a specific group by its name.- Parameters:
name- the case-sensitive name of the group- Returns:
- the
IPermissionUserif it exists,nullotherwise
-
getDefaultPermissionGroupAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionGroup> getDefaultPermissionGroupAsync()
Gets the default permission group.- Returns:
- the default permission group.
-
getGroupsAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<IPermissionGroup>> getGroupsAsync()
Gets the list of all groups in the Cloud.- Returns:
- a list of
IPermissionGroups registered in the cloud or an empty list if there is no group registered
-
setGroupsAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> setGroupsAsync(@Nullable @Nullable java.util.Collection<? extends IPermissionGroup> groups)Clears all groups in the Cloud and sets given groups.- Parameters:
groups- the new groups
-
modifyGroupAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionGroup> modifyGroupAsync(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.util.function.Consumer<IPermissionGroup> modifier)
Gets the permission group with the given name by usinggetGroupAsync(String)and, if not null, puts it into the consumer, after that, the group will be updated by usingupdateGroup(IPermissionGroup).- Parameters:
name- the name of the groupmodifier- the Consumer to modify the user- Returns:
- the modified user
-
modifyUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionUser> modifyUserAsync(@NotNull @NotNull java.util.UUID uniqueId, @NotNull @NotNull java.util.function.Consumer<IPermissionUser> modifier)
Gets the permission user with the given uniqueId by usinggetUserAsync(UUID)and, if not null, puts them into the consumer, after that, the user will be updated by usingupdateUser(IPermissionUser).- Parameters:
uniqueId- the uniqueId of the usermodifier- the Consumer to modify the user- Returns:
- the modified user
-
modifyUsersAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.util.List<IPermissionUser>> modifyUsersAsync(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.util.function.Consumer<IPermissionUser> modifier)
Gets every user matching the given name by usinggetUsersAsync(String)and puts them into the consumer, after that, every user will be updated by usingupdateUser(IPermissionUser).- Parameters:
name- the name of the usersmodifier- the Consumer to modify the available users- Returns:
- a list of all modified users
-
-