Skip to content

Commit daf2ba6

Browse files
committed
fix(acl): update endpoint access levels and remove unused types
1 parent c16ce95 commit daf2ba6

4 files changed

Lines changed: 13 additions & 28 deletions

File tree

bec_lib/bec_lib/endpoints.py

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def device_config_request():
234234
Returns:
235235
EndpointInfo: Endpoint for device config request.
236236
"""
237-
endpoint = f"{EndpointType.ADMIN.value}/devices/config_request"
237+
endpoint = f"{EndpointType.USER.value}/devices/config_request"
238238
return EndpointInfo(
239239
endpoint=endpoint, message_type=messages.DeviceConfigMessage, message_op=MessageOp.SEND
240240
)
@@ -703,7 +703,7 @@ def stop_devices():
703703
Returns:
704704
EndpointInfo: Endpoint for stopping devices.
705705
"""
706-
endpoint = f"{EndpointType.INFO.value}/queue/stop_devices"
706+
endpoint = f"{EndpointType.USER.value}/queue/stop_devices"
707707
return EndpointInfo(
708708
endpoint=endpoint, message_type=messages.VariableMessage, message_op=MessageOp.SEND
709709
)
@@ -849,17 +849,6 @@ def available_scans():
849849
message_op=MessageOp.SET_PUBLISH,
850850
)
851851

852-
@staticmethod
853-
def bluesky_events() -> str:
854-
"""
855-
Endpoint for bluesky events. This endpoint is used by the scan bundler to
856-
publish the bluesky events using a direct msgpack dump of the bluesky event.
857-
858-
Returns:
859-
str: Endpoint for bluesky events.
860-
"""
861-
return f"{EndpointType.INFO.value}/scans/bluesky-events"
862-
863852
@staticmethod
864853
def scan_segment():
865854
"""
@@ -1084,7 +1073,7 @@ def log():
10841073
Returns:
10851074
EndpointInfo: Endpoint for log.
10861075
"""
1087-
endpoint = f"{EndpointType.INFO.value}/log"
1076+
endpoint = f"{EndpointType.USER.value}/log"
10881077
return EndpointInfo(
10891078
endpoint=endpoint, message_type=messages.LogMessage, message_op=MessageOp.STREAM
10901079
)
@@ -1626,7 +1615,7 @@ def procedure_logs(queue: str):
16261615
Returns:
16271616
EndpointInfo: Endpoint for procedure queue updates for given queue.
16281617
"""
1629-
endpoint = f"{EndpointType.INFO.value}/procedures/logs/{queue}"
1618+
endpoint = f"{EndpointType.USER.value}/procedures/logs/{queue}"
16301619
return EndpointInfo(
16311620
endpoint=endpoint, message_type=messages.RawMessage, message_op=MessageOp.STREAM
16321621
)
@@ -1682,7 +1671,7 @@ def builtin_actor_update_notif(actor_name: str):
16821671

16831672
@staticmethod
16841673
def modify_interlock_table():
1685-
endpoint = f"{EndpointType.INTERNAL.value}/actor/builtin/scan_interlock/table_mod"
1674+
endpoint = f"{EndpointType.USER.value}/actor/builtin/scan_interlock/table_mod"
16861675
return EndpointInfo(
16871676
endpoint=endpoint,
16881677
message_type=messages.ScanInterlockModifyStateTableMessage,
@@ -1700,7 +1689,7 @@ def scan_interlock_states():
17001689

17011690
@staticmethod
17021691
def scan_interlock_enabled():
1703-
endpoint = f"{EndpointType.INFO.value}/actor/builtin/scan_interlock/config/enabled"
1692+
endpoint = f"{EndpointType.USER.value}/actor/builtin/scan_interlock/config/enabled"
17041693
return EndpointInfo(
17051694
endpoint=endpoint,
17061695
message_type=messages.BoolConfigDefaultFalse,
@@ -1710,7 +1699,7 @@ def scan_interlock_enabled():
17101699
@staticmethod
17111700
def scan_interlock_trigger_setting():
17121701
"""Whether to restart the scan when the interlock is triggered."""
1713-
endpoint = f"{EndpointType.INFO.value}/actor/builtin/scan_interlock/config/trigger_setting"
1702+
endpoint = f"{EndpointType.USER.value}/actor/builtin/scan_interlock/config/trigger_setting"
17141703
return EndpointInfo(
17151704
endpoint=endpoint,
17161705
message_type=messages.ScanInterlockTriggerSettingMessage,
@@ -1812,7 +1801,7 @@ def script_execution_info(script_id: str):
18121801
Returns:
18131802
EndpointInfo: Endpoint for script execution info.
18141803
"""
1815-
endpoint = f"{EndpointType.INFO.value}/scripts/execution_info/{script_id}"
1804+
endpoint = f"{EndpointType.USER.value}/scripts/execution_info/{script_id}"
18161805
return EndpointInfo(
18171806
endpoint=endpoint,
18181807
message_type=messages.ScriptExecutionInfoMessage,
@@ -1828,7 +1817,7 @@ def script_content(script_id: str):
18281817
Returns:
18291818
EndpointInfo: Endpoint for script content.
18301819
"""
1831-
endpoint = f"{EndpointType.INFO.value}/scripts/content/{script_id}"
1820+
endpoint = f"{EndpointType.USER.value}/scripts/content/{script_id}"
18321821
return EndpointInfo(
18331822
endpoint=endpoint, message_type=messages.VariableMessage, message_op=MessageOp.KEY_VALUE
18341823
)
@@ -1859,7 +1848,7 @@ def beamline_state(state_name: str):
18591848
Returns:
18601849
EndpointInfo: Endpoint for beamline state.
18611850
"""
1862-
endpoint = f"{EndpointType.INFO.value}/beamline_state/{state_name}"
1851+
endpoint = f"{EndpointType.USER.value}/beamline_state/{state_name}"
18631852
return EndpointInfo(
18641853
endpoint=endpoint,
18651854
message_type=messages.BeamlineStateMessage,
@@ -1875,7 +1864,7 @@ def available_beamline_states():
18751864
Returns:
18761865
EndpointInfo: Endpoint for beamline state updates.
18771866
"""
1878-
endpoint = f"{EndpointType.INFO.value}/available_beamline_states"
1867+
endpoint = f"{EndpointType.USER.value}/available_beamline_states"
18791868
return EndpointInfo(
18801869
endpoint=endpoint,
18811870
message_type=messages.AvailableBeamlineStatesMessage,
@@ -2073,7 +2062,7 @@ def dynamic_metric(group_name: str):
20732062
Returns:
20742063
EndpointInfo: Endpoint for dynamic metric publishing.
20752064
"""
2076-
endpoint = f"{EndpointType.INFO.value}/dynamic_metrics/{group_name}"
2065+
endpoint = f"{EndpointType.USER.value}/dynamic_metrics/{group_name}"
20772066
return EndpointInfo(
20782067
endpoint=endpoint,
20792068
message_type=messages.DynamicMetricMessage,

bec_lib/bec_lib/utils/user_acls_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,6 @@ def set_default_non_admin(self):
163163
EndpointType.PUBLIC.value,
164164
EndpointType.PERSONAL.value,
165165
EndpointType.USER.value,
166-
EndpointType.INFO.value,
167-
EndpointType.INTERNAL.value,
168166
]
169167
self.connector._managed_connection._redis_conn.acl_setuser(
170168
"default",

bec_lib/tests/test_acl_login.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ def test_access_demo_set_default_non_admin_allows_non_admin_namespaces(access_co
166166
f"&{EndpointType.PUBLIC.value}/*",
167167
f"&{EndpointType.PERSONAL.value}/*",
168168
f"&{EndpointType.USER.value}/*",
169-
f"&{EndpointType.INFO.value}/*",
170-
f"&{EndpointType.INTERNAL.value}/*",
171169
]
172170
)
173171
assert f"&{EndpointType.ADMIN.value}/*" not in acl_info["channels"]

bec_lib/tests/test_bec_logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_console_redis_callback_publishes_to_log_endpoint_with_console_service_n
112112

113113
logger.connector.xadd.assert_called_once()
114114
kwargs = logger.connector.xadd.call_args.kwargs
115-
assert kwargs["topic"].endpoint == "info/log"
115+
assert kwargs["topic"].endpoint == "user/log"
116116
assert kwargs["msg_dict"]["data"].log_type == "console_log"
117117
assert kwargs["msg_dict"]["data"].log_msg["service_name"] == "test_CONSOLE"
118118

0 commit comments

Comments
 (0)