Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Worksite NewProf.nrs VB Script
MarcelVanKempen
How can we set the Security template in our NewProf.nrs VB script?
We have monitored the NewProfileDlg_OnChange event handler but selecting a security template doesn't seem to trigger an OnChange event.
We saw the NewProfileDlg UsrGrpSecurityDlg property in the Visual Basic Scripting for iManage Dialogs manual but the property is not documented in the Properties and Methods chapter nor in the iManage Extension Library manual.
We found the GroupNameArray, UserNameArray, GroupAccessRightsArray and UserAccessRightsArray in some VB sample code but all attempts to access these properties in VB script result in VBScript errors. The only thing we have been able to get going is
Dim Users
Users = dlg.UsrGrpSecurityDlg.UserNameArray
Where is all this documented and where can we find some VB Script sample code for the UsrGrpSecurityDlg property?
Find more posts tagged with
Comments
jny
There isn't a way to hook into the security button via NewProf.nrs. The OnChange Event Handler is implemented to raise an event when a custom field change has occured.
There isn't a any specific documentation in the SDK for the UsrGrpSecurityDlg property.
Could you explain what are your specific requirements in using the UsrGrpSecurityDlg object?
MarcelVanKempen
If we use server side security templates then our authors are prompted "Do you want to apply the security template assigned to the author of this document?" every time they create a new document. We can set up a server side template for Chinese Walls but the authors strong dislike getting prompted every time they create documents for other matters. They might be working on a dozen matters with only one of them requiring a Chinese Wall.
We want to automatically apply a security template when a certain author creates a new document for a certain matter number. We want to prevent 'other' authors from creating documents for Chinese Wall matters if they are not part of that project.
We thought that this would require a simple OnChange event handler in our NewProf.nrs script:
If .GetAttributeByID(26) = "123-456-789" Then .SetAttributeValueByID ?, "ABC Limited Chinese Wall", True
There doesn't seem to be a Security Template attribute and we can't find documentation nor sample code for the UsrGrpSecurityDlg property.
We hope that you can suggest an implementation for this feature especially since the DMS we had before we implemented iManage had this feature.
jny
Would it work if you were to set acls via the UsrGrpSecurityDlg in the OnChange for field 26? Below is example code on how to put and get ACLs from the UsrGrpSecurityDlg Object.
[NewProf.nrs]
// Begin ==============================
Option Explicit
' AttributeID
Const nrMatter = 26
' Access rights
Const nrRightAll = 3
Const nrRightReadWrite = 2
Const nrRightRead = 1
Sub NewProfileDlg_OnChange(obj, id)
dim secDlg
dim arrUserNames(2) ' Assuming array count is 3
dim arrUserRights(2) ' Assuming array count is 3
dim strOwner, str1, str2
dim lngOwner, lng1, lng2
If id = nrMatter Then
' Usernames
strOwner = obj.GetAttributeByID(nrAuthor)
If "" = strOwner Then Exit Sub
str1 = "user1"
str2 = "user2"
' User access rights
lngOwner = nrRightAll
lng1 = nrRightReadWrite
lng2 = nrRightRead
' Put ACLs in a safe array
arrUserNames(0) = strOwner
arrUserNames(1) = str1
arrUserNames(2) = str2
arrUserRights(0) = lngOwner
arrUserRights(1) = lng1
arrUserRights(2) = lng2
' Get UsrGrpSecurityDlg object
set secDlg = obj.UsrGrpSecurityDlg
' Put UserACLs
secDlg.UserNameArray = arrUserNames
secDlg.UserAccessRightsArray = arrUserRights
End If
End Sub
Sub NewProfileCmd_PostOnOK(obj)
dim secDlg
dim arrUserNames
dim arrUserRights
dim lngNames, lngRights, i
dim strRet
' Get UsrGrpSecurityDlg object
set secDlg = obj.UsrGrpSecurityDlg
' Get UserACLs
arrUserNames = secDlg.UserNameVariantArray
arrUserRights = secDlg.UserAccessRightsVariantArray
If Not IsEmpty(arrUserNames) Then
' Obtain a count of the usernames and userrights.
lngNames = UBound(arrUserNames) - _
(LBound(arrUserNames) - 1)
' Determine if there are usernames.
If lngNames > 0 Then
for i = 0 to (lngNames-1)
strRet = strRet & arrUserNames(i) & "=" & _
arrUserRights(i) & "," & VBCRLF
next
msgbox strRet
End If
End IF
End Sub
// Ends =================================