DESCRIPTION
Custom script-based mailbox store selection policy
Note This code may use functions from the Active Roles Script Policy Best Practices. Please, follow the link to obtain instructions and code for those functions.
SCRIPT
'*********************************************************************************
' 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 MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
' IF YOU WANT THIS FUNCTIONALITY TO BE CONDITIONALLY SUPPORTED,
' PLEASE CONTACT ONE IDENTITY PROFESSIONAL SERVICES.
'*********************************************************************************
'
Option Explicit
Randomize
'***********************************************************************************
'** CUSTOMIZABLE SETTINGS
'***********************************************************************************
Const strInterestingClass = "user"
Const strInterestingAttribute = "homeMDB"
'***********************************************************************************
'** EVENT HANDLERS
'***********************************************************************************
Sub onGetEffectivePolicy(Request)
If (LCase(Request.Class) <> LCase(strInterestingClass)) Then Exit Sub
Dim arrPossibleValues, strDefaultValue
'-- get possible mailbox list
arrPossibleValues = Request.GetEffectivePolicyInfo(strInterestingAttribute, EDS_EPI_UI_POSSIBLE_VALUES)
'-- make this list always to be an array
If (IsEmpty(arrPossibleValues)) Then
arrPossibleValues = Array()
ElseIf (Not IsArray(arrPossibleValues)) Then
arrPossibleValues = Array(arrPossibleValues)
End If
'-- you can define own logic to filter out unneeded values
'arrPossibleValues = SomeFunc(arrPossibleValues)
'-- and return new list
'Call Request.SetEffectivePolicyInfo(strInterestingAttribute, EDS_EPI_UI_POSSIBLE_VALUES, arrPossibleValues)
'-- you can apply own logic to select the default mailbox store for load balancing
'-- described below logic just randomly selects default mailbox store
Dim numUpperBound, numLowerBound, numSelected
numUpperBound = UBound(arrPossibleValues)
numLowerBound = LBound(arrPossibleValues)
numSelected = Int((numUpperBound - numLowerBound +1)*Rnd() + numLowerBound)
strDefaultValue = arrPossibleValues(numSelected)
'-- and return the default value
Call Request.SetEffectivePolicyInfo(strInterestingAttribute, EDS_EPI_UI_GENERATED_VALUE, strDefaultValue)
End Sub ' onGetEffectivePolicy
'***** END OF CODE ***************************************************************