casbin / Casbin.NET

An authorization library that supports access control models like ACL, RBAC, ABAC in .NET (C#)

Home Page:https://casbin.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Updating Policies directly on the IPolicyStore model not reflected in Enforcer

amopitt opened this issue · comments

I am modifying the group policies dynamically listening to event messages using syntax below (this is on 2.0.0-preview.4, still need to update here):

    public static bool AddGroupPolicy(this IPolicyStore model, GroupPolicy policy)
    {
        return model.AddGroupPolicies(new[] { policy });
    }

I see that the PolicyManager reflects the changes, nothing errors. However when I call EnforceAsync I still get a Forbidden error. I am just asking generically is there something else that needs to be done that I am missing? AutoSave is set to true. Inspecting through breakpoints shows that my group policy is valid. If I were to call LoadPolicy on the exact same model it will then work as expected so something is off with what I'm doing.

@amopitt It needs not some work else to do, I think the wrong may be caused by BuildIncrementalRoleLink or cache logic. Could you get me a sample or test to reproduce this case?

@amopitt any update?

Closed as stale.