Idira Identity - User Object Reference for Dynamic Roles

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Welcome Idira to LIVEcommunity!

Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.

Meet Idira

Workforce Identity Articles
5 min read
L0 Member
No ratings

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.

Steps

How to Use This Script

  1. Open Idira Identity Admin Portal
  2. Navigate to: Access > Roles
  3. Create New Role: Click "Add Role" or edit existing role
  4. Enable Dynamic Role: Check "This is a dynamic role based on a script"
  5. Paste Script: Copy contents of user-object-reference.js into the script editor
  6. Test Script:
    • Click "Test User" button
    • Select a test user from the list
    • Click "Test"
  7. 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).

Quick Reference

Top-Level Properties (Direct Access)

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

Available Properties (via PropertyNames)

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_).

Access Methods

Option 1: User.Get()

var email = User.Get('Mail');
var dept = User.Get('department_');  // Custom attribute
 

Option 2: User.Properties.Get()

var email = User.Properties.Get('Mail');
var dept = User.Properties.Get('department_');
 

Both methods are equivalent.

Helper Methods

// 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_');
 

Role/Group Functions

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
 

Practical Examples

Check role membership

if (User.InRole('abc12345-uuid-here')) {
    return true;
}
 

Check custom attribute (Cloud Directory)

if (User.UserType == 'CUS') {
    var country = User.Get('country_');
    if (country === 'Poland') {
        return true;
    }
}
 

Check Active Directory OU

if (User.UserType == 'AD') {
    var dn = User.Get('distinguishedname');
    if (dn && dn.indexOf('OU=Sales') > -1) {
        return true;
    }
}
 

Check multiple conditions

var dept = User.Get('department_');
var hasPhone = User.Properties.HasNonNullOrWhitespaceValue('MobileNumber');

if (dept === 'Engineering' && hasPhone) {
    return true;
}

Important Limitations

❌ NOT Available in Dynamic Roles

The following attributes always return null in Dynamic Role scripts:

  • Status, StatusEnum - User status (Active/Invited/Suspended)
  • Enabled, Locked - Account state flags
  • Password, PasswordHash, PasswordIsSet - Security sensitive
  • FirstName, LastName - Name components
  • Photo, PictureUrl - Profile images
  • EffectiveGroupObjects, RoleObjects - Complex objects
  • Most group/role attributes (use methods instead)

❌ NOT Available - Advanced Features

  • module() function - Cannot use module('User'), module('SqlQuery')
  • SQL database queries
  • User status checking from database

✅ Solution for Status Checking

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";
}
 

User Type Differences

Cloud Directory (UserType: 'CUS')

  • Custom attributes with underscore: country_, department_, employee_id_
  • Access via: User.Get('country_')

Active Directory (UserType: 'AD')

  • Standard AD attributes: distinguishedname, samaccountname
  • Access via: User.Get('distinguishedname')
  • Use DN for OU membership checks
Rate this article:
  • 345 Views
  • 0 comments
  • 0 Likes
Article Dashboard
Version history
Last Updated:
‎11-05-2026 11:45 AM
Updated by: