Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rest: add share_workflow endpoint #640

Closed
wants to merge 2 commits into from

Conversation

DaanRosendal
Copy link
Member

Adds a new endpoint to share a workflow with a user.

Closes reanahub/reana-client#680

Adds a new endpoint to share a workflow with a user.

Closes reanahub/reana-client#680
Copy link

codecov bot commented Nov 4, 2023

Codecov Report

Merging #640 (1f608f6) into master (58f0261) will decrease coverage by 0.27%.
The diff coverage is 37.03%.

❗ Current head 1f608f6 differs from pull request most recent head 4e05bae. Consider uploading reports for the commit 4e05bae to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #640      +/-   ##
==========================================
- Coverage   59.41%   59.14%   -0.27%     
==========================================
  Files          32       32              
  Lines        3294     3314      +20     
==========================================
+ Hits         1957     1960       +3     
- Misses       1337     1354      +17     
Files Coverage Δ
reana_server/rest/workflows.py 52.00% <37.03%> (-1.55%) ⬇️

Copy link
Member

@mdonadoni mdonadoni left a comment

Choose a reason for hiding this comment

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

This PR needs to be rebased! The commit messages might also need to be reworded to conform to the new commit convention.

Comment on lines +3256 to +3258
"user_email_to_share_with": fields.String(),
"message": fields.String(missing=None),
"valid_until": fields.String(missing=None),
Copy link
Member

Choose a reason for hiding this comment

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

As for r-workflow-controller, I think we should put these parameters in the body of the request instead of using query parameters

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree.

The change has been applied to this superseding PR: #658

application/json:
{
"message": "Malformed request.",
"errors": ["Missing data for required field."]
Copy link
Member

Choose a reason for hiding this comment

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

As for r-workflow-controller, let's remove the errors array if it's not needed, here and in the specification of the other error codes.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

The change has been applied to this superseding PR: #658

Comment on lines +3351 to +3353
{
"errors": ["User is not allowed to share the workflow."]
}
Copy link
Member

Choose a reason for hiding this comment

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

Examples and schema do not match

Copy link
Member Author

Choose a reason for hiding this comment

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

Well spotted. Fixed it.

The change has been applied to this superseding PR: #658

Comment on lines +49 to +50
from webargs import fields, validate
from webargs.flaskparser import use_kwargs
Copy link
Member

Choose a reason for hiding this comment

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

As for r-wokflow-controller, please check the order of imports https://github.com/reanahub/reana/wiki/Tips-for-Python#imports

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm pretty sure it's correct but I'm a bit short on time. Please double check.

The change has been applied to this superseding PR: #658

Comment on lines +3432 to +3435
except ValueError as e:
# In case of invalid workflow name / UUID
logging.exception(str(e))
return jsonify({"message": str(e)}), 403
Copy link
Member

Choose a reason for hiding this comment

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

I think this is not needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, thanks.

The change has been applied to this superseding PR: #658

"message": "Malformed request.",
"errors": ["Missing data for required field."]
}
403:
Copy link
Member

Choose a reason for hiding this comment

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

I think 403 is never returned?

Copy link
Member

@mdonadoni mdonadoni Jan 10, 2024

Choose a reason for hiding this comment

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

Actually this can be returned by the signin_required decorator, so let's keep it. We should also add 401, which is also returned by signin_required.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added the 401.

The change has been applied to this superseding PR: #658

@mdonadoni
Copy link
Member

Included in #658

@mdonadoni mdonadoni closed this Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cli: implement new share-add command
2 participants