Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Security Template and NRS Scripts
izogi
Hello.
Is there any way to use the VBScript in the Worksite NRS scripts to change the security template in the Worksite 8.0 client?
I've been writing code which changes values of some fields in the NewProfile dialog, depending on what's entered in other fields. It does this via the NewProfileDlg_OnChange event handler.
I can't figure out how to get to the Security Template combo box, however. I can't find any reference to it in the 'VB Scripting for Worksite Dialogs' documentation. I thought I might be able to get the attribute ID by trapping the _OnChange event handler, but changing the security template doesn't seem to fire that. (On a related note, I've also noticed that if changing it causes the Default Security field to change, then the NewProfileDly_OnChange event *also* doesn't fire.)
Is there an undocumented attribute enumeration that I might be able to use to set it?
Thanks for any help.
Mike.
Find more posts tagged with
Comments
jny
There isn't a way to set the security template via scripting.
The NewProfileDlg Object is missing a method/property that allows setting user security template. Since this is a legacy design, and most like 8.x users have moved up to matter-centric model, this might not be implemented to enforce its scripting support. You may, however, submit this as an enhancement request at
http://worksitesupport.interwoven.com/
, and click on New Feature Request link.
The workaround would be quite involved: you would have to read the security policy under this key, HKEY_CURRENT_USER\Software\Interwoven\WorkSite\8.0\iManExt\SecTemplateDlg\Security Policy, then add it programmatically to the UsrGrpSecurityDlg the way that is demonstrated in the script example below:
[NewProf.nrs]
==============================================
Option Explicit
' AttributeID
Const nrAuthor = 5
' 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 = nrAuthor 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
==============================================
Note: modifying groupacls are similar to adding useracls as demonstrated above.