Skip to content

Commit

Permalink
Tweak global sentinel APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
ypkang committed Sep 19, 2023
1 parent a87fccd commit 40a2087
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions jaseci_core/jaseci/extens/api/global_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 40a2087

Please sign in to comment.