Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quilt3.admin: SSO permissions mapping #4065

Merged
merged 9 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions api/python/quilt3-admin/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ fragment OperationErrorSelection on OperationError {
name
context
}
fragment SsoConfigSelection on SsoConfig {
text
timestamp
uploader {
...UserSelection
}
}

query rolesList {
roles {
Expand Down Expand Up @@ -187,3 +194,21 @@ mutation usersRemoveRoles($name: String!, $roles: [String!]!, $fallback: String)
}
}
}

query ssoConfigGet {
admin {
ssoConfig {
...SsoConfigSelection
}
}
}

mutation ssoConfigSet($config: String) {
admin {
setSsoConfig(config: $config) {
...SsoConfigSelection
...InvalidInputSelection
...OperationErrorSelection
}
}
}
4 changes: 2 additions & 2 deletions api/python/quilt3/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

# This wraps code generated by aridne-codegen to provide a more user-friendly API.

from . import roles, users
from . import roles, sso_config, users
from .exceptions import Quilt3AdminError, UserNotFoundError
from .types import ManagedRole, UnmanagedRole, User
from .types import ManagedRole, SSOConfig, UnmanagedRole, User
20 changes: 20 additions & 0 deletions api/python/quilt3/admin/_graphql_client/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

155 changes: 155 additions & 0 deletions api/python/quilt3/admin/_graphql_client/client.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions api/python/quilt3/admin/_graphql_client/fragments.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions api/python/quilt3/admin/_graphql_client/sso_config_get.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions api/python/quilt3/admin/_graphql_client/sso_config_set.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions api/python/quilt3/admin/sso_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import typing as T

from . import types, util


def get() -> T.Optional[types.SSOConfig]:
"""
Get the current SSO configuration.
"""
result = util.get_client().sso_config_get()
return None if result is None else types.SSOConfig(**result.model_dump())


def set(config: T.Optional[str]) -> types.SSOConfig:
"""
Set the SSO configuration.
"""
return types.SSOConfig(**util.handle_errors(util.get_client().sso_config_set(config)).model_dump())
7 changes: 7 additions & 0 deletions api/python/quilt3/admin/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,10 @@ class User:
is_service: bool
role: Optional[AnnotatedRole]
extra_roles: List[AnnotatedRole]


@pydantic.dataclasses.dataclass
class SSOConfig:
text: str
timestamp: datetime
uploader: User
Loading