Skip to content

Commit

Permalink
feat: Return effect policies at RemoveFilteredPolicy
Browse files Browse the repository at this point in the history
Signed-off-by: Sagilio <Sagilio@outlook.com>
  • Loading branch information
sagilio committed Apr 1, 2021
1 parent 623d64b commit 171ae6e
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 151 deletions.
1 change: 0 additions & 1 deletion NetCasbin/Abstractions/IEnforcer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public interface IEnforcer

public string ModelPath { get; }
public bool IsFiltered { get; }

public IExpressionHandler ExpressionHandler { get; }

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion NetCasbin/Abstractions/IPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public IEnumerable<IEnumerable<string>> GetFilteredPolicy(string section, string

public bool RemovePolicies(string section, string policyType, IEnumerable<IEnumerable<string>> rules);

public bool RemoveFilteredPolicy(string section, string policyType, int fieldIndex, params string[] fieldValues);
public IEnumerable<IEnumerable<string>> RemoveFilteredPolicy(string section, string policyType, int fieldIndex, params string[] fieldValues);

public void ClearPolicy();
}
Expand Down
9 changes: 5 additions & 4 deletions NetCasbin/Enforcer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@

namespace Casbin
{
/// <summary>
/// CoreEnforcer defines the core functionality of an enforcer.
/// </summary>
public class Enforcer : IEnforcer
{
public Enforcer()
Expand Down Expand Up @@ -72,7 +69,6 @@ public Enforcer(IModel model, IAdapter adapter = null)

public string ModelPath { get; private set; }
public bool IsFiltered => Adapter is IFilteredAdapter {IsFiltered: true};

public IExpressionHandler ExpressionHandler { get; private set; }

#region Set options
Expand Down Expand Up @@ -379,6 +375,9 @@ public void ClearPolicy()
}

#endregion

#region Enforce method

/// <summary>
/// Decides whether a "subject" can access a "object" with the operation
/// "action", input parameters are usually: (sub, obj, act).
Expand Down Expand Up @@ -812,5 +811,7 @@ private static string RewriteEval(string expressionString, IDictionary<string, i
expressionString = Utility.ReplaceEval(expressionString, rules);
return expressionString;
}

#endregion
}
}
Loading

0 comments on commit 171ae6e

Please # to comment.