Skip to content

Commit

Permalink
Merge pull request #32 from citysciencelab/public-providers
Browse files Browse the repository at this point in the history
Add support for public modelservers
  • Loading branch information
KaiVolland authored Aug 28, 2024
2 parents 7047cf7 + f5bf600 commit 52c0811
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ump/api/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,19 @@ def _processes_list(results):
auth = g.get('auth_token')

for provider in providers.PROVIDERS:
public_access = not "authentication" in providers.PROVIDERS[provider]
provider_access = auth is not None and (provider in auth['realm_access']['roles'] or provider in auth['resource_access']['ump-client']['roles'])
if provider_access:
if public_access or provider_access:
logging.debug(f"Granting access for model server {provider}")
try:
# Check if process has special configuration
for process in results[provider]:
id = f"{provider}_{process['id']}"
process_access = auth is not None and (id in auth['realm_access']['roles'] or id in auth['resource_access']['ump-client']['roles'])
if process_access or provider_access:
if public_access or process_access or provider_access:
logging.debug(f"Granting access for process {process['id']}")

if not provider_access and not process_access:
if not public_access and not provider_access and not process_access:
logging.debug(f"Not granting access for {process['id']}")
continue

Expand Down

0 comments on commit 52c0811

Please sign in to comment.