User module

The User module allows you to get attributes on the user running the application. You can use the following methods from the User module:

  • GetCurrentUser(): retrieves the current user object.
  • InRole(‘rolename’): determines if a user is in the specified role (rolename), and returns a boolean value.
  • Properties.Get(‘propertyname’): retrieves the property name from the specified user. For example, you can retrieve the userPrincipalName or mail properties. Available property names depend on the user type.
  • When you retrieve the current user object in your script, you can also use user object properties. The following user object properties are applicable to all directory sources.

  • DisplayName (string)
  • Username (string)
  • Mail (string)
  • Uuid (string)
  • UserType (string)
  • DirectoryServiceUuid (string)

For example, to get the current user’s DisplayName attribute:

var usermod = module("User");
var user = usermod.GetCurrentUser();
trace("DisplayName:" + user.DisplayName);