Hi. My problem is that I have value in list of values where is set automatic permission. I.e. - when user selects this value on some document, the permissions is reduced.
It works fine, but I need to disable this behavior on some classes. I prepare a VBscript code in Validation of some other property on the same object (i.e. changeing the persmission on itself)
option explicit
call DeactivateOfferPermission(ObjVer)
' ----------------------------------------------------------------------------------------------
sub DeactivateOfferPermission(oObjVer) ' finds deternined NACL with ID = 106 and deativaes it
Dim oObjectVersionPermissions ' As MFilesAPI.ObjectVersionPermissions
Set oObjectVersionPermissions = Vault.ObjectOperations.GetObjectPermissions(oObjVer)
Dim i ' As Integer
Dim oACL ' As AccessControlList
Set oACL = oObjectVersionPermissions.AccessControlList
Dim oACLC ' As AccessControlListComponent
Dim oACLListKeys ' As MFilesAPI.AccessControlListComponentKeys
Set oACLListKeys = oACL.AutomaticComponents.GetKeys()
For i = 1 To oACLListKeys.Count
Set oACLC = oACL.AutomaticComponents.At(oACLListKeys.Item(i))
if oACLC.NamedACLlink =106 then
oACLC.IsActive = false ' deaktivuj OD_Omezeni na NAB tym
' err.raise MFScriptCancel, "106"
end if
Next
'Now we update the Objects ACL.
call Vault.ObjectOperations.ChangePermissionsToACL(oObjVer, oACL, True)
end sub
What happened:
- when new object is created then NACL = 106 is deactivated
- when I activate NACL back or when I have an older object (created before this VBS) the deactivation is not word
- when I use the same code in Event Handler (BeforeCheckIn) it works in every cases
In other case I tried to change Permission of object to some specified NACL - the same behavior appered...
Is there any solution to VBS which can change permission on "itself object"?? Some other step order or some other API function?
Thx, JJ