Merge branch 'dev' into rrt/dev
This commit is contained in:
commit
4584dda992
|
@ -17,7 +17,6 @@ RUN pip install pipenv && \
|
||||||
COPY . /app/
|
COPY . /app/
|
||||||
|
|
||||||
ENV FLASK_APP=/app/crc/__init__.py
|
ENV FLASK_APP=/app/crc/__init__.py
|
||||||
CMD ["pipenv", "run", "flask", "db", "upgrade"]
|
|
||||||
CMD ["pipenv", "run", "python", "/app/run.py"]
|
CMD ["pipenv", "run", "python", "/app/run.py"]
|
||||||
|
|
||||||
# expose ports
|
# expose ports
|
||||||
|
|
|
@ -32,7 +32,7 @@ def verify_token(token):
|
||||||
def get_current_user():
|
def get_current_user():
|
||||||
return UserModelSchema().dump(g.user)
|
return UserModelSchema().dump(g.user)
|
||||||
|
|
||||||
@app.route('/login')
|
@app.route('/v1.0/login')
|
||||||
def sso_login():
|
def sso_login():
|
||||||
# This what I see coming back:
|
# This what I see coming back:
|
||||||
# X-Remote-Cn: Daniel Harold Funk (dhf8r)
|
# X-Remote-Cn: Daniel Harold Funk (dhf8r)
|
||||||
|
|
|
@ -18,7 +18,7 @@ class ApprovalModel(db.Model):
|
||||||
__tablename__ = 'approval'
|
__tablename__ = 'approval'
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
study_id = db.Column(db.Integer, db.ForeignKey(StudyModel.id), nullable=False)
|
study_id = db.Column(db.Integer, db.ForeignKey(StudyModel.id), nullable=False)
|
||||||
study = db.relationship(StudyModel, backref='approval')
|
study = db.relationship(StudyModel, backref='approval', cascade='all,delete')
|
||||||
workflow_id = db.Column(db.Integer, db.ForeignKey(WorkflowModel.id), nullable=False)
|
workflow_id = db.Column(db.Integer, db.ForeignKey(WorkflowModel.id), nullable=False)
|
||||||
workflow_version = db.Column(db.String)
|
workflow_version = db.Column(db.String)
|
||||||
approver_uid = db.Column(db.String) # Not linked to user model, as they may not have logged in yet.
|
approver_uid = db.Column(db.String) # Not linked to user model, as they may not have logged in yet.
|
||||||
|
|
|
@ -3,17 +3,15 @@
|
||||||
# run migrations
|
# run migrations
|
||||||
export FLASK_APP=./crc/__init__.py
|
export FLASK_APP=./crc/__init__.py
|
||||||
|
|
||||||
for entry in ./instance/* ; do
|
|
||||||
echo "$entry"
|
|
||||||
cat $entry
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$DOWNGRADE_DB" = "true" ]; then
|
if [ "$DOWNGRADE_DB" = "true" ]; then
|
||||||
echo 'Downgrading...'
|
echo 'Downgrading database...'
|
||||||
pipenv run flask db downgrade
|
pipenv run flask db downgrade
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pipenv run flask db upgrade
|
if [ "$UPGRADE_DB" = "true" ]; then
|
||||||
|
echo 'Upgrading database...'
|
||||||
|
pipenv run flask db upgrade
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$RESET_DB" = "true" ]; then
|
if [ "$RESET_DB" = "true" ]; then
|
||||||
echo 'Resetting database...'
|
echo 'Resetting database...'
|
||||||
|
|
|
@ -14,7 +14,8 @@ class ExampleDataLoader:
|
||||||
session.flush() # Clear out any transactions before deleting it all to avoid spurious errors.
|
session.flush() # Clear out any transactions before deleting it all to avoid spurious errors.
|
||||||
for table in reversed(db.metadata.sorted_tables):
|
for table in reversed(db.metadata.sorted_tables):
|
||||||
session.execute(table.delete())
|
session.execute(table.delete())
|
||||||
session.flush()
|
session.commit()
|
||||||
|
session.flush()
|
||||||
|
|
||||||
def load_all(self):
|
def load_all(self):
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 55c6cd407d89
|
||||||
|
Revises: cc4bccc5e5a8
|
||||||
|
Create Date: 2020-05-22 22:02:46.650170
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '55c6cd407d89'
|
||||||
|
down_revision = 'cc4bccc5e5a8'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_table('approval',
|
||||||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
|
sa.Column('study_id', sa.Integer(), nullable=False),
|
||||||
|
sa.Column('workflow_id', sa.Integer(), nullable=False),
|
||||||
|
sa.Column('workflow_version', sa.String(), nullable=True),
|
||||||
|
sa.Column('approver_uid', sa.String(), nullable=True),
|
||||||
|
sa.Column('status', sa.String(), nullable=True),
|
||||||
|
sa.Column('message', sa.String(), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['study_id'], ['study.id'], ),
|
||||||
|
sa.ForeignKeyConstraint(['workflow_id'], ['workflow.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_table('approval')
|
||||||
|
# ### end Alembic commands ###
|
|
@ -44,7 +44,7 @@ class TestAuthentication(BaseTest):
|
||||||
self.assertIsNone(user)
|
self.assertIsNone(user)
|
||||||
redirect_url = 'http://worlds.best.website/admin'
|
redirect_url = 'http://worlds.best.website/admin'
|
||||||
headers = dict(Uid=new_uid)
|
headers = dict(Uid=new_uid)
|
||||||
rv = self.app.get('login', follow_redirects=False, headers=headers)
|
rv = self.app.get('v1.0/login', follow_redirects=False, headers=headers)
|
||||||
self.assert_success(rv)
|
self.assert_success(rv)
|
||||||
user = db.session.query(UserModel).filter(UserModel.uid == new_uid).first()
|
user = db.session.query(UserModel).filter(UserModel.uid == new_uid).first()
|
||||||
self.assertIsNotNone(user)
|
self.assertIsNotNone(user)
|
||||||
|
|
Loading…
Reference in New Issue