Skip to content

dmolochnikov/Casbin.NET-Redis-Watcher

 
 

Repository files navigation

Redis Watcher

Build status Coverage Status Nuget Release Nuget

Redis Watcher is a Redis watcher for Casbin.NET.

Installation

dotnet add package Casbin.NET.Watcher.Redis

Simple Example

using NetCasbin;
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

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%