casbin / jcasbin

An authorization library that supports access control models like ACL, RBAC, ABAC in Java

Home Page:https://casbin.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

while I try to remove group from casbin, only the data in memory is deleted, it still exist in mysql

yu-hailong opened this issue · comments

  1. create policy , it is normal : I can find it in memory and mysql

  2. I try to remove them using
    enforcer.removeFilteredNamedPolicy(pType,0,e);
    enforcer.removeGroupingPolicy(id, parentId);
    remove p and g policy, but I found the data in memory is removed, but the data in mysql is still there

  3. version info:

    <dependency>
        <groupId>org.casbin</groupId>
        <artifactId>jcasbin</artifactId>
        <version>1.21.0</version>
    </dependency>
    <dependency>
        <groupId>org.casbin</groupId>
        <artifactId>jdbc-adapter</artifactId>
        <version>2.2.1</version>
        <exclusions>
            <exclusion>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.casbin</groupId>
        <artifactId>jcasbin-redis-watcher</artifactId>
        <version>1.4.1</version>
    </dependency>
commented

The reason is that the retry mechanism used by addPolicy() in jdbc-adapter-2.2.1 turned off the autocommit of the connection and forgot to reopen it, resulting in no automatic commit in removePolicy.

It's has been fixed in jcasbin/jdbc-adapter#50. Try jdbc-adapter lastest version.