public abstract class PermissionModule extends IzouModule
For example, socket connections are generally allowed for Izou addOns yet in order to use them their usage has to be declared in the addon_config.properties file of the addOn.
Thus PermissionModule
implements a registration system for services like socket connection.
log, main
Modifier and Type | Method and Description |
---|---|
abstract boolean |
canCheckPermission(Permission permission)
returns true if able to check permissions
|
abstract void |
checkPermission(Permission permission,
AddOnModel addon)
Checks if the given addOn is allowed to access the requested service.
|
SecurityManager |
getSecurityManager()
returns an instance of SecurityManager
|
boolean |
isRegistered(AddOnModel addon)
Checks if an addOn is registered with this PermissionModule
|
void |
registerAddOn(AddOnModel addon)
Adds an addOn to the registered addOns list for this PermissionModule
|
protected <X extends IzouPermissionException> |
registerOrThrow(AddOnModel addOn,
java.util.function.Supplier<X> exceptionSupplier,
java.util.function.Function<ro.fortsoft.pf4j.PluginDescriptor,Boolean> checkPermission)
registers the addon if checkPermission returns true, else throws the exception provided by the exceptionSupplier.
|
debug, debug, error, error, fatal, fatal, getID, getMain
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isOwner
public SecurityManager getSecurityManager()
public abstract boolean canCheckPermission(Permission permission)
permission
- the permission to checkpublic void registerAddOn(AddOnModel addon)
addon
- the Identifiable to addpublic boolean isRegistered(AddOnModel addon)
addon
- the identifiable to checkpublic abstract void checkPermission(Permission permission, AddOnModel addon) throws SecurityException
addon
- the identifiable to checkpermission
- the Permission to checkSecurityException
- thrown if the addOn is not allowed to access its requested serviceprotected <X extends IzouPermissionException> void registerOrThrow(AddOnModel addOn, java.util.function.Supplier<X> exceptionSupplier, java.util.function.Function<ro.fortsoft.pf4j.PluginDescriptor,Boolean> checkPermission)
addOn
- the addon to checkcheckPermission
- returns true if eligible for registeringCopyright © 2016. All rights reserved.