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

feat(app): Implement organization settings backend #710

Merged
merged 7 commits into from
Jan 9, 2025
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
71 changes: 71 additions & 0 deletions alembic/versions/496c162975d7_add_organization_settings_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"""Add organization settings table

Revision ID: 496c162975d7
Revises: 9194fb66b4ea
Create Date: 2025-01-09 00:02:47.484038

"""
from collections.abc import Sequence

import sqlalchemy as sa
import sqlmodel.sql.sqltypes

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "496c162975d7"
down_revision: str | None = "9194fb66b4ea"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"organization_settings",
sa.Column("surrogate_id", sa.Integer(), nullable=False),
sa.Column("owner_id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
sa.Column(
"created_at",
sa.TIMESTAMP(timezone=True),
server_default=sa.text("now()"),
nullable=False,
),
sa.Column(
"updated_at",
sa.TIMESTAMP(timezone=True),
server_default=sa.text("now()"),
nullable=False,
),
sa.Column("id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
sa.Column("key", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("value", sa.LargeBinary(), nullable=False),
sa.Column("value_type", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("is_encrypted", sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint("surrogate_id"),
)
op.create_index(
op.f("ix_organization_settings_id"),
"organization_settings",
["id"],
unique=True,
)
op.create_index(
op.f("ix_organization_settings_key"),
"organization_settings",
["key"],
unique=True,
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(
op.f("ix_organization_settings_key"), table_name="organization_settings"
)
op.drop_index(
op.f("ix_organization_settings_id"), table_name="organization_settings"
)
op.drop_table("organization_settings")
# ### end Alembic commands ###
275 changes: 275 additions & 0 deletions frontend/src/client/schemas.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,77 @@ export const $ActionUpdate = {
title: 'ActionUpdate'
} as const;

export const $AuthSettingsRead = {
properties: {
auth_basic_enabled: {
type: 'boolean',
title: 'Auth Basic Enabled'
},
auth_require_email_verification: {
type: 'boolean',
title: 'Auth Require Email Verification'
},
auth_allowed_email_domains: {
items: {
type: 'string'
},
type: 'array',
title: 'Auth Allowed Email Domains'
},
auth_min_password_length: {
type: 'integer',
title: 'Auth Min Password Length'
},
auth_session_expire_time_seconds: {
type: 'integer',
title: 'Auth Session Expire Time Seconds'
}
},
type: 'object',
required: ['auth_basic_enabled', 'auth_require_email_verification', 'auth_allowed_email_domains', 'auth_min_password_length', 'auth_session_expire_time_seconds'],
title: 'AuthSettingsRead'
} as const;

export const $AuthSettingsUpdate = {
properties: {
auth_basic_enabled: {
type: 'boolean',
title: 'Auth Basic Enabled',
description: 'Whether basic auth is enabled.',
default: true
},
auth_require_email_verification: {
type: 'boolean',
title: 'Auth Require Email Verification',
description: 'Whether email verification is required for authentication.',
default: false
},
auth_allowed_email_domains: {
items: {
type: 'string'
},
type: 'array',
uniqueItems: true,
title: 'Auth Allowed Email Domains',
description: 'Allowed email domains for authentication. If empty, all domains are allowed.'
},
auth_min_password_length: {
type: 'integer',
title: 'Auth Min Password Length',
description: 'Minimum password length for authentication.',
default: 12
},
auth_session_expire_time_seconds: {
type: 'integer',
title: 'Auth Session Expire Time Seconds',
description: 'Session expiration time in seconds.',
default: 604800
}
},
type: 'object',
title: 'AuthSettingsUpdate'
} as const;

export const $Body_auth_reset_forgot_password = {
properties: {
email: {
Expand Down Expand Up @@ -1182,6 +1253,80 @@ export const $GetWorkflowDefinitionActivityInputs = {
title: 'GetWorkflowDefinitionActivityInputs'
} as const;

export const $GitSettingsRead = {
properties: {
git_allowed_domains: {
items: {
type: 'string'
},
type: 'array',
title: 'Git Allowed Domains'
},
git_repo_url: {
anyOf: [
{
type: 'string'
},
{
type: 'null'
}
],
title: 'Git Repo Url'
},
git_repo_package_name: {
anyOf: [
{
type: 'string'
},
{
type: 'null'
}
],
title: 'Git Repo Package Name'
}
},
type: 'object',
required: ['git_allowed_domains'],
title: 'GitSettingsRead'
} as const;

export const $GitSettingsUpdate = {
properties: {
git_allowed_domains: {
items: {
type: 'string'
},
type: 'array',
title: 'Git Allowed Domains',
description: 'Allowed git domains for authentication.'
},
git_repo_url: {
anyOf: [
{
type: 'string'
},
{
type: 'null'
}
],
title: 'Git Repo Url'
},
git_repo_package_name: {
anyOf: [
{
type: 'string'
},
{
type: 'null'
}
],
title: 'Git Repo Package Name'
}
},
type: 'object',
title: 'GitSettingsUpdate'
} as const;

export const $HTTPValidationError = {
properties: {
detail: {
Expand Down Expand Up @@ -1214,6 +1359,33 @@ export const $OAuth2AuthorizeResponse = {
title: 'OAuth2AuthorizeResponse'
} as const;

export const $OAuthSettingsRead = {
properties: {
oauth_google_enabled: {
type: 'boolean',
title: 'Oauth Google Enabled'
}
},
type: 'object',
required: ['oauth_google_enabled'],
title: 'OAuthSettingsRead',
description: 'Settings for OAuth authentication.'
} as const;

export const $OAuthSettingsUpdate = {
properties: {
oauth_google_enabled: {
type: 'boolean',
title: 'Oauth Google Enabled',
description: 'Whether OAuth is enabled.',
default: true
}
},
type: 'object',
title: 'OAuthSettingsUpdate',
description: 'Settings for OAuth authentication.'
} as const;

export const $OrgMemberRead = {
properties: {
user_id: {
Expand Down Expand Up @@ -2131,6 +2303,85 @@ export const $SAMLDatabaseLoginResponse = {
title: 'SAMLDatabaseLoginResponse'
} as const;

export const $SAMLSettingsRead = {
properties: {
saml_enabled: {
type: 'boolean',
title: 'Saml Enabled'
},
saml_enforced: {
type: 'boolean',
title: 'Saml Enforced'
},
saml_idp_metadata_url: {
anyOf: [
{
type: 'string'
},
{
type: 'null'
}
],
title: 'Saml Idp Metadata Url'
},
saml_sp_acs_url: {
anyOf: [
{
type: 'string'
},
{
type: 'null'
}
],
title: 'Saml Sp Acs Url'
}
},
type: 'object',
required: ['saml_enabled', 'saml_enforced'],
title: 'SAMLSettingsRead'
} as const;

export const $SAMLSettingsUpdate = {
properties: {
saml_enabled: {
type: 'boolean',
title: 'Saml Enabled',
description: 'Whether SAML is enabled.',
default: false
},
saml_enforced: {
type: 'boolean',
title: 'Saml Enforced',
description: 'Whether SAML is enforced. If true, users can only use SAML to authenticate. Requires SAML to be enabled.',
default: false
},
saml_idp_metadata_url: {
anyOf: [
{
type: 'string'
},
{
type: 'null'
}
],
title: 'Saml Idp Metadata Url'
},
saml_sp_acs_url: {
anyOf: [
{
type: 'string'
},
{
type: 'null'
}
],
title: 'Saml Sp Acs Url'
}
},
type: 'object',
title: 'SAMLSettingsUpdate'
} as const;

export const $Schedule = {
properties: {
owner_id: {
Expand Down Expand Up @@ -2823,6 +3074,24 @@ export const $SessionRead = {
title: 'SessionRead'
} as const;

export const $SettingRead = {
properties: {
key: {
type: 'string',
title: 'Key'
},
value_type: {
'$ref': '#/components/schemas/ValueType'
},
value: {
title: 'Value'
}
},
type: 'object',
required: ['key', 'value_type', 'value'],
title: 'SettingRead'
} as const;

export const $TagCreate = {
properties: {
name: {
Expand Down Expand Up @@ -3443,6 +3712,12 @@ export const $ValidationError = {
title: 'ValidationError'
} as const;

export const $ValueType = {
type: 'string',
const: 'json',
title: 'ValueType'
} as const;

export const $WebhookResponse = {
properties: {
owner_id: {
Expand Down
Loading
Loading