Package com.sk89q.worldedit.util.auth
Interface Subject
- All Known Subinterfaces:
Actor
,Player
,SessionOwner
- All Known Implementing Classes:
AbstractCommandBlockActor
,AbstractNonPlayerActor
,AbstractPlayerActor
,AsyncPlayer
,LocationMaskedPlayerWrapper
,PlayerProxy
,SilentPlayerWrapper
public interface Subject
A subject has authorization attached to it.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checkPermission
(String permission) Check whether this subject has been granted the given permission and throw an exception on error.String[]
Get a list of groups that this subject is a part of.boolean
hasPermission
(String permission) Return whether this subject has the given permission.void
setPermission
(String permission, boolean value) default boolean
togglePermission
(String permission) Add and remove permissions from a subject to show and hide certain messages.
-
Method Details
-
getGroups
String[] getGroups()Get a list of groups that this subject is a part of.- Returns:
- an array containing a group name per entry
-
checkPermission
Check whether this subject has been granted the given permission and throw an exception on error.- Parameters:
permission
- the permission- Throws:
AuthorizationException
- thrown if not permitted
-
hasPermission
Return whether this subject has the given permission.- Parameters:
permission
- the permission- Returns:
- true if permission is granted
-
togglePermission
Add and remove permissions from a subject to show and hide certain messages.- Parameters:
permission
- the permission- Returns:
- false if the permission was removed, true if this subject has permission
-
setPermission
-