From 40a2087f08c36df72e30b9c330a911896aa23f1b Mon Sep 17 00:00:00 2001 From: Yiping Kang Date: Mon, 18 Sep 2023 18:46:59 -0400 Subject: [PATCH] Tweak global sentinel APIs --- jaseci_core/jaseci/extens/api/global_api.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/jaseci_core/jaseci/extens/api/global_api.py b/jaseci_core/jaseci/extens/api/global_api.py index b8a0d9b5ab..2e10990d85 100644 --- a/jaseci_core/jaseci/extens/api/global_api.py +++ b/jaseci_core/jaseci/extens/api/global_api.py @@ -50,13 +50,25 @@ def global_sentinel_set(self, snt: Sentinel = None): return {"response": f"Global sentinel set to '{snt}'!"} @Interface.admin_api() - def global_sentinel_set_access(self, snt: Sentinel = None): + def global_sentinel_setaccess(self, snt: Sentinel = None): """ Make a sentinel globally accessible """ snt.make_read_only() snt.propagate_access() - return {"response": f"Sentinel '{snt}' is now globally accessible."} + return {"response": f"Sentinel '{snt}' is now globally accessible (read-only)."} + + @Interface.admin_api() + def global_sentinel_revokeaccess(self, snt: Sentinel = None): + """ + Revoke the global accessibility of a sentinel. Making it private. + """ + if snt.check_write_access(self._m_id): + snt.make_private() + snt.propagate_access() + return {"response": f"Sentinel '{snt}' is now private."} + else: + return {"response:" "Insufficient permission."} @Interface.admin_api() def global_sentinel_unset(self):