Unable to read display value of current user role from Portal user

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

Like 0

Like

1 comments
Best reply

Hi Sourav,

 

I was able to achieve the result needed by adding the "System administration object" schema to the "List of objects available for portal users" lookup and relogin under the portal user. Try the same approach on your side, it should work.

Hi Sourav,

 

I was able to achieve the result needed by adding the "System administration object" schema to the "List of objects available for portal users" lookup and relogin under the portal user. Try the same approach on your side, it should work.

Show all comments