add user.can_use_custom_domain, user.can_use_api_key
This commit is contained in:
parent
efd0e97ebd
commit
7bedd40966
|
@ -98,6 +98,10 @@ class User(db.Model, ModelMixin, UserMixin):
|
|||
|
||||
profile_picture_id = db.Column(db.ForeignKey(File.id), nullable=True)
|
||||
|
||||
# feature flag
|
||||
can_use_api_key = db.Column(db.Boolean, nullable=False, default=False)
|
||||
can_use_custom_domain = db.Column(db.Boolean, nullable=False, default=False)
|
||||
|
||||
profile_picture = db.relationship(File)
|
||||
|
||||
@classmethod
|
||||
|
|
2
cron.py
2
cron.py
|
@ -60,7 +60,7 @@ def stats():
|
|||
today = arrow.now().format()
|
||||
|
||||
email_utils.notify_admin(
|
||||
f"Stats for {today}",
|
||||
f"SimpleLogin Stats for {today}",
|
||||
f"""
|
||||
Stats for {today} <br>
|
||||
nb_user: {nb_user} <br>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: c5851f120b96
|
||||
Revises: e505cb517589
|
||||
Create Date: 2019-11-28 23:02:45.781149
|
||||
|
||||
"""
|
||||
import sqlalchemy_utils
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c5851f120b96'
|
||||
down_revision = 'e505cb517589'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('users', sa.Column('can_use_api_key', sa.Boolean(), nullable=False))
|
||||
op.add_column('users', sa.Column('can_use_custom_domain', sa.Boolean(), nullable=False))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'can_use_custom_domain')
|
||||
op.drop_column('users', 'can_use_api_key')
|
||||
# ### end Alembic commands ###
|
|
@ -103,6 +103,7 @@ def fake_data():
|
|||
password="password",
|
||||
activated=True,
|
||||
is_admin=True,
|
||||
can_use_api_key=True,
|
||||
)
|
||||
db.session.commit()
|
||||
|
||||
|
|
|
@ -46,9 +46,11 @@
|
|||
<i class="dropdown-icon fe fe-settings"></i> Settings
|
||||
</a>
|
||||
|
||||
<a class="dropdown-item" href="{{ url_for('dashboard.api_key') }}">
|
||||
<i class="dropdown-icon fe fe-chrome"></i> API Key
|
||||
</a>
|
||||
{% if current_user.can_use_api_key %}
|
||||
<a class="dropdown-item" href="{{ url_for('dashboard.api_key') }}">
|
||||
<i class="dropdown-icon fe fe-chrome"></i> API Key
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if current_user.is_premium() %}
|
||||
<a class="dropdown-item" href="{{ url_for('dashboard.billing') }}">
|
||||
|
|
Loading…
Reference in New Issue