forked from flojoy-ai/studio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
899c0dd
commit 0886652
Showing
15 changed files
with
6,458 additions
and
8,019 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,33 @@ | ||
from enum import StrEnum | ||
from pydantic import BaseModel | ||
from typing import Optional | ||
from pydantic import BaseModel, Field | ||
|
||
|
||
class Permission(StrEnum): | ||
class Role(StrEnum): | ||
admin = "Admin" | ||
operator = "Operator" | ||
localUser = "Local" | ||
|
||
|
||
class CloudConnection(BaseModel): | ||
token: str | ||
workspace: str | ||
cloud_url: str = Field(None, alias="cloudUrl") | ||
|
||
|
||
class Auth(BaseModel): | ||
username: str | ||
permission: Permission | ||
# If connected with cloud | ||
token: str | ||
url: str | ||
role: Role | ||
connection: Optional[CloudConnection] | ||
|
||
@property | ||
def token(self) -> str: | ||
return self.connection.token if self.connection else "" | ||
|
||
@token.setter | ||
def token(self, value: str): | ||
if self.connection is not None: | ||
self.connection.token = value | ||
|
||
@property | ||
def is_connected(self) -> bool: | ||
return True if self.connection else False |
Oops, something went wrong.