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)
Setting security template with newprof.nrs
Stu_McHugh
Can anyone tell me the code required for the newprof.nrs to apply a local security policy based on Doc Type?
Many Thanks
Find more posts tagged with
Comments
jny
Currently, setting the security template via scripting is unsupported. This is a known issue, and it's been reported as enhancement defect: NewProfileDlg: It's missing a method/property that allows setting user security template.
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 was demonstrated in the script example sent in the initial response.
Alternatively, you may set/reset the ACL's via the UsrGrpSecrutiyDlg Object. Below is an example script that you may use as reference.
[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
==============================================