• Products
    • View all products
    • Free trials
  • Solutions
    • All Solutions
    • All Integrations
  • Resources
    • All Resources
    • Learning Hub
  • Trials
  • Support
    • Support Home
    • By Product
      • All Products
      • Active Roles
      • Authentication Services
      • Cloud Access Manager
      • Defender
      • Identity Manager
      • Password Manager
      • Safeguard
      • Starling Identity Analytics & Risk Intelligence
      • Starling Two-Factor Authentication
      • TPAM Appliance
    • Contact Support
      • Overview
      • Customer Service
      • Licensing Assistance
      • Renewal Assistance
      • Technical Support
    • Download Software
    • Knowledge Base
    • My Account
      • My Products
      • My Service Requests
      • My Licenses
      • My Groups
      • My Profile
    • Policies & Procedures
    • Professional Services
    • Technical Documentation
    • One Identity University
    • User Forums
    • Video Tutorials
  • Partners
    • Overview
    • Partner Circle Log In
    • Become a Partner
    • Find a Partner
    • Partner Community
  • Communities
    • Home
    • Blogs
      • Blogs A to Z
      • One Identity Community
      • AD Account Lifecycle Management
      • Cloud
      • Identity Governance & Administration
      • Privileged Access Management
      • syslog-ng Community
    • Forums
      • All Product Forums
      • Active Roles
      • Identity Manager
      • Password Manager
      • Safeguard
      • Unix Access Management
    • Social Networks
      • Facebook
      • LinkedIn
      • Twitter
      • YouTube
One Identity Community
One Identity Community
  • Site
  • User
  • Site
  • Search
  • User
Active Roles Community
Active Roles Community
Wiki How to find a request source in script policy
  • Forum
  • Ideas
  • Wiki
  • More
  • Cancel
  • New
  • -Active Roles Script Center
    • +Active Roles Script Policy Best Practices
    • Active Roles SDK
    • +C#
    • +JavaScript
    • +PowerShell
    • -VBScript
      • VBScript Library source code
      • -VBScript samples
        • A Managed Unit with users which have not logged on for last 90 days
        • Adjust the case of usernames to title case (first letter of each part of the name)
        • Advanced group creation/provision
        • Advanced shared folder creation
        • Bulk policy incompliance fixing
        • Check unique value of an attribute
        • +Computer management
        • +Exchange management
        • Function that converts regular date into integer8 format
        • Get effective policy info list
        • +Group management
        • How to find a request source in script policy
        • How to send emails based on scripts policy parameters and Virtual Attribute values
        • +Permissions Management
        • Policy incompliance reporting & fixing for specified policy
        • Populate values from a SQL database to an AD Attribute
        • Prevent copying an attribute on user copy
        • Prohibite a permission propagation to AD
        • Prohibite an AD native security editing
        • Read large integer date attributes and display them in date and time readable format
        • Read XML Node text or attribute value
        • Read XML Node with Children into DictionaryObject
        • Standalone script that requests built-in password generation policy
        • +User management
        • Validate moving operations
        • +VBScript: Approval

You are currently reviewing an older revision of this page.

  • History View current version

How to find a request source in script policy

Back to VBScript samples

DESCRIPTION

Sometimes, it is very important to know where request came from. Unfortunately, it isn't obvious. ARS SDK describes several methods to get information about request source, but none of these methods give full information. The following script in SCRIPT ONE section demonstrates how to get full information about request source.

Note: The GetRequestSource() function returns a valid value in script policy "pre"-handlers only such as onPreCreate, onPreModify, etc... To know a request source in "post"-handlers, you should first save the source in "pre"-handler in some Request's control as it shown in SCRIPT TWO section.

SCRIPT ONE

' *****************************************************************************

' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,

' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED

' WARRANTIES OF MERCHANTBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE

'

' IF YOU WANT THIS FUNCTIONALITY TO BE CONDITIONALLY SUPPORTED,

' PLEASE CONTACT QUEST PROFESSIONAL SERVICES OR CUSTOM DEVELOPMENT.

' *****************************************************************************

'

Option Explicit

'*******************************************************************

' Get Request Source

'

' This function determines request source

' Possible return values:

' "AD DirSync" - request came from Active Directory by DirSync

' "DB Replication" – request came from SQL database by replication

' "ARS Internal" – request made by ARS Administrative Service

' "Quick Connect" – request made by ARS Quick Connect, only Quick Connect 3.x is supported

' "MMC Interface" - request made by ARS MMC Console

' "Web Interface" - request made by ARS Web Interface

' "ADSI Provider" - request made by external script or application that works with ARS through ARS ADSI provider

' something else - undetermined request source

'*******************************************************************

Function GetRequestSource(Request)

Dim SelfRequest, RequestSource, QuickConnectGuid, ClientVersion

GetRequestSource = Empty

On Error Resume Next

SelfRequest = CBool(Request.Parameter("SelfRequest"))

On Error Goto 0

If (SelfRequest = True) Then '-- request made by ARS Administrative Service

GetRequestSource = "ARS Internal"

Else

On Error Resume Next

RequestSource= Request.Parameter("RequestSource")

On Error Goto 0

If (RequestSource = 1) Then '-- request made from client

On Error Resume Next

QuickConnectGuid = Request.GetInControl("QC_ApplicationGuid")

On Error Goto 0

If (Not IsEmpty(QuickConnectGuid)) Then '-- request made by ARS Quick Connect 3.x

GetRequestSource = "Quick Connect"

Else '-- request made by one of ARS Client

On Error Resume Next

ClientVersion = CStr(Security.Sessions.Current.ClientVersion) '-- get ARS client name and version

ClientVersion = Left(ClientVersion,13) '-- ignore version digits

On Error Goto 0

GetRequestSource = ClientVersion

End If

ElseIf (RequestSource = 2) Then '-- request came from Active Directory by DirSync

GetRequestSource = "AD DirSync"

ElseIf (RequestSource = 3) Then '-- request came from SQL database by replication

GetRequestSource = "DB Replication"

End If

End If

End Function ' GetRequestSource

'*******************************************************************

' EVENT HANDLERS

'*******************************************************************

Sub onPreModify(Request)

Dim Source

Source = GetRequestSource(Request) '-- get request source

If ((Source = "Quick Connect") Or (Source = "Web Interface")) Then

Call Err.Raise (1, "Don't use ARS Quick Connect and ARS Web Interface for this operation!")

End If

End Sub ' onPreModify

'*** END OF CODE ****************************************************

SCRIPT TWO

'*******************************************************************

' EVENT HANDLERS

'*******************************************************************

 

Sun onPreModify(Request)

Dim Source

. . .

Source = GetRequestSource(Request)

Request.PutInControl("some-control-name", Source)

. . .

End Sub

 

Sun onPostModify(Request)

Dim Source

. . .

Source = Request.GetInControl("some-control-name")

. . .

End Sub

 

'*** END OF CODE ****************************************************

 

 

Back to VBScript samples

  • Company
    • About Us
    • Buy
    • Careers
    • Contact Us
    • News
  • Resources
    • Blogs
    • Customer Stories
    • Documents
    • Events
    • Videos
  • Support
    • Professional Services
    • Renew Support
    • Technical Support
    • One Identity University
    • Support Service
  • Social Networks
    • Facebook
    • Instagram
    • LinkedIn
    • Twitter
    • YouTube
  • © 2025 One Identity LLC. ALL RIGHTS RESERVED.
  • Legal
  • Terms of Use
  • Privacy
  • Community Feedback & Support
  • Cookie Preference Center