Skip to content

Commit

Permalink
Merge pull request #53 from TomGrobbe/development
Browse files Browse the repository at this point in the history
# Fixed a critical permissions bug
If you used any `.All` permissions, everyone would get ALL permissions. This is now solved!
  • Loading branch information
TomGrobbe authored Mar 8, 2018
2 parents 3cc50e5 + 6e5c52b commit 5388624
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions vMenu/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ public static void SetPermissions(dynamic dict)
// Loop through the dynamic object and get the keys and values.
foreach (dynamic permission in dict)
{
if (DebugMode)
{
Cf.Log($"{permission.Key.ToString()} = {permission.Value.ToString()}");
}
// Add the new permission to the dictionary.
PermissionsManager.SetPermission(permission.Key.ToString(), permission.Value);
}
Expand Down
12 changes: 6 additions & 6 deletions vMenu/PermissionsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,18 @@ public static bool IsAllowed(Permission permission)
{
if (perms.Contains("Everything"))
{
if (MainMenu.DebugMode)
{
MainMenu.Cf.Log("Everything allowed, breaking.");
}
return true;
}
else
{
var allowed = false;
foreach (var p in Enum.GetNames(typeof(Permission)))
if (perms.Contains(permission.ToString().Substring(0,2) + "All"))
{
if (perms.Contains(p.Substring(0, 2) + "All"))
{
allowed = true;
break;
}
allowed = true;
}

if (!allowed)
Expand Down

0 comments on commit 5388624

Please sign in to comment.