Class DefaultPermissionManagement
- java.lang.Object
-
- de.dytanic.cloudnet.driver.permission.DefaultPermissionManagement
-
- All Implemented Interfaces:
IPermissionManagement
- Direct Known Subclasses:
DefaultCachedPermissionManagement
public abstract class DefaultPermissionManagement extends java.lang.Object implements IPermissionManagement
-
-
Constructor Summary
Constructors Constructor Description DefaultPermissionManagement()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancanBeOverwritten()Gets if this permission management can be overridden.protected voidcollectAllGroupPermissionsInto(@NotNull java.util.Collection<Permission> target, @NotNull java.util.Collection<IPermissionGroup> groups, @Nullable java.lang.String[] taskGroups, @NotNull java.util.Collection<java.lang.String> travelledGroups)protected java.util.Collection<Permission>collectAllPermissions(@NotNull IPermissible permissible, @Nullable java.lang.String[] groups)protected java.util.Collection<Permission>collectAllPermissionsTo(@NotNull java.util.Collection<Permission> target, @NotNull IPermissible permissible, @Nullable java.lang.String[] groups)protected voidcollectPermissionsInto(@NotNull java.util.Collection<Permission> permissions, @NotNull IPermissible permissible, @Nullable java.lang.String[] groups)@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, java.lang.String group)Gets all permission of the specifiedpermissibleon the givengroup.IPermissionManagementgetChildPermissionManagement()Get the child permission management ornullif there is no child permission management.java.util.Collection<IPermissionGroup>getExtendedGroups(@Nullable IPermissionGroup group)Gets the extended groups of the specifiedgroup.@NotNull java.util.Collection<IPermissionGroup>getGroups(@Nullable IPermissible permissible)Gets the extended groups of the specifiedgroup.IPermissionGroupgetHighestPermissionGroup(@NotNull IPermissionUser permissionUser)Gets the highest permission group of the specified user, evaluated by using the group potency.@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.PermissionCheckResultgetPermissionResult(IPermissible permissible, java.util.function.Supplier<PermissionCheckResult> permissionTester, java.util.function.Function<IPermissionGroup,PermissionCheckResult> extendedGroupsTester)Deprecated.has no use internally anymore, will be removed in a further release.java.util.List<IPermissionUser>getUser(java.lang.String name)Deprecated.java.util.Collection<IPermissionUser>getUserByGroup(java.lang.String group)Deprecated.@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 usingIPermissionManagement.getGroupAsync(String)and, if not null, puts it into the consumer, after that, the group will be updated by usingIPermissionManagement.updateGroup(IPermissionGroup).@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 usingIPermissionManagement.getUserAsync(UUID)and, if not null, puts them into the consumer, after that, the user will be updated by usingIPermissionManagement.updateUser(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 usingIPermissionManagement.getUsersAsync(String)and puts them into the consumer, after that, every user will be updated by usingIPermissionManagement.updateUser(IPermissionUser).booleantestPermissible(@Nullable IPermissible permissible)Removes the timed-out permissions of the givenpermissible.booleantestPermissionGroup(@Nullable IPermissionGroup permissionGroup)Removes the timed-out permissions of the givenpermissionGroup.booleantestPermissionUser(@Nullable IPermissionUser permissionUser)Removes all timed-out permissions and groups of the givenpermissionUser.PermissionCheckResulttryExtendedGroups(@NotNull java.lang.String firstGroup, @Nullable IPermissionGroup permissionGroup, @NotNull Permission permission, int layer)Deprecated.has no use internally anymore, will be removed in a further release.PermissionCheckResulttryExtendedGroups(@NotNull java.lang.String firstGroup, @Nullable IPermissionGroup permissionGroup, @NotNull java.lang.String group, @NotNull Permission permission, int layer)Deprecated.has no use internally anymore, will be removed in a further release.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.dytanic.cloudnet.driver.permission.IPermissionManagement
addGroup, addGroup, addGroupAsync, addGroupAsync, addUser, addUser, addUserAsync, addUserAsync, containsGroup, containsGroupAsync, containsUser, containsUser, containsUserAsync, containsUserAsync, deleteGroup, deleteGroup, deleteGroupAsync, deleteGroupAsync, deleteUser, deleteUser, deleteUserAsync, deleteUserAsync, getDefaultPermissionGroup, getDefaultPermissionGroupAsync, getFirstUser, getFirstUserAsync, getGroup, getGroupAsync, getGroups, getGroupsAsync, getGroupsAsync, getOrCreateUser, getOrCreateUserAsync, getUser, getUserAsync, getUsers, getUsers, getUsersAsync, getUsersAsync, getUsersByGroup, getUsersByGroupAsync, hasPermission, hasPermission, hasPermission, init, modifyGroup, modifyUser, modifyUsers, reload, setGroups, setGroupsAsync, setUsers, setUsersAsync, updateGroup, updateGroupAsync, updateUser, updateUserAsync
-
-
-
-
Method Detail
-
getChildPermissionManagement
public IPermissionManagement getChildPermissionManagement()
Description copied from interface:IPermissionManagementGet the child permission management ornullif there is no child permission management.- Specified by:
getChildPermissionManagementin interfaceIPermissionManagement- Returns:
- the child permission management or
nullif there is no child permission management.
-
canBeOverwritten
public boolean canBeOverwritten()
Description copied from interface:IPermissionManagementGets if this permission management can be overridden.- Specified by:
canBeOverwrittenin interfaceIPermissionManagement- Returns:
- if this permission management can be overridden.
-
getUser
@Deprecated public java.util.List<IPermissionUser> getUser(java.lang.String name)
Deprecated.Description copied from interface:IPermissionManagementGets all users with the givenname.- Specified by:
getUserin interfaceIPermissionManagement- Parameters:
name- the name of the permission users to get.- Returns:
- all permission users with the given
name.
-
getUserByGroup
@Deprecated public java.util.Collection<IPermissionUser> getUserByGroup(java.lang.String group)
Deprecated.
-
getHighestPermissionGroup
public IPermissionGroup getHighestPermissionGroup(@NotNull @NotNull IPermissionUser permissionUser)
Description copied from interface:IPermissionManagementGets the highest permission group of the specified user, evaluated by using the group potency.- Specified by:
getHighestPermissionGroupin interfaceIPermissionManagement- Parameters:
permissionUser- the user- Returns:
- the highest permission group.
-
testPermissionGroup
public boolean testPermissionGroup(@Nullable @Nullable IPermissionGroup permissionGroup)Description copied from interface:IPermissionManagementRemoves the timed-out permissions of the givenpermissionGroup.- Specified by:
testPermissionGroupin interfaceIPermissionManagement- Parameters:
permissionGroup- the group to check.- Returns:
trueif at least one permission was removed.
-
testPermissionUser
public boolean testPermissionUser(@Nullable @Nullable IPermissionUser permissionUser)Description copied from interface:IPermissionManagementRemoves all timed-out permissions and groups of the givenpermissionUser.- Specified by:
testPermissionUserin interfaceIPermissionManagement- Parameters:
permissionUser- the permission user to check.- Returns:
trueif at least one permission was removed.
-
testPermissible
public boolean testPermissible(@Nullable @Nullable IPermissible permissible)Description copied from interface:IPermissionManagementRemoves the timed-out permissions of the givenpermissible.- Specified by:
testPermissiblein interfaceIPermissionManagement- Parameters:
permissible- the permissible to check.- Returns:
trueif at least one permission was removed.
-
getGroups
@NotNull public @NotNull java.util.Collection<IPermissionGroup> getGroups(@Nullable @Nullable IPermissible permissible)
Description copied from interface:IPermissionManagementGets the extended groups of the specifiedgroup.- Specified by:
getGroupsin interfaceIPermissionManagement- Parameters:
permissible- the permissible to get the extended groups of.- Returns:
- the extended groups of the given
permissible.
-
getExtendedGroups
public java.util.Collection<IPermissionGroup> getExtendedGroups(@Nullable @Nullable IPermissionGroup group)
Description copied from interface:IPermissionManagementGets the extended groups of the specifiedgroup.- Specified by:
getExtendedGroupsin interfaceIPermissionManagement- Parameters:
group- the group to get the extended groups of.- Returns:
- the extended groups of the given
group.
-
getPermissionResult
@NotNull public @NotNull PermissionCheckResult getPermissionResult(@NotNull @NotNull IPermissible permissible, @NotNull @NotNull java.lang.String permission)
Description copied from interface:IPermissionManagementChecks if the givenpermissiblehas the givenpermission.- Specified by:
getPermissionResultin interfaceIPermissionManagement- 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 public @NotNull PermissionCheckResult getPermissionResult(@NotNull @NotNull IPermissible permissible, @NotNull @NotNull Permission permission)
Description copied from interface:IPermissionManagementChecks if the givenpermissiblehas the givenpermission.- Specified by:
getPermissionResultin interfaceIPermissionManagement- 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 public @NotNull PermissionCheckResult getPermissionResult(@NotNull @NotNull IPermissible permissible, @NotNull @NotNull java.lang.String group, @NotNull @NotNull Permission permission)
Description copied from interface:IPermissionManagementChecks if the givenpermissiblehas the givenpermission.- Specified by:
getPermissionResultin interfaceIPermissionManagement- 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 public @NotNull PermissionCheckResult getPermissionResult(@NotNull @NotNull IPermissible permissible, @NotNull @NotNull java.lang.Iterable<java.lang.String> groups, @NotNull @NotNull Permission permission)
Description copied from interface:IPermissionManagementChecks if the givenpermissiblehas the givenpermission.- Specified by:
getPermissionResultin interfaceIPermissionManagement- 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 public @NotNull PermissionCheckResult getPermissionResult(@NotNull @NotNull IPermissible permissible, @NotNull @NotNull java.lang.String[] groups, @NotNull @NotNull Permission permission)
Description copied from interface:IPermissionManagementChecks if the givenpermissiblehas the givenpermission.- Specified by:
getPermissionResultin interfaceIPermissionManagement- 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 public @Nullable Permission findHighestPermission(@NotNull @NotNull java.util.Collection<Permission> permissions, @NotNull @NotNull Permission permission)
Description copied from interface:IPermissionManagementFinds the highest permission (sorted by the potency) in the givenpermissionsarray using the givenpermissionpotency as the starting point.- Specified by:
findHighestPermissionin interfaceIPermissionManagement- 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
-
collectAllPermissions
protected java.util.Collection<Permission> collectAllPermissions(@NotNull @NotNull IPermissible permissible, @Nullable @Nullable java.lang.String[] groups)
-
collectAllPermissionsTo
protected java.util.Collection<Permission> collectAllPermissionsTo(@NotNull @NotNull java.util.Collection<Permission> target, @NotNull @NotNull IPermissible permissible, @Nullable @Nullable java.lang.String[] groups)
-
collectAllGroupPermissionsInto
protected void collectAllGroupPermissionsInto(@NotNull @NotNull java.util.Collection<Permission> target, @NotNull @NotNull java.util.Collection<IPermissionGroup> groups, @Nullable @Nullable java.lang.String[] taskGroups, @NotNull @NotNull java.util.Collection<java.lang.String> travelledGroups)
-
collectPermissionsInto
protected void collectPermissionsInto(@NotNull @NotNull java.util.Collection<Permission> permissions, @NotNull @NotNull IPermissible permissible, @Nullable @Nullable java.lang.String[] groups)
-
getPermissionResult
@Deprecated @ScheduledForRemoval public PermissionCheckResult getPermissionResult(IPermissible permissible, java.util.function.Supplier<PermissionCheckResult> permissionTester, java.util.function.Function<IPermissionGroup,PermissionCheckResult> extendedGroupsTester)
Deprecated.has no use internally anymore, will be removed in a further release.
-
tryExtendedGroups
@Deprecated @ScheduledForRemoval public PermissionCheckResult tryExtendedGroups(@NotNull @NotNull java.lang.String firstGroup, @Nullable @Nullable IPermissionGroup permissionGroup, @NotNull @NotNull Permission permission, int layer)
Deprecated.has no use internally anymore, will be removed in a further release.
-
tryExtendedGroups
@Deprecated @ScheduledForRemoval public PermissionCheckResult tryExtendedGroups(@NotNull @NotNull java.lang.String firstGroup, @Nullable @Nullable IPermissionGroup permissionGroup, @NotNull @NotNull java.lang.String group, @NotNull @NotNull Permission permission, int layer)
Deprecated.has no use internally anymore, will be removed in a further release.
-
getAllPermissions
@NotNull public @NotNull java.util.Collection<Permission> getAllPermissions(@NotNull @NotNull IPermissible permissible)
Description copied from interface:IPermissionManagementGets all permission of the specifiedpermissible- Specified by:
getAllPermissionsin interfaceIPermissionManagement- Parameters:
permissible- the permissible to get the permission of.- Returns:
- all permissions of the permissible
-
getAllPermissions
@NotNull public @NotNull java.util.Collection<Permission> getAllPermissions(@NotNull @NotNull IPermissible permissible, java.lang.String group)
Description copied from interface:IPermissionManagementGets all permission of the specifiedpermissibleon the givengroup.- Specified by:
getAllPermissionsin interfaceIPermissionManagement- 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
-
modifyGroupAsync
@NotNull public @NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionGroup> modifyGroupAsync(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.util.function.Consumer<IPermissionGroup> modifier)
Description copied from interface:IPermissionManagementGets the permission group with the given name by usingIPermissionManagement.getGroupAsync(String)and, if not null, puts it into the consumer, after that, the group will be updated by usingIPermissionManagement.updateGroup(IPermissionGroup).- Specified by:
modifyGroupAsyncin interfaceIPermissionManagement- Parameters:
name- the name of the groupmodifier- the Consumer to modify the user- Returns:
- the modified user
-
modifyUserAsync
@NotNull public @NotNull de.dytanic.cloudnet.common.concurrent.ITask<IPermissionUser> modifyUserAsync(@NotNull @NotNull java.util.UUID uniqueId, @NotNull @NotNull java.util.function.Consumer<IPermissionUser> modifier)
Description copied from interface:IPermissionManagementGets the permission user with the given uniqueId by usingIPermissionManagement.getUserAsync(UUID)and, if not null, puts them into the consumer, after that, the user will be updated by usingIPermissionManagement.updateUser(IPermissionUser).- Specified by:
modifyUserAsyncin interfaceIPermissionManagement- Parameters:
uniqueId- the uniqueId of the usermodifier- the Consumer to modify the user- Returns:
- the modified user
-
modifyUsersAsync
@NotNull public @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)
Description copied from interface:IPermissionManagementGets every user matching the given name by usingIPermissionManagement.getUsersAsync(String)and puts them into the consumer, after that, every user will be updated by usingIPermissionManagement.updateUser(IPermissionUser).- Specified by:
modifyUsersAsyncin interfaceIPermissionManagement- Parameters:
name- the name of the usersmodifier- the Consumer to modify the available users- Returns:
- a list of all modified users
-
-