Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't delete roles #6

Open
fdorantesm opened this issue Aug 17, 2019 · 1 comment
Open

Can't delete roles #6

fdorantesm opened this issue Aug 17, 2019 · 1 comment

Comments

@fdorantesm
Copy link

Hi, i've used this mongoose adapter to handle rules in mongodb, I can't delete roles, what i'm doing wrong?

static async getInstance() {
    const adapter = await Adapter.newAdapter(db.uri, db.config);
    const model = `${process.env.STORAGE_PATH}/casbin/rbac.conf`;
    return casbin.newEnforcer(model, adapter);
  }

Assign roles works properly.

static async assignRole(identifier, role, domain = '*') {
    const enforcer = await Enforcer.getInstance();
    return enforcer.addRoleForUser(identifier, role, domain);
  }

deleteRoleForUser returns false

static async revokeRole(identifier, role, domain = 'admin') {
    const enforcer = await Enforcer.getInstance();
    console.log(identifier, role, domain);
    return enforcer.deleteRoleForUser(identifier, role);
  }

deleteRolesForUser returns false

static async revokeRoles(identifier) {
    const enforcer = await Enforcer.getInstance();
    return enforcer.deleteRolesForUser(identifier);
}
@hsluoyz
Copy link
Contributor

hsluoyz commented Nov 23, 2019

@fdorantesm This repo seems to be dead. Use this instead: https://github.com/node-casbin/mongoose-adapter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants