hello_world Absent Member.
Absent Member.
1196 views

How to list the ACLs of a record?

Jump to solution

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

 

1 Solution

Accepted Solutions
Highlighted
Matt Bayliss Super Contributor.
Super Contributor.

Re: How to list the ACLs of a record?

Jump to solution

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!

 

0 Likes
5 Replies
Sander Hoogwerf Outstanding Contributor.
Outstanding Contributor.

Re: How to list the ACLs of a record?

Jump to solution

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.


(Any opinions expressed in this forum are my own personal opinion and should not be construed as an official statement by DXC Technology.)

Analytics & Data Management
Application & Business Services
DXC Technology
0 Likes
hello_world Absent Member.
Absent Member.

Re: How to list the ACLs of a record?

Jump to solution

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

0 Likes
Sander Hoogwerf Outstanding Contributor.
Outstanding Contributor.

Re: How to list the ACLs of a record?

Jump to solution

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


(Any opinions expressed in this forum are my own personal opinion and should not be construed as an official statement by DXC Technology.)

Analytics & Data Management
Application & Business Services
DXC Technology
0 Likes
Highlighted
Matt Bayliss Super Contributor.
Super Contributor.

Re: How to list the ACLs of a record?

Jump to solution

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!

 

0 Likes
hello_world Absent Member.
Absent Member.

Re: How to list the ACLs of a record?

Jump to solution

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

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.