Fix an oversight

This commit is contained in:
MarioE 2012-08-19 21:16:16 -04:00
parent 5e14d751b9
commit 25752ff710

View file

@ -174,14 +174,18 @@ namespace TShockAPI
/// <returns>Returns true if the user has that permission.</returns> /// <returns>Returns true if the user has that permission.</returns>
public virtual bool HasPermission(string permission) public virtual bool HasPermission(string permission)
{ {
if (String.IsNullOrEmpty(permission) || RealHasPermission(permission))
{
return true;
}
string[] nodes = permission.Split('.'); string[] nodes = permission.Split('.');
for (int i = nodes.Length - 1; i >= 0; i--) for (int i = nodes.Length - 1; i >= 0; i--)
{ {
if (RealHasPermission(String.Join(".", nodes))) nodes[i] = "*";
if (RealHasPermission(String.Join(".", nodes, 0, i + 1)))
{ {
return true; return true;
} }
nodes[i] = "*";
} }
return false; return false;
} }