Skip to content

Commit

Permalink
Revert scope promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
inventor96 authored and scottleibrand committed Apr 10, 2024
1 parent 2595eca commit 9b57b06
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bin/oref0_nightscout_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,23 @@ def startup_checks(args):
def check_permissions():
global token_dict
pg=[]
missing=[]

for perm_group in token_dict['permissionGroups']:
pg.extend(perm_group)

if pg==["*"]: # admin role
logging.warning("The use of the admin role for token based authentication is not recommended, see https://openaps.readthedocs.io/en/master/docs/walkthrough/phase-1/nightscout-setup.md#switching-from-api_secret-to-token-based-authentication-for-your-rig")
else:
missing=[]
for perm in ["api:treatments:read", "api:treatments:create", "api:treatments:read", "api:treatments:create", "api:devicestatus:read", "api:devicestatus:create"]:
logging.debug("Checking %s" % perm)
if perm not in pg:
missing.append(perm)

if len(missing)>0:
logging.error("The following permissions are missing in Nightscout: %s" % missing)
logging.error("Please follow instructions at https://openaps.readthedocs.io/en/master/docs/walkthrough/phase-1/nightscout-setup.md#switching-from-api_secret-to-token-based-authentication-for-your-rig")
sys.exit(1)
if len(missing)>0:
logging.error("The following permissions are missing in Nightscout: %s" % missing)
logging.error("Please follow instructions at https://openaps.readthedocs.io/en/master/docs/walkthrough/phase-1/nightscout-setup.md#switching-from-api_secret-to-token-based-authentication-for-your-rig")
sys.exit(1)

logging.info("All permissions in Nightscout are ok")

Expand Down

0 comments on commit 9b57b06

Please sign in to comment.