Skip to content
This repository was archived by the owner on Nov 11, 2019. It is now read-only.

shipit/api: authorization work#1870

Merged
garbas merged 15 commits into
mozilla:masterfrom
garbas:shipit-authorization
Feb 15, 2019
Merged

shipit/api: authorization work#1870
garbas merged 15 commits into
mozilla:masterfrom
garbas:shipit-authorization

Conversation

@garbas
Copy link
Copy Markdown
Contributor

@garbas garbas commented Feb 12, 2019

No description provided.

@garbas garbas requested a review from rail February 12, 2019 13:35
@garbas garbas requested a review from La0 as a code owner February 12, 2019 13:35
Comment thread lib/backend_common/backend_common/auth.py Outdated
@garbas garbas requested a review from marco-c February 13, 2019 19:16
@garbas
Copy link
Copy Markdown
Contributor Author

garbas commented Feb 15, 2019

@marco-c @La0 could you also pass a review for this PR. i will shortly push to staging so you can really test it.

the reason for involving you is that i refactor a bit the authentication part and while i'm sure i did it correctly i can never be 100%. that is why i would like additional review. also this PR might mess up some of your projects which makes it at least fair to bring it to your attention.

if not flask_login.current_user.has_permissions(permissions):
user = flask_login.current_user.get_id()
user_permissions = flask_login.current_user.get_permissions()
diff = ' OR '.join([
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there a function in taskcluster-client that does this ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but we might not be using taskcluser for authorization. like we do in shipit/api.


# we must require scope which depends on product
required_permission = f'{SCOPE_PREFIX}/schedule_phase/{phase.release.product}/{phase.name}'
if not current_user.has_permissions(required_permission):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@garbas garbas merged commit c7ef9d9 into mozilla:master Feb 15, 2019
@garbas garbas deleted the shipit-authorization branch February 15, 2019 22:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants