Idira Identity - User Object Reference for Dynamic Roles
Objective
Complete reference for Idira Identity User object in Dynamic Role scripts. Includes enumeration script and documentation showing all 25 available properties, methods, and usage. Covers limitations, workarounds, and differences between Dynamic Roles vs Application Policies. Essential for Identity admins working with RBAC.
Environment
Identity Other (Service)
Procedure
- Open Idira Identity Admin Portal
- Navigate to: Access > Roles
- Create New Role: Click "Add Role" or edit existing role
- Enable Dynamic Role: Check "This is a dynamic role based on a script"
- Paste Script: Copy contents of
user-object-reference.jsinto the script editor - Test Script:
- Click "Test User" button
- Select a test user from the list
- Click "Test"
- Review Trace Output: Check the trace output to see all available User properties and their values
Note: The script will show different properties depending on the user type (Cloud Directory vs Active Directory).
User.Uuid // User's UUID
User.Username // Username
User.DisplayName // Display name
User.Mail // Email address
User.UserType // "CUS" (Cloud), "AD", "FDS", "LDAP"
User.DirectoryServiceUuid // Directory service UUID
User.RiskLevel // "No Risk", "Low", "Medium", "High", "Unknown"
User.IsIdentityCookiePresent // Boolean
User.IsYubikeyOtpConfigured // Boolean
User.OrgId // Organization ID (usually null)
User.Properties // DataEntity object
These are the ONLY properties available in Dynamic Role scripts:
User.Get('Alias') // User alias
User.Get('CreateDate') // Account creation date
User.Get('DisplayName') // Display name
User.Get('InEverybodyRole') // Boolean (True/False)
User.Get('LastModifiedDate') // Last modification date
User.Get('LastPasswordChangeDate') // Password change date
User.Get('Mail') // Email address
User.Get('MobileNumber') // Mobile phone
User.Get('Name') // Username
User.Get('OauthClient') // Boolean (False for regular users)
User.Get('ReportsTo') // Manager/supervisor
User.Get('role_membership') // Role names
User.Get('State') // Value: "None" (not useful)
User.Get('Version') // Version number
Note: Custom attributes for Cloud Directory users use underscore suffix (e.g., country_, department_).
var email = User.Get('Mail');
var dept = User.Get('department_'); // Custom attribute
var email = User.Properties.Get('Mail');
var dept = User.Properties.Get('department_');
Both methods are equivalent.
// Check if property exists (even if null/empty)
if (User.Properties.Has('MobileNumber')) { ... }
// Check if property has actual value
if (User.Properties.HasNonNullOrWhitespaceValue('Department')) { ... }
// Safe get (returns null if not found)
var country = User.Properties.TryGet('country_');
User.InRole(roleId) // Check role by ID
User.InRoleByNames(roleNames[]) // Check multiple roles by name
User.InEffectiveGroupByNames(groupNames[]) // Check effective groups
User.InEffectiveGroupByDNs(DNs[]) // Check groups by DN
User.InDirectGroupByNames(groupNames[]) // Check direct groups
User.InDirectGroupByDNs(DNs[]) // Check direct groups by DN
if (User.InRole('abc12345-uuid-here')) {
return true;
}
if (User.UserType == 'CUS') {
var country = User.Get('country_');
if (country === 'Poland') {
return true;
}
}
if (User.UserType == 'AD') {
var dn = User.Get('distinguishedname');
if (dn && dn.indexOf('OU=Sales') > -1) {
return true;
}
}
var dept = User.Get('department_');
var hasPhone = User.Properties.HasNonNullOrWhitespaceValue('MobileNumber');
if (dept === 'Engineering' && hasPhone) {
return true;
}
The following attributes always return null in Dynamic Role scripts:
Status,StatusEnum- User status (Active/Invited/Suspended)Enabled,Locked- Account state flagsPassword,PasswordHash,PasswordIsSet- Security sensitiveFirstName,LastName- Name componentsPhoto,PictureUrl- Profile imagesEffectiveGroupObjects,RoleObjects- Complex objects- Most group/role attributes (use methods instead)
module()function - Cannot usemodule('User'),module('SqlQuery')- SQL database queries
- User status checking from database
Use Authentication Policies with SQL queries instead:
// Application Policy Script (NOT Dynamic Role)
var sqlMod = module('SqlQuery');
var result = sqlMod.query("SELECT StatusEnum FROM User WHERE Username = '" + User.Username + "'");
var userStatus = result[0].StatusEnum;
if (userStatus === "Invited") {
policy.AuthenticationProfile = "Email MFA Required";
}
- Custom attributes with underscore:
country_,department_,employee_id_ - Access via:
User.Get('country_')
- Standard AD attributes:
distinguishedname,samaccountname - Access via:
User.Get('distinguishedname') - Use DN for OU membership checks