1e3b354201
When a user now logs in for the first time for any external auth (LDAP, JWT, Keystone, Github, Google, Dex), they will be presented with a confirmation screen that affords them the opportunity to change their Quay-assigned username. Addresses most of the user issues around #74
47 lines
1.7 KiB
Python
47 lines
1.7 KiB
Python
"""Add user prompt support
|
|
|
|
Revision ID: 6c7014e84a5e
|
|
Revises: c156deb8845d
|
|
Create Date: 2016-10-31 16:26:31.447705
|
|
|
|
"""
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '6c7014e84a5e'
|
|
down_revision = 'c156deb8845d'
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
def upgrade(tables):
|
|
### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('userpromptkind',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(length=255), nullable=False),
|
|
sa.PrimaryKeyConstraint('id', name=op.f('pk_userpromptkind'))
|
|
)
|
|
op.create_index('userpromptkind_name', 'userpromptkind', ['name'], unique=False)
|
|
op.create_table('userprompt',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('user_id', sa.Integer(), nullable=False),
|
|
sa.Column('kind_id', sa.Integer(), nullable=False),
|
|
sa.ForeignKeyConstraint(['kind_id'], ['userpromptkind.id'], name=op.f('fk_userprompt_kind_id_userpromptkind')),
|
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], name=op.f('fk_userprompt_user_id_user')),
|
|
sa.PrimaryKeyConstraint('id', name=op.f('pk_userprompt'))
|
|
)
|
|
op.create_index('userprompt_kind_id', 'userprompt', ['kind_id'], unique=False)
|
|
op.create_index('userprompt_user_id', 'userprompt', ['user_id'], unique=False)
|
|
op.create_index('userprompt_user_id_kind_id', 'userprompt', ['user_id', 'kind_id'], unique=True)
|
|
### end Alembic commands ###
|
|
|
|
op.bulk_insert(tables.userpromptkind,
|
|
[
|
|
{'name':'confirm_username'},
|
|
])
|
|
|
|
|
|
def downgrade(tables):
|
|
### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('userprompt')
|
|
op.drop_table('userpromptkind')
|
|
### end Alembic commands ###
|