use of org.cubeengine.libcube.service.permission.PermissionManager in project core by CubeEngine.
the class ContainerCommand method addCommand.
@Override
public boolean addCommand(CommandBase command) {
if (!(command instanceof AliasCommand) && command.getDescriptor() instanceof CubeDescriptor) {
PermissionManager pm = manager.getPermissionManager();
Class owner = getDescriptor().getOwner();
Permission basePerm = pm.getBasePermission(owner);
Permission cmdPerm = pm.getPermission(basePerm.getId() + ".command");
if (cmdPerm == null) {
// TODO Description for BaseCommand Permission
cmdPerm = pm.register(owner, "command", "Allows using all commands for this module", null);
}
// gets the container permission
Permission thisPerm = getDescriptor().registerPermission(pm, cmdPerm);
// register the added cmd permission
((CubeDescriptor) command.getDescriptor()).registerPermission(pm, thisPerm);
}
return super.addCommand(command);
}
Aggregations