feat: upgrade to casbin v2 (#10)

* feat: upgrade to casbin v2

* fix ci, update lang version, cleanup

* cleanup ci

* fix syntax

---------

Co-authored-by: Mitch Freed <mitch@wilqo.com>
15 files changed
tree: 1aa9c570fff5dd20bb705ff0291bf3ca576ad993
  1. .github/
  2. Casbin.Watcher.Redis/
  3. Casbin.Watcher.Redis.UnitTest/
  4. .gitignore
  5. .releaserc.json
  6. LICENSE
  7. README.md
  8. Redis-Watcher.sln
README.md

redis-watcher

Actions Status Coverage Status License Nuget

Redis watcher for Casbin.NET

Installation

dotnet add package Casbin.Watcher.Redis

Simple Example

using Casbin;
using Redis.Casbin.NET;

public class Program
{
    public static void Main(string[] args)
    {
        // Initialize the watcher.
        // Use the Redis host as parameter.
        var watcher = new RedisWatcher("127.0.0.1:6379");

        // Initialize the enforcer.
        var enforcer = new Enforcer("examples/rbac_model.conf", "examples/rbac_policy.csv");

        // Set the watcher for the enforcer.
        enforcer.SetWatcher(watcher);

        // Update the policy to test the effect.
        enforcer.SavePolicy();
    }
}

Getting Help

License

This project is under Apache 2.0 License. See the LICENSE file for the full license text.