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)
newprof.nrs
System
I can to take certain actions when a user takes a copy of a completed document. I want to clear certain fields on the profile and remove any security on the document. Removing the contents of the fields is straightforward, but is there any way to remove the groups \ other users as defined on the ACL.
I am aware the security can be updated using :
Const imPublic = 80
Const imPrivate = 88
Const imView = 86
Const imRightNone = 0
Const imRightRead = 1
Const imRightReadWrite = 2
Const imRightAll = 3
dlg.SetAttributeValueByID nrDefaultSecurity, imView, True
.. but I really want to target the user \ group access contents.
Thanks
Find more posts tagged with
Comments
jny
Below is a sample script which demonstrates how you may add a couple of specified users to the acls at OnChange, and it also shows how you may read the added acls at PostOnOK.
Hope this helps.
[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 = "GUEST"
str2 = "ADALE"
' 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
========================
Migrateduser
Jny - thanks for the snippet. That has proved to be very useful.
I've amended the code and its working perfectly. We 'Complete' documents here so all I'm interested in is removing the existing security and adding the owner with Full Access. The code does this and once again, thanks for your help.
Eddie.