diff --git a/NetCasbin/Enforcer.cs b/NetCasbin/Enforcer.cs index 062be63a..75d7ab4f 100644 --- a/NetCasbin/Enforcer.cs +++ b/NetCasbin/Enforcer.cs @@ -564,12 +564,11 @@ public IEnumerable GetImplicitUsersForPermission(params string[] permiss public IEnumerable GetImplicitUsersForPermission(IEnumerable permissions) { - var policySubjects = GetAllSubjects(); - var groupInherit = model.GetValuesForFieldInPolicyAllTypes("g", 1); - var groupSubjects = model.GetValuesForFieldInPolicyAllTypes("g", 0); - return policySubjects.Concat(groupSubjects).Distinct() - .Where(subject => Enforce(new[]{ subject }.Concat(permissions).Cast().ToArray())) - .Except(groupInherit); + List policySubjects = GetAllSubjects(); + List groupInherit = model.GetValuesForFieldInPolicyAllTypes("g", 1); + List groupSubjects = model.GetValuesForFieldInPolicyAllTypes("g", 0); + return policySubjects.Concat(groupSubjects).Distinct().Except(groupInherit) + .Where(subject => Enforce(new[]{ subject }.Concat(permissions).Cast().ToArray())); } #endregion