Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7a81184
add SYS_INTERNAL_ERR
d-w-moore Mar 20, 2026
228bf86
[_505,sq] atomic ACLs endpoint
d-w-moore Mar 19, 2026
fb6e373
misc corrections / ruff lint and format
d-w-moore Mar 21, 2026
1b2e7e1
convert "codes" and "strings" into properties of the class to prevent…
d-w-moore Mar 27, 2026
32f6a24
ruff related changes
d-w-moore Mar 27, 2026
e373423
[_809] deprecate class for storing permission codes pre-iRODS-4.3
d-w-moore Mar 27, 2026
6421829
README updates
d-w-moore Mar 27, 2026
8397b34
update test name to include _issue_
d-w-moore Mar 28, 2026
5b1c514
README example for normalization before comparison of acl-like objects
d-w-moore Mar 29, 2026
e565b16
add true ACLOperation/iRODSAccess canonicalization for api calls and …
d-w-moore Mar 29, 2026
b9c4088
correct README again
d-w-moore Mar 30, 2026
fe51e78
README ':'->'.'
d-w-moore Mar 30, 2026
375ab0d
whitespace
d-w-moore Mar 30, 2026
c57620e
improve README phrasing
d-w-moore Mar 30, 2026
a808b38
correct README examples
d-w-moore Mar 30, 2026
b566894
drop use of 'ichmod' in identifiers
d-w-moore Mar 30, 2026
4120862
add permissions in README section title
d-w-moore Mar 30, 2026
889b5c1
ruff stuff
d-w-moore Mar 30, 2026
34980b3
docstring stuff
d-w-moore Apr 5, 2026
83e16e6
hash function for ACLOperation
d-w-moore Apr 1, 2026
fae4b01
extra normalizer method "normal" and consistent eq/hash semantics for…
d-w-moore Apr 2, 2026
caaa7e8
doc string fixes
d-w-moore Apr 2, 2026
3cea3fb
docstring reformat
d-w-moore Apr 2, 2026
ef928e5
alter parameter; zone name instead of session
d-w-moore Apr 2, 2026
69ebb9e
amend according to ruff reports
d-w-moore Apr 2, 2026
d0a730a
rename normal->normalize
d-w-moore Apr 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2118,6 +2118,66 @@ membership, this can be achieved with another query.
`<session>.permissions` was therefore removed in v2.0.0
in favor of `<session>.acls`.

Atomically setting permissions
------------------------------

A list of permissions may be added to an object atomically using
the AccessManager's `apply_atomic_operations` method:
```py
from irods.access import ACLOperation
from irods.helpers import home_collection
session = irods.helpers.make_session()
myCollection = session.collections.create(f"{home_collection(session)}/newCollection")

session.acls.apply_atomic_operations(
myCollection.path,
*[
ACLOperation("read", "public"),
ACLOperation("write", "bob", "otherZone")
]
)
```
`ACLOperation` objects form a linear order with `iRODSAccess` objects, and
indeed are subclassed from them as well, allowing equivalence comparisons and
also permitting intermixed sequences to be sorted (using the `__lt__` method
if no sort `key` parameter is given).

Care should be taken however to normalize the objects before such comparisons
and sorting, and with connected uses of the `in` operator (which leverages `__eq__`).

The following code sorts the objects based on their lexical order starting with the
normalized `access_name`, which serves to group identical permissions together:
```py
from irods.access import *
import irods.helpers
acls = [
iRODSAccess('read_object', '/tempZone/home/alice', 'bob', 'tempZone'),
ACLOperation('write', 'rods'),
ACLOperation('read', 'bob'),
]

session = irods.helpers.make_session()
N = lambda acl: acl.normalize(local_zone=session.zone)

print(N(acls[0]) == N(acls[2]))
acls.sort(key=N)
print( N(iRODSAccess('read', '', 'bob')) in map(N, acls) )
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print( N(iRODSAccess('read', '', 'bob')) in map(N, acls) )
print(N(iRODSAccess('read', '', 'bob')) in map(N, acls))

```

If strict order of permissions is desired, we can use code such as the following:
```py
from irods.access import *
from pprint import pp
pp(sorted(
[
ACLOperation('read', 'bob' ),
ACLOperation('own', 'rods'),
ACLOperation('read_object', 'alice')
],
key=lambda acl: (all_permissions[acl.access_name], acl.normalize())
))
```

Quotas (v2.0.0)
---------------

Expand Down
Loading
Loading