feat(ssh): add multi-organization support for certificate signing
Add support for users who belong to multiple organizations to select which organization's CA should sign their SSH certificates. Changes: - CLI: Add --org-id and --list-orgs options for organization selection - API: Return MULTIPLE_ORGS_AMBIGUOUS error when org selection needed - API: Add /users/me/organizations/simple endpoint for CLI org listing - DB: Add organization_id to certificate_audit_logs for better tracking - Include organization_name in certificate response for clarity
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
"""Add organization_id to certificate_audit_logs.
|
||||
|
||||
Revision ID: 8f2d9e4a7c1b
|
||||
Revises: b4cd6c6b3b1c
|
||||
Create Date: 2026-04-23 07:30:00.000000
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8f2d9e4a7c1b'
|
||||
down_revision = 'b4cd6c6b3b1c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# Add organization_id column to certificate_audit_logs
|
||||
op.add_column(
|
||||
'certificate_audit_logs',
|
||||
sa.Column('organization_id', sa.String(length=36), nullable=True)
|
||||
)
|
||||
|
||||
# Create index on organization_id
|
||||
op.create_index(
|
||||
'idx_cert_audit_org',
|
||||
'certificate_audit_logs',
|
||||
['organization_id']
|
||||
)
|
||||
|
||||
# Create foreign key constraint
|
||||
op.create_foreign_key(
|
||||
'fk_cert_audit_log_organization',
|
||||
'certificate_audit_logs',
|
||||
'organizations',
|
||||
['organization_id'],
|
||||
['id']
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
# Drop foreign key constraint
|
||||
op.drop_constraint('fk_cert_audit_log_organization', 'certificate_audit_logs', type_='foreignkey')
|
||||
|
||||
# Drop index
|
||||
op.drop_index('idx_cert_audit_org', 'certificate_audit_logs')
|
||||
|
||||
# Drop organization_id column
|
||||
op.drop_column('certificate_audit_logs', 'organization_id')
|
||||
Reference in New Issue
Block a user