Helper script functions

FileNet P8 provides a set of reusable VBScript functions you can use when deploying data from one object store to another. Although you can use some of these sample scripts alone, others depend on other functions as listed.

NOTE  Although the sample scripts and syntax documented for them apply only to VBScripts, an experienced JScript developer can apply these functions when developing JScript files to use with the import function.

The following tables identify these helper script functions, grouped by categories. For each function, the tables identify parameters, any dependencies, and the function's purpose.

Initialization Functions

Name: HandleAnyErrorCondition
Purpose: Other functions use this function to check for errors and report any error conditions
Parameters: strMsg
The message prefix to which the error description is appended.
Dependencies: none
Syntax: HandleAnyErrorCondition <string>
Example: HandleAnyErrorCondition strErrorPrefix

 

Active Directory Functions

Name: CreateADUser
Purpose: To create a single Active Directory user, given information in the array
Parameters:

aryUser
Array of strings for creating a user
StrADDomainString
LDAP-formatted string to access the Active Directory entries for the domain
Order of elements:
user, description, first name, last name, password

Dependencies:

HandleAnyErrorCondition

Syntax: CreateADUser array, <string>
Example: CreateADUser Array("Tom Swift", "User", "Tom", "Swift", "password"), "DC=test,DC=eng,DC=ibm,DC=com"

Name: CreateADGroup
Purpose: To create a single Active Directory group, as defined in the array
Parameters: aryGroup
Array of strings for creating a group
Order of the elements:
<name>, <description>, <list of users>
Dependencies: HandleAnyErrorCondition
Syntax: CreateADGroup array,<string>
Example: CreateADGroup Array("Group1", "Primary Group", "User1", "User2", "User3"), "DC=test,DC=eng,DC=ibm,DC=com"

Name: CreateUsers
Purpose: To create each user given an array of users passed in, calling CreateADUser
Parameters:

aryUsers
An array of arrays, which passes each individual array to:
CreateADUser

Dependencies: HandleAnyErrorCondition
CreateADUser
Syntax: CreateUsers array, <string>
Example: user1=Array("Tom Swift", "User", "Tom", "Swift", "password")
user2=Array("Jane Doe", "User", "Jane",
"Doe", "password")
CreateUsers Array(user1,user2), "DC=test,DC=eng,DC=ibm,DC=com"

Name: CreateGroups
Purpose: To create each user given an array of groups passed in, calling CreateADUser
Parameters: aryGroups
An array of arrays which passes each individual array to CreateADGroup
Dependencies: HandleAnyErrorCondition
CreateADGroup
Syntax: CreateGroups array, <string>
Example: group1=Array("group1", "Primary Group", "User1", "User2", "User3")
group2=Array("group2", "Secondary Group", "User3")
CreateGroups Array(group1,group2),
"DC=test,DC=eng,DC=ibm,DC=com"

 

Object Permissions and Security Functions

Name: SetObjectPermissionConstants
Purpose: To set values to the global variables the other permission functions use
Parameters: none
Dependencies: HandleAnyErrorCondition
Syntax: SetObjectPermissionConstants
Example: SetObjectPermissionConstants

Name: ModifyDefaultPermissions
Purpose: To modify the default instance permissions of the object
Parameters: obj
The object whose permissions are to be modified
aryPermissionDetails
An array that specifies how to modify the permissions in this order:
GroupString, AccessType GrantOrDenyAction
Dependencies: HandleAnyErrorCondition
SetObjectPermissionConstants
Syntax: ModifyDefaultPermissions <object>, Array
Example: ModifyDefaultPermissions obj, Array("domain\user1", idmAccessLevelRead, idmAccessAllow)

Name: ModifyPermissions
Purpose: To modify the specified object's permissions
Parameters: obj
The object to have its permissions modified
aryPermissionDetails
An array that specifies how to modify the permissions in this order:
GroupString, AccessType, GrantOrDenyAction
Dependencies: HandleAnyErrorCondition
SetObjectPermissionConstants
Syntax: ModifyPermissions <object>, Array
Example: ModifyPermissions obj, Array("domain\user1", idmAccessLevelRead, idmAccessAllow)

 

Object Store Permission and Security Functions

Name: SetObjectStoreConstants
Purpose: To set up the constants used by the other functions
Parameters: none
Dependencies: HandleAnyErrorCondition
Syntax: SetObjectStoreConstants
Example: SetObjectStoreConstants

Name: AddGroupToClassDef
Purpose: To set security on top level class definitions
Parameters: cDef
The class definition object
doSubClasses
If true, includes all subclasses of cDef
accessLevel
The permission bitmask to use
inheritanceType
grant or deny
isDefaultInstance
If true, use default permissions; if not, use regular permissions
Dependencies: AddGroupToObject
SetObjectStoreConstants
Global variables
Syntax: AddGroupToClassDef obj <boolean>, <integer>, <integer>, <boolean>
Example: AddGroupToClassDef cl, True, idmAccessLevelView, idmInheritObjectInstance, True

Name: AddGroupToFolder
Purpose: To add the hard-coded permissions to the folder; if the flag fldOption is False, it adds permissions to any sub folders as well
Parameters: fldObj
The folder to operate on
fldOption

Boolean flag that determines whether to handle just the root folder
AccessType
A bitmask that determines which permission to add
InheritanceType
Which type of inheritance the object uses from its parent
IsDefaultInstance
Determines whether to change the default instance or regular permissions
Dependencies: HandleAnyErrorCondition
AddGroupToAllFolder
AddGroupToObject
SetObjectStoreConstants
Global variables
Syntax: AddGroupToFolder <boolean>, <integer>, <integer>, <boolean>
Example: AddGroupToFolder True, idmAccessLevelWriteFolder, idmNoInheritance, False

Name: AddGroupToWorkflowEventActionObject
Purpose: To add the security to each workflow event action
Parameters:

eaList
The collection of event actions including non-workflow events
AccessType
A bitmask that determines which permission to add
InheritanceType
Which type of inheritance the object uses from its parent
IsDefaultInstance
Determines whether to change the default instance or regular permissions

Dependencies: HandleAnyErrorCondition
AddGroupToObject
SetObjectStoreConstants
Global variables
Syntax: AddGroupToWorkflowEventActionObjects collection, <object>, <integer>, <integer>, <boolean>
Example: AddGroupToWorkflowEventActionObjects objLib.EventActions, wfObj, idmAccessLevelView, idmNoInheritance, True

Name: AddGroupToEachItemInCollection

Purpose: To add the security to each item in a generic collection
Parameters: collection
The generic collection to operate on
AccessType
A bitmask of which permission to add
InheritanceType
The type of inheritance from parent objects can use
IsDefaultInstance
Determines whether permissions change the default instance or regular permissions
Dependencies: HandleAnyErrorCondition
AddGroupToObject
SetObjectStoreConstants
Global variables
Syntax: AddGroupToEachItemInCollection <collection>, <object>, <integer>, <integer>, <boolean>
Example: AddGroupToEachItemInCollection objLib.PropertyTemplates, idmAccessLevelView, idmNoInheritance, True

Name: AddGroupToObject
Purpose: To provide the function that other permission functions use to set their permissions
Parameters: Obj
Object to operate on
secAccessLevel
Access level to grant or deny
secInheritanceType
Type of access (Grant or Deny)
DefaultInstance
Determines whether to modify default or typical permissions
Dependencies: HandleAnyErrorCondition
Global variables
Syntax: AddGroupToObject <object>, <integer>, <integer>, <boolean>
Example: AddGroupToObject Obj, idmAccessLevelView, idmNoInheritance, True

Name: SetObjectStoreSecurity
Purpose: To add permissions on an existing object store to set default instance groups, as if set during object store creation
Parameters: objLib
Object store on which to operate
Dependencies: AddGroupToClasses
AdGroupToFolder
AddGroupToPropertyTemplates
AddGroupToWorkflowEventActionObject
AddGroupToEachItemInCollection
HandleAnyErrorCondition
AddGroupToObject
SetObjectStoreConstants
Global variables
Syntax: SetObjectStoreSecurity <object>
Example: SetObjectStoreSecurity objObjectStore