Skip to content

Commit

Permalink
quilt3.admin: SSO permissions mapping (#4065)
Browse files Browse the repository at this point in the history
  • Loading branch information
sir-sigurd authored Aug 13, 2024
1 parent 3768543 commit a5d9238
Show file tree
Hide file tree
Showing 13 changed files with 357 additions and 2 deletions.
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

0 comments on commit a5d9238

Please sign in to comment.