From b8f0ac9639ef0cdb3256052043a223e0a8cbda38 Mon Sep 17 00:00:00 2001 From: Phineapple18 <78623655+Phineapple18@users.noreply.github.com> Date: Sat, 26 Oct 2024 23:21:12 +0200 Subject: [PATCH 1/2] Update PermissionHandler.cs --- NWAPIPermissionSystem/PermissionHandler.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/NWAPIPermissionSystem/PermissionHandler.cs b/NWAPIPermissionSystem/PermissionHandler.cs index 42371ad..6491748 100644 --- a/NWAPIPermissionSystem/PermissionHandler.cs +++ b/NWAPIPermissionSystem/PermissionHandler.cs @@ -162,12 +162,15 @@ public static bool CheckGroupPermission(Group group, string permission) if (group.CombinedPermissions.Contains(".*")) return true; string[] sp = permission.Split('.'); - if (sp.Length != 1) - if (group.CombinedPermissions.Contains(sp[0] + ".*")) - return true; if (sp.Length == 1) if (group.CombinedPermissions.Any(perm => perm.StartsWith(sp[0]))) return true; + if (sp.Length == 2) + if (group.CombinedPermissions.Contains(sp[0] + ".*")) + return true; + if (sp.Length == 3) + if (group.CombinedPermissions.Contains(sp[0] + "." + sp[1] + ".*")) + return true; foreach(var perm in group.CombinedPermissions) if (perm == permission) return true; From 40cb914a3f7ec583b6a94bcea6c6030e7d1f0dd5 Mon Sep 17 00:00:00 2001 From: Phineapple18 <78623655+Phineapple18@users.noreply.github.com> Date: Sat, 26 Oct 2024 23:21:35 +0200 Subject: [PATCH 2/2] Update PermissionHandler.cs --- NWAPIPermissionSystem/PermissionHandler.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/NWAPIPermissionSystem/PermissionHandler.cs b/NWAPIPermissionSystem/PermissionHandler.cs index 6491748..a80821f 100644 --- a/NWAPIPermissionSystem/PermissionHandler.cs +++ b/NWAPIPermissionSystem/PermissionHandler.cs @@ -165,12 +165,12 @@ public static bool CheckGroupPermission(Group group, string permission) if (sp.Length == 1) if (group.CombinedPermissions.Any(perm => perm.StartsWith(sp[0]))) return true; - if (sp.Length == 2) - if (group.CombinedPermissions.Contains(sp[0] + ".*")) - return true; - if (sp.Length == 3) - if (group.CombinedPermissions.Contains(sp[0] + "." + sp[1] + ".*")) - return true; + if (sp.Length == 2) + if (group.CombinedPermissions.Contains(sp[0] + ".*")) + return true; + if (sp.Length == 3) + if (group.CombinedPermissions.Contains(sp[0] + "." + sp[1] + ".*")) + return true; foreach(var perm in group.CombinedPermissions) if (perm == permission) return true;