question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not add role for a user in case g = _, _, _

See original GitHub issue

I have the following role definition:

[role_definition]
g = _, _, _

But, when I am trying to add a role for a user, the function addRoleForUser accepts only two parameters (it is hardcoded), so I can not provide the domain.

Here is the test-case I wrote to check that:

    it('Should properly add new role to user and remove it from the enforcer', async () => {
        const enforcer = await getEnforcer();

        assert.deepEqual(await enforcer.getGroupingPolicy(), []);
        // here I am trying to add role, but signature for the method accepts only user and role
        assert.isTrue(await enforcer.addRoleForUser('subject', 'role', 'domain'));
    });

So, as a result, I am getting the following error:

Error: grouping policy elements do not meet role definition
      at Assertion.buildRoleLinks (node_modules/casbin/lib/model/assertion.js:40:23)
      at astMap.forEach.value (node_modules/casbin/lib/model/model.js:123:19)
      at Map.forEach (<anonymous>)
      at Model.buildRoleLinks (node_modules/casbin/lib/model/model.js:122:16)
      at Enforcer.buildRoleLinks (node_modules/casbin/lib/coreEnforcer.js:246:20)
      at Enforcer.<anonymous> (node_modules/casbin/lib/managementEnforcer.js:339:22)
      at Generator.next (<anonymous>)
      at fulfilled (node_modules/casbin/lib/managementEnforcer.js:17:58)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

Use Case: Super Admin Role Change
The “Revoke Super Admin” action will revoke the user's super admin access in the Google Admin Console, and change their account status in...
Read more >
Assign eDiscovery permissions in the compliance portal
Assign the permissions required to perform eDiscovery-related tasks using the Microsoft Purview compliance portal.
Read more >
Managing owners, users, and permissions - Search Console ...
To add a new user or delegated owner. Choose a property in Search Console. ... in the navigation pane. Click Users & permissions....
Read more >
Manage access to projects, folders, and organizations
To grant a role to a principal who does not already have other roles, click person_add Add principal, then enter the principal's email...
Read more >
How To Allow Group Manager To Add Other Users To G...
It looks like for the manager to add new users to the group, and they would need to both have the security admin...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found