Config file permissions cleanup

Removed deprecated 'restricted-commands' section.
Deprecated 'superperms' toggle.
Remove op override on essentials permissions.
Give op's all permissions by default via superperms.
This commit is contained in:
KHobbits 2012-09-16 20:27:35 +01:00
parent b9195a561f
commit f701090c89
7 changed files with 21 additions and 71 deletions

View File

@ -92,10 +92,6 @@ public interface ISettings extends IConf
boolean isCommandOverridden(String name);
boolean isCommandRestricted(IEssentialsCommand cmd);
boolean isCommandRestricted(String label);
boolean isDebug();
boolean isEcoDisabled();

View File

@ -146,26 +146,6 @@ public class Settings implements ISettings
return disCommands;
}
@Override
public boolean isCommandRestricted(IEssentialsCommand cmd)
{
return isCommandRestricted(cmd.getName());
}
@Override
public boolean isCommandRestricted(String label)
{
for (String c : config.getStringList("restricted-commands"))
{
if (!c.equalsIgnoreCase(label))
{
continue;
}
return true;
}
return config.getBoolean("restrict-" + label.toLowerCase(Locale.ENGLISH), false);
}
@Override
public boolean isPlayerCommand(String label)
{

View File

@ -63,20 +63,22 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
@Override
public boolean isAuthorized(final String node)
{
final boolean result = isAuthorizedCheck(node);
if (ess.getSettings().isDebug())
{
ess.getLogger().log(Level.INFO, "checking if " + base.getName() + " has " + node);
ess.getLogger().log(Level.INFO, "checking if " + base.getName() + " has " + node + " - " + result);
}
return result;
}
private boolean isAuthorizedCheck(final String node)
{
if (base instanceof OfflinePlayer)
{
return false;
}
if (isOp())
{
return true;
}
if (isJailed())
{
return false;

View File

@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class ConfigPermissionsHandler implements IPermissionsHandler
public class ConfigPermissionsHandler extends SuperpermsHandler
{
private final transient IEssentials ess;
@ -15,47 +15,17 @@ public class ConfigPermissionsHandler implements IPermissionsHandler
this.ess = (IEssentials)ess;
}
@Override
public String getGroup(final Player base)
{
return null;
}
@Override
public List<String> getGroups(final Player base)
{
return null;
}
@Override
public boolean canBuild(final Player base, final String group)
{
return true;
}
@Override
public boolean inGroup(final Player base, final String group)
{
return false;
}
@Override
public boolean hasPermission(final Player base, final String node)
{
final String[] cmds = node.split("\\.", 2);
return !ess.getSettings().isCommandRestricted(cmds[cmds.length - 1])
&& ess.getSettings().isPlayerCommand(cmds[cmds.length - 1]);
return ess.getSettings().isPlayerCommand(cmds[cmds.length - 1]) || super.hasPermission(base, node);
}
@Override
public String getPrefix(final Player base)
{
return null;
}
@Override
public String getSuffix(final Player base)
{
return null;
}
}

View File

@ -200,7 +200,8 @@ public class PermissionsHandler implements IPermissionsHandler
{
if (!(handler instanceof ConfigPermissionsHandler))
{
LOGGER.log(Level.INFO, "Essentials: Using config based permissions. Enable superperms in config.");
LOGGER.log(Level.INFO, "Essentials: Using config file enhanced permissions.");
LOGGER.log(Level.INFO, "Permissions listed in as player-commands will be given to all users.");
handler = new ConfigPermissionsHandler(plugin);
}
}

View File

@ -96,10 +96,10 @@ overridden-commands:
disabled-commands:
# - nick
# Restricted commands have been removed.
# Now we have a whitelist, all commands not on this list are only available to ops.
# These will have NO EFFECT if you have Permissions installed!
# They are here only if you want something simpler than Permissions.
# If you do not wish to use a permission system, you can define a list of 'player perms' below.
# This list has no effect if your using a supported permissions system.
# If your using an unsupported permissions system simply delete this section.
# Whitelist the commands and permissions you wish to give players by default (everything else is op only).
# These are the permissions without the "essentials." part.
player-commands:
- afk
@ -260,10 +260,6 @@ debug: false
# Turn off god mode when people exit
remove-god-on-disconnect: false
# Use the permission system of bukkit
# This only works if no other permission plugins are installed
use-bukkit-permissions: false
# Auto-AFK
# After this timeout in seconds, the user will be set as afk.
# Set to -1 for no timeout.

View File

@ -450,3 +450,8 @@ commands:
description: Calculates the worth of items in hand or as specified.
usage: /<command> [item] [amount]
aliases: [eworth,price,eprice]
permissions:
essentials.*:
default: op
description: Give op's everything by default