Can not add role for a user in case g = _, _, _
See original GitHub issueI 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:
- Created 5 years ago
- Comments:18 (18 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi. The
domain
param has been added, see: https://github.com/casbin/node-casbin/commit/e876217bcf4e352fc73bd98949c74812661c0e47 and https://github.com/casbin/node-casbin/commit/290355f9c411d7ca929c2a2752a379729e6ba4b0OK It’s a pity 😦