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

Check permission but always getting false #66

Open
HetalSavaliya opened this issue Dec 10, 2021 · 2 comments
Open

Check permission but always getting false #66

HetalSavaliya opened this issue Dec 10, 2021 · 2 comments

Comments

@HetalSavaliya
Copy link

HetalSavaliya commented Dec 10, 2021

 var rbac = new RBAC({
      roles: ["superadmin", "admin", "user", "guest"],
      permissions: {
        user: ["create", "delete"],
        password: ["change", "forgot"],
        article: ["create"],
        rbac: ["update"],
      },
      grants: {
        guest: ["create_user", "forgot_password"],
        user: ["change_password"],
        admin: ["user", "delete_user", "update_rbac"],
        superadmin: ["admin"],
      },
    });
    await rbac.init();
  let permission = await  rbac.can("admin", "create", "artical")

Get permission as always false
I don't know what is missing the above code.

@gurusishyan
Copy link

let permission = await rbac.can("admin", "create", "artical") should be changed to let permission = await rbac.can("admin", "create", "article")

@AbhinayPoloju
Copy link

artical->article (permission variable declaration ine)
and double check the configuration, it feels like you missed the setup of roles,permissions and grantss

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

3 participants