Skip to content

Commit

Permalink
adding permissions for every user and permissions from conf
Browse files Browse the repository at this point in the history
  • Loading branch information
costero-e committed Oct 30, 2023
1 parent b0033fb commit ba7b8e7
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion beacon/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
#
# Permissions server configuration
#
permissions_url = 'http://beacon-permissions'
permissions_url = 'http://beacon-permissions:5051/'
#permissions_url = 'http://localhost:5051/'

#
Expand Down
30 changes: 30 additions & 0 deletions beacon/db/extract_filtering_terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,44 @@
import numpy as np
from utils import get_filtering_documents

import sys
import os


current = os.path.dirname(os.path.realpath(__file__))


parent = os.path.dirname(current)


sys.path.append(parent)


import conf


ONTOLOGY_REGEX = re.compile(r"([_A-Za-z0-9]+):([_A-Za-z0-9^\-]+)")

client = MongoClient(
#"mongodb://127.0.0.1:27017/"
"mongodb://{}:{}@{}:{}/{}?authSource={}".format(
conf.database_user,
conf.database_password,
conf.database_host,
conf.database_port,
conf.database_name,
conf.database_auth_source,
)
)

'''
client = MongoClient(
client = MongoClient(
#"mongodb://127.0.0.1:27017/"
"mongodb://root:example@mongo:27017/beacon?authSource=admin"
)
'''

class MyProgressBar:
def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion beacon/utils/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def resolve_token(token, requested_datasets_ids):
# * return _all_ the datasets the user has access to, in case the datasets list is empty
async with ClientSession() as session:
async with session.post(
'http://beacon-permissions:5051/',
permissions_url,
headers={'Authorization': 'Bearer ' + token,
'Accept': 'application/json'},
json={'datasets': requested_datasets_ids}, # will set the Content-Type to application/json
Expand Down
2 changes: 1 addition & 1 deletion deploy/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
#
# Permissions server configuration
#
permissions_url = 'http://beacon-permissions'
permissions_url = 'http://beacon-permissions:5051/'

#
# IdP endpoints (OpenID Connect/Oauth2)
Expand Down

0 comments on commit ba7b8e7

Please sign in to comment.