Verified Commit c21ae8f1 authored by Peter Stanko's avatar Peter Stanko
Browse files

Updated Demo

parent e343dea3
Pipeline #12628 failed with stage
in 1 minute and 58 seconds
......@@ -53,7 +53,7 @@ To run the backend there are some steps required:
- Set the flask app env variable:
[source, bash]
----
export FLASK_APP='app.py'
export FLASK_APP='app:app'
----
- Run the migrations
......@@ -64,7 +64,16 @@ flask db upgrade
----
- Initialize the data (users)
[source, bash]
----
flask init_data admin
flask data init
----
- Set admin user password
[source, bash]
----
flask users set-password admin
----
......@@ -15,7 +15,7 @@ log = logging.getLogger(__name__)
def extract_user_info(me: dict) -> dict:
log.debug(f"[GITLAB] Received info: {me}")
return dict(
uco=None, # TODO: Need from gitlab or prompt the user
uco=None,
name=me['name'],
username=me['username'],
email=me['email']
......
......@@ -156,7 +156,7 @@ class UserRoleList(Resource):
def get(self, uid):
client = portal.service.auth.find_client()
user = portal.service.general.find_user(uid)
# authorization TODO: insufficient?
# authorization
if not (permissions.check_component(component=client)
or permissions.check_sysadmin(client)
or client == user):
......@@ -220,7 +220,7 @@ class UserEffectivePermissions(Resource):
def get(self, uid):
client = portal.service.auth.find_client()
user = portal.service.general.find_user(uid)
# authorization TODO - check
# authorization
if not (permissions.check_component(component=client)
or permissions.check_sysadmin(user)
or client == user):
......
......@@ -59,6 +59,7 @@ def validate_gitlab_token(token: str, username: str, throws: bool = True):
Returns(Bool):
"""
client = gitlab_factory.instance(oauth_token=token)
client.auth()
user = client.user
if user.username != username:
if throws:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment