Skip to content

Commit a571c7d

Browse files
committed
squashing together all non-recent, no-longer-controversial ;) corrections
1 parent 1803dda commit a571c7d

4 files changed

Lines changed: 23 additions & 15 deletions

File tree

irods/access.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,16 @@ def __init__(self, access_name, path, user_name="", user_zone="", user_type=None
9393

9494
def __lt__(self, other):
9595
return (
96-
self.access_name < other.access_name
97-
and self.user_name < other.user_name
98-
and self.user_zone < other.user_zone
99-
) and iRODSPath(self.path) < iRODSPath(other.path)
96+
self.access_name,
97+
self.user_name,
98+
self.user_zone,
99+
iRODSPath(self.path)
100+
) < (
101+
other.access_name,
102+
other.user_name,
103+
other.user_zone,
104+
iRODSPath(other.path)
105+
)
100106

101107
def __eq__(self, other):
102108
return (
@@ -121,7 +127,7 @@ def copy(self, decanonicalize=False, implied_zone=''):
121127
}.get(self.access_name)
122128
other.access_name = replacement_string if replacement_string is not None else self.access_name
123129

124-
# Useful if we wish to force an explicitly specified local zone to null length for equality testing:
130+
# Useful if we wish to force an explicitly specified local zone to an implicit zone spec in the copy, for equality testing:
125131
if '' != implied_zone == other.user_zone:
126132
other.user_zone = ''
127133

@@ -167,9 +173,7 @@ def __lt__(self, other):
167173
)
168174

169175
def __repr__(self):
170-
return f"<ACLOperation: access_name={self.access_name!r} "\
171-
f"user_name={self.user_name!r} "\
172-
f"user_zone={self.user_zone!r}>"
176+
return f"<ACLOperation {self.access_name} {self.user_name} {self.user_zone}>"
173177

174178
class _iRODSAccess_pre_4_3_0(iRODSAccess):
175179
codes = collections.OrderedDict(

irods/api_number.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
"ATOMIC_APPLY_METADATA_OPERATIONS_APN": 20002,
178178
"GET_FILE_DESCRIPTOR_INFO_APN": 20000,
179179
"REPLICA_CLOSE_APN": 20004,
180+
"ATOMIC_APPLY_ACL_OPERATIONS_APN": 20005,
180181
"TOUCH_APN": 20007,
181182
"AUTH_PLUG_REQ_AN": 1201,
182183
"AUTHENTICATION_APN": 110000,

irods/manager/access_manager.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def users_by_ids(session, ids=()):
3838

3939
class AccessManager(Manager):
4040

41-
def _ACL_operation(self, op_input: iRODSAccess):
41+
@staticmethod
42+
def _to_acl_operation_json(op_input: iRODSAccess):
4243
return {
4344
"acl": op_input.access_name,
4445
"entity_name": op_input.user_name,
@@ -48,16 +49,18 @@ def _ACL_operation(self, op_input: iRODSAccess):
4849
)
4950
}
5051

51-
def _call_atomic_acl_api(self, logical_path : str, *operations, admin=False):
52-
request_text = {"logical_path": logical_path}
53-
request_text["admin_mode"] = admin
54-
request_text["operations"] = [self._ACL_operation(op) for op in operations]
52+
def apply_atomic_operations(self, logical_path : str, *operations, admin=False):
53+
request_text = {
54+
"logical_path": logical_path,
55+
"admin_mode": admin,
56+
"operations": [self._to_acl_operation_json(op) for op in operations]
57+
}
5558

5659
with self.sess.pool.get_connection() as conn:
5760
request_msg = iRODSMessage(
5861
"RODS_API_REQ",
5962
JSON_Message(request_text, conn.server_version),
60-
int_info=20005,
63+
int_info=api_number["ATOMIC_APPLY_ACL_OPERATIONS_APN"],
6164
)
6265
conn.send(request_msg)
6366
response = conn.recv()

irods/test/access_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ def test_atomic_acls_505(self):
506506
user2 = ses.users.create("rod_serling_505#twilight", "rodsuser")
507507
user3 = ses.users.create("local_test_user_505", "rodsuser")
508508
group = ses.groups.create("test_group_505")
509-
ses.acls._call_atomic_acl_api(
509+
ses.acls.apply_atomic_operations(
510510
self.coll_path,
511511
a1:=ACLOperation("write", user1.name, user1.zone),
512512
a2:=ACLOperation("read", user2.name, user2.zone),

0 commit comments

Comments
 (0)