Can someone show how to get current logged user? And how to chek his permissions, because this doesn't work?
var user = (UserDefinition)Authorization.UserDefinition;
if (!Authorization.HasPermission(PermissionKeys.Tenants))
query.Where(fldTenantId == user.TenantId);
Thank you!
The easiest way is to use the Context
object
to get the user id
Context.User.GetIdentifier()
to get the user name
Context.User.Identity.Name
To get the permissions you can use:
Context.Permissions
and Context.Permissions.HasPermission