Skip to content

Commit dcaf1d6

Browse files
committed
alter parameter; zone name instead of session
1 parent e6196c2 commit dcaf1d6

3 files changed

Lines changed: 20 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2157,7 +2157,7 @@ acls = [
21572157
]
21582158

21592159
session = irods.helpers.make_session()
2160-
normalize = lambda acl: acl.normal(session)
2160+
normalize = lambda acl: acl.normal(local_zone=session.zone)
21612161

21622162
print(normalize(acls[0]) == normalize(acls[2]))
21632163
acls.sort(key=normalize)

irods/access.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,20 @@ def __eq__(self, other):
119119
def __hash__(self):
120120
return hash((self.access_name, str(self.path), self.user_name, self.user_zone))
121121

122-
def normal(self, session=None):
123-
normal_form = self.copy(decanonicalize=-1, implied_zone=(session.zone if session else ''))
122+
def normal(self, local_zone=""):
123+
"""
124+
Create a normalized version of the object for comparison in sorting or determining equavalence.
125+
126+
Args:
127+
local_zone: the name of the home zone, if any, in which client user directly authenticates.
128+
The purpose is zone name normalization; if this parameter is a nonzero-length string which
129+
matches the zone_name in the source object, the copy will contain a null zone_name field.
130+
131+
Returns:
132+
The normalized copy of the source object. In practice, this will be an ACLOperation or iRODSAccess
133+
object, according to the type of the source object.
134+
"""
135+
normal_form = self.copy(decanonicalize=-1, implied_zone=local_zone)
124136
normal_form.path = ""
125137
return normal_form
126138

irods/test/access_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,13 @@ def test_atomic_acls__issue_505(self):
514514
a4 := ACLOperation("read", group.name),
515515
)
516516

517-
accesses = {acl.normal(ses) for acl in ses.acls.get(self.coll)}
517+
accesses = {acl.normal(ses.zone) for acl in ses.acls.get(self.coll)}
518518

519519
# Assert that the ACLs we added are among those listed for the object in the catalog.
520-
self.assertIn(a1.normal(ses), accesses)
521-
self.assertIn(a2.normal(ses), accesses)
522-
self.assertIn(a3.normal(ses), accesses)
523-
self.assertIn(a4.normal(ses), accesses)
520+
self.assertIn(a1.normal(ses.zone), accesses)
521+
self.assertIn(a2.normal(ses.zone), accesses)
522+
self.assertIn(a3.normal(ses.zone), accesses)
523+
self.assertIn(a4.normal(ses.zone), accesses)
524524

525525
finally:
526526
if user1:

0 commit comments

Comments
 (0)