add User.can_use_subdomain column

This commit is contained in:
Son 2021-11-05 11:44:04 +01:00
parent 3f1020d5d7
commit ef734d7045
2 changed files with 34 additions and 0 deletions

View File

@ -387,6 +387,11 @@ class User(Base, ModelMixin, UserMixin, PasswordOracle):
sa.Boolean, default=False, nullable=False, server_default="0"
)
# subdomain access is limited at the beginning
can_use_subdomain = sa.Column(
sa.Boolean, default=False, nullable=False, server_default="0"
)
# implement flask-login "alternative token"
def get_id(self):
if self.alternative_id:

View File

@ -0,0 +1,29 @@
"""empty message
Revision ID: dd278f96ca83
Revises: fdb02bd105a8
Create Date: 2021-11-05 11:42:39.532067
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'dd278f96ca83'
down_revision = 'fdb02bd105a8'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('can_use_subdomain', sa.Boolean(), server_default='0', nullable=False))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'can_use_subdomain')
# ### end Alembic commands ###