mrs83 commited on
Commit
ef0dc4f
·
1 Parent(s): 374bd7c

fix issue when oauth_token is None

Browse files
Files changed (1) hide show
  1. blossomtune_gradio/ui/auth.py +4 -1
blossomtune_gradio/ui/auth.py CHANGED
@@ -9,7 +9,10 @@ def is_space_owner(profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToken |
9
  """Check if the user is the owner. Always returns True for local development."""
10
  if cfg.SPACE_OWNER is None:
11
  return True
12
- org_names = [org["name"] for org in whoami(oauth_token.token)["orgs"]]
 
 
 
13
  return profile is not None and (
14
  profile.name == cfg.SPACE_OWNER or cfg.SPACE_OWNER in org_names
15
  )
 
9
  """Check if the user is the owner. Always returns True for local development."""
10
  if cfg.SPACE_OWNER is None:
11
  return True
12
+ if oauth_token:
13
+ org_names = [org["name"] for org in whoami(oauth_token.token)["orgs"]]
14
+ else:
15
+ org_names = []
16
  return profile is not None and (
17
  profile.name == cfg.SPACE_OWNER or cfg.SPACE_OWNER in org_names
18
  )