-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Revert "fix: fix bugs in policy equal and persist (#347)" This reverts commit 3306375. * Revert "feat: fix null value handling logic (#337)" This reverts commit 54db948. * feat: compatible with unexpected policy Signed-off-by: sagilio <sagilio@outlook.com> --------- Signed-off-by: sagilio <sagilio@outlook.com> Co-authored-by: sagilio <sagilio@outlook.com>
- Loading branch information
1 parent
9cecadd
commit 442a59d
Showing
21 changed files
with
1,193 additions
and
694 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
Casbin.UnitTests/Extensions/Enforcer/ManagementEnforcerExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Collections.Generic; | ||
using Casbin.Model; | ||
using Xunit; | ||
|
||
namespace Casbin.UnitTests.Extensions; | ||
|
||
internal static class ManagementEnforcerExtension | ||
{ | ||
internal static void TestGetPolicy(this IEnforcer e, IReadOnlyList<IPolicyValues> exceptedValues) | ||
{ | ||
IEnumerable<IEnumerable<string>> actualValues = e.GetPolicy(); | ||
Assert.True(exceptedValues.DeepEquals(actualValues)); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Casbin.UnitTests/Extensions/Model/RequestValuesExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Collections.Generic; | ||
using Casbin.Model; | ||
|
||
namespace Casbin.UnitTests.Extensions; | ||
|
||
internal static class RequestValuesExtension | ||
{ | ||
internal static IEnumerable<string> ToEnumerable(this IRequestValues values) | ||
{ | ||
string[] res = new string[values.Count]; | ||
for (int i = 0; i < values.Count; i++) | ||
{ | ||
res[i] = values[i]; | ||
} | ||
|
||
return res; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Generic; | ||
|
||
namespace Casbin.Model; | ||
|
||
public interface IPolicyValues : IList<string> | ||
public interface IPolicyValues : IReadOnlyList<string> | ||
{ | ||
public new string this[int index] { get; } | ||
|
||
public string ToText(); | ||
|
||
public bool Equals(IPolicyValues other); | ||
|
||
int GetRealCount(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.