How to list the ACLs of a record?

I need to list all the ACLs of a Record?

I can see that there is record.AccessControlList.get_AsString(long) but I'm not sure what the long should be?

I need to list all Document View ACLs.

 

Cheers

John

 

  • I think you need to use record.AccessControlList.CurrentSetting to see wether it's public, inherited or custom. If it's custom, then use AccessLocations to see which locations have access.

     

    As for the long value for the parameter I think you need one of the enum values that FuncionEnum returns, but why haven't they choosen to use the enum itself instead of their numeric representation will probably always remain a mystery.

     

    When you choose to use AsString, you get everything returned as text and not objects, so working on the returned results is more difficult.

     

    Also remember that you may also need to query the ACL for classification and recordtype to see if the record inherits ACL from those.

  • So there is no easy way to get the resultant set of ACLs for a record?

  • TRIM allows for quite complex ACL options to be set, so it will never be "easy" to get the details.

  • Verified Answer

    Just in addition to Sander's earlier reply, the enum's aren't the easiest things to find, but the one you want is HP.HPTRIM.SDK.RecordAccess, so for example, to get the setting for Update Document:

    string updatedocaccess = record.AccessControlList.get_AsString((int)RecordAccess.UpdateDocument);

     

    Just a heads up when it comes to setting Access Controls, you just can't go:

    record.AccessControlList.SetPrivate((int)RecordAccess.UpdateDocument, trimdb.CurrentUser);

     

    instead you have to split it into 3 steps:

    TrimAccessControlList acl = record.AccessControlList;
    acl.SetPrivate((int)RecordAccess.UpdateDocument, trimdb.CurrentUser);
    record.AccessControlList = acl;

     

    Discovered that the hard way!

     

  • Thanks Matt, was just about to ask that :smileyhappy:

    I'm not really interested in setting ACLs, I just want to work out the resultant set of View Document.

     

    And yes the enums (specially the AllEnumerations) are a joke! And that happens when a COM library is not properly converted to .Net :smileysad:

     

    Cheers

    John