Interface PermissionProvider
-
- All Known Implementing Classes:
DefaultPermissionProvider
public interface PermissionProviderThis class provides methods to get and modify the permission users and groups in CloudNet's database.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddGroup(@NotNull IPermissionGroup permissionGroup)Adds a new permission group to the list of groups.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>addGroupAsync(@NotNull IPermissionGroup permissionGroup)Adds a new permission group to the list of groups.voidaddUser(@NotNull IPermissionUser permissionUser)Adds a new user to the database.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>addUserAsync(@NotNull IPermissionUser permissionUser)Adds a new user to the database.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.voiddeleteUser(@NotNull IPermissionUser permissionUser)Deletes one user with the uniqueId of the given user.voiddeleteUser(@NotNull java.lang.String name)Deletes all users in the database matching the given name.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>deleteUserAsync(@NotNull IPermissionUser permissionUser)Deletes one user with the uniqueId of the given user.@NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void>deleteUserAsync(@NotNull java.lang.String name)Deletes all users in the database matching the given name.@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 de.dytanic.cloudnet.common.concurrent.ITask<java.util.Collection<IPermissionGroup>>getGroupsAsync()Gets the list of all groups in the Cloud.@Nullable IPermissionUsergetUser(@NotNull java.util.UUID uniqueId)Gets a user with the given uniqueId out of the database.@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.java.util.Collection<IPermissionUser>getUsers()Gets a list of all users stored in the database.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.voidsetGroups(@NotNull 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(@NotNull java.util.Collection<? extends IPermissionGroup> groups)Clears all groups in the Cloud and sets given groups.voidsetUsers(@Nullable 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.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
-
addUser
void addUser(@NotNull @NotNull IPermissionUser permissionUser)Adds a new user to the database.- Parameters:
permissionUser- the user to be added
-
updateUser
void updateUser(@NotNull @NotNull IPermissionUser permissionUser)Updates an already existing user in the database.- Parameters:
permissionUser- the user to be updated
-
deleteUser
void 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
void 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
-
getUsers
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
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(@Nullable @Nullable 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
void 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
-
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(@NotNull @NotNull java.util.Collection<? extends IPermissionGroup> groups)Clears all groups in the Cloud and sets given groups.- Parameters:
groups- the new groups
-
addUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> addUserAsync(@NotNull @NotNull IPermissionUser permissionUser)Adds a new user to the database.- Parameters:
permissionUser- the user to be added
-
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
-
deleteUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> 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
-
deleteUserAsync
@NotNull @NotNull de.dytanic.cloudnet.common.concurrent.ITask<java.lang.Void> deleteUserAsync(@NotNull @NotNull IPermissionUser permissionUser)Deletes one user with the uniqueId of the given user.- Parameters:
permissionUser- the user to be deleted
-
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
-
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.
-
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
-
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.
- 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<java.lang.Void> 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
-
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
-
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
-
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
-
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
-
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(@NotNull @NotNull java.util.Collection<? extends IPermissionGroup> groups)Clears all groups in the Cloud and sets given groups.- Parameters:
groups- the new groups
-
-