Enonic version: 7.12.1
OS: Linux
Can you please tell me how to add roles to user with authLib.
I didn’t find it in the doc - Authentication Library - Enonic Developer Portal
Can you please tell me how to add roles to user with authLib.
I didn’t find it in the doc - Authentication Library - Enonic Developer Portal
Have you tried addMembers()
?
Example:
var authLib = require('/lib/xp/auth.js');
authLib.addMembers('role:myRole', ['user:myUsers:myUserName']);
Thanks a lot, that works perfect!
I was a bit confusing about authLib.addMembers
function (what is principal and what is members and there were no example in the doc), but now it’s clear.