Hi Team,
I am trying to read the current user's role by using the following custom logic.
GetCurrentUserRole: function(){
var scope = this;
var esq = Ext.create("Terrasoft.EntitySchemaQuery", {rootSchemaName: "SysUserInRole"});
esq.addColumn("SysRole");
esq.filters.add("UserFilter", Terrasoft.createColumnFilterWithParameter(
Terrasoft.ComparisonType.EQUAL, "SysUser", Terrasoft.SysValue.CURRENT_USER.value
));
esq.getEntityCollection(function(result) {
if (!result.success || result.collection.getItems().length === 0) {return;}
result.collection.each(function(item) {
var role = item.get("SysRole");
var roleName = role.displayValue;
var roleId = role.value;
this.console.log("roleName: ",roleName);
});
}, this);
return true;
},
The above code works perfectly fine while logged in as a Normal user, but the same doesn't work for Portal users. For portal users, the "roleId" variable gives the correct Id but the variable "roleName" shows as a blank string("") because it is not reading the displayValue.
To address the issue, I have added "SysUserInRole" and "SysAdminUnit" in the lookup named "List of objects available for portal users". Also the Object permissions for both the tables are default. But still no luck in getting the desired output.
Request any suggestions or additional steps that I need to perform to get the displayValue of current user role while logged in as a portal user.
Regards,
Sourav Kumar Samal