Disable automatic "value from list" based permission

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

Parents
  • You shouldn't need any scripting for this, you can configure this by using two separate property definitions with the value list: one property which sets the automatic permissions from the value list and another which doesn't. You can then decide which property to use in which class depending on how the permissions would be set.

    The key is this setting in the property definition options. Check this for the property where you want to get automatic permissions and leave it unchecked for the other property.

Reply
  • You shouldn't need any scripting for this, you can configure this by using two separate property definitions with the value list: one property which sets the automatic permissions from the value list and another which doesn't. You can then decide which property to use in which class depending on how the permissions would be set.

    The key is this setting in the property definition options. Check this for the property where you want to get automatic permissions and leave it unchecked for the other property.

Children
No Data