Hello,
How can I get if the authenticated user in the JS files and also the role?
How can I get if the authenticated user in the JS files and also the role?
const hasRole = (this.getUser().attributes.rolesIds || []).includes(targetRoleId);
"recordViews": { "detail": "custom:views/record/camera-detail" }, .................... define('custom:views/record/camera-detail', ['views/record/detail'], function (Dep) { return Dep.extend({ setup: function () { Dep.prototype.setup.call(this); console.log(`camera detail custom view `,this); // const hasRole = (this.getUser().attributes.rolesIds || []).includes(targetRoleId); console.log('role = ',this.getUser().attributes.rolesIds); // <-- undefined }, }); });
Comment