Skip to content

Commit 2e0e1c2

Browse files
committed
README text for __lt__ comparison and sorting for ACLs
1 parent 161ac92 commit 2e0e1c2

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,6 +2145,21 @@ is a valid operation, so that an application that tends to cache object
21452145
permissions client-side might use such checks in optimizing atomic ACL
21462146
requests against the inclusion of any redundant ACLOperations.
21472147

2148+
For purposes of sorting, a `__lt__` operator is also defined that would
2149+
allow sorting of lists of iRODSAccess, ACLOperations, or the two intermixed:
2150+
```
2151+
perms_list=[ACLOperation('read','bob'), iRODSAccess('read','/tempZone/home/alice','alice'), ]
2152+
print(sorted(perms_list))
2153+
```
2154+
2155+
and, as always, a sort key may be used for custom sorting; for example,
2156+
the following sorts the objects simply by ascending numerical value of the access:
2157+
```
2158+
perms = sorted([ACLOperation('read','bob'), ACLOperation('write', 'rods'), ACLOperation('read_object','alice')],
2159+
key=lambda acl: iRODSAccess.codes[acl.access_name]
2160+
)
2161+
```
2162+
21482163
Quotas (v2.0.0)
21492164
---------------
21502165

0 commit comments

Comments
 (0)