Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Dec 6, 2023
1 parent 8673489 commit c29b0d0
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions plugins/quetz_googleiap/quetz_googleiap/middleware.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import logging
import uuid

from starlette.middleware.base import BaseHTTPMiddleware
from quetz.config import Config, ConfigEntry, ConfigSection

import quetz.authentication.base as auth_base

from quetz.dao import Dao
from quetz import rest_models
from quetz.config import Config, ConfigEntry, ConfigSection
from quetz.dao import Dao
from quetz.deps import get_config, get_db

from quetz.deps import (
get_config,
get_db,
)

import uuid
import datetime

import logging
logger = logging.getLogger("quetz.googleiam")


def email_to_channel_name(email):
name = email.split("@")[0]
name = name.replace(".", "-")
Expand All @@ -29,6 +24,7 @@ class GoogleIAMMiddleware(BaseHTTPMiddleware):
Handles Google IAM headers and authorizes users based on the
Google IAM headers.
"""

def __init__(self, app, config: Config):
if config is not None:
self.configure(config)
Expand Down Expand Up @@ -105,7 +101,7 @@ async def dispatch(self, request, call_next):
def google_role_for_user(self, user_id, dao):
if not user_id:
return

if user_id in self.server_admin_emails:
logger.info(f"User {user_id} is server admin")
dao.set_user_role(user_id, "owner")
Expand All @@ -115,4 +111,4 @@ def google_role_for_user(self, user_id, dao):


def middleware():
return GoogleIAMMiddleware
return GoogleIAMMiddleware

0 comments on commit c29b0d0

Please sign in to comment.