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

check if analysis is public or owned before rendering analysis builder in routes #764

Merged
merged 5 commits into from Jun 22, 2020

Conversation

rwblair
Copy link
Collaborator

@rwblair rwblair commented May 18, 2020

Fixes #759.

Redirects back to main page and displays a warning if user attempts to browse non public dataset that they don't own.

This would prevent private analyses from being viewed by non owners who have the id, is that something we want?

@rwblair rwblair requested a review from adelavega May 18, 2020 14:34
@adelavega
Copy link
Collaborator

Would it be possible to go into "view" mode instead?

I think people may want to share private stuff ala NeuroVault (if you know the adress you can access it).

But maybe not edit it (since the API won't let you anyways).

@tyarkoni what do you think?

@adelavega
Copy link
Collaborator

@rwblair this analysis Ma40P is not private and PASSED. Yet this PR's frontend is not letting me see it.

Any ideas?

@tyarkoni
Copy link

@rwblair also worth noting that the analysis loads fine if the user navigates from the public dashboard; it just can't be entered directly into the location bar.

@rwblair
Copy link
Collaborator Author

rwblair commented May 20, 2020

Hmm putting this logic in the routes directly might not be the best place for it. No current guarantee of certain props or states having loaded yet. I'll think about it some more.

@tyarkoni
Copy link

@rwblair cool, thanks. Just to clarify, I meant that it currently works if you navigate to it, but not if you enter the url directly. The desired behavior is that it should be visible no matter how you got there, as long as you have the right URL. ((I think we're on the same page, but just wanted to make sure.)

@codecov-commenter
Copy link

codecov-commenter commented May 21, 2020

Codecov Report

Merging #764 into master will increase coverage by 0.32%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #764      +/-   ##
==========================================
+ Coverage   83.16%   83.49%   +0.32%     
==========================================
  Files          63       63              
  Lines        2834     2956     +122     
==========================================
+ Hits         2357     2468     +111     
- Misses        477      488      +11     
Impacted Files Coverage Δ
neuroscout/populate/extract.py 65.00% <0.00%> (-2.67%) ⬇️
neuroscout/tests/api/test_analyses.py 98.31% <0.00%> (-0.25%) ⬇️
neuroscout/models/features.py 96.87% <0.00%> (+0.44%) ⬆️
neuroscout/utils/db.py 94.56% <0.00%> (+1.34%) ⬆️
neuroscout/tasks/utils/build.py 88.28% <0.00%> (+3.47%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6621690...71bbfe6. Read the comment docs.

@rwblair
Copy link
Collaborator Author

rwblair commented May 21, 2020

Ok shifted this check into the builder constructor. Instead of redirecting front page it now modifies which analysis statuses are considered editable so the non owner is dropped directly into the review tab even if analysis is still a draft.

This is wonky in the case that the analysis has say selected a dataset/task but no predictors. The plot generation fails and there isn't much information in the review section.

Do we want text for a non owner of a draft dataset to give context of whats going on or what they're looking at? The builder currently only has a boolean if the user owns the analysis or not, we could start tracking which user owns which analysis on the front end and have the builder display that information to non owners viewing an analysis.

@tyarkoni
Copy link

Oh, I don't think analyses should be viewable by anyone other than the owner unless they've actually been locked and executed. If you mean, what happens if there's an analysis that's technically been completed, but doesn't have any predictors, then it's fine if the review/plotting stuff fails; that's the owner's problem. But I don't think other people should be able to see analyses that are still open for editing, whether or not they've selected predictors. (Sorry, should have clarified that earlier.)

I do think the front end should probably display ownership information... though doing that right would probably require adding profile pages that list each user's public analyses etc. Worth opening an issue for, but not a high priority (although I'm lagging on the Neurosynth stuff I promised to get you, so I suppose if you have some cycles, adding this makes sense).

@adelavega
Copy link
Collaborator

adelavega commented May 21, 2020 via email

@tyarkoni
Copy link

I guess viewing drafts would be okay as long as it's clear they haven't been finalized... But if we want to allow that then I do think it needs to be made clear in some way who owns the analysis, and that it's not yet locked (e.g., with a red warning bar at the top saying something like "This analysis is still in the editing process and has not yet been finalized")

@rwblair
Copy link
Collaborator Author

rwblair commented Jun 16, 2020

@adelavega current state of this pr will let any one view a draft if they have the url. Can you look at the alert shown to non owners and let me know what it should look like and what it should say, its very basic at the moment.

@adelavega
Copy link
Collaborator

Hey @rwblair I think that works for now.

Maybe it can be more explicit:

"This analysis draft is currently read only. Only the owner of this draft can edit"

@adelavega
Copy link
Collaborator

The only minor niggle is a few pixels of spacing below the warning would be ideal.

Otherwise LGTM. We can circle back to this once we implement profiles.

@rwblair
Copy link
Collaborator Author

rwblair commented Jun 22, 2020

Ok updated the text and added a .5 em bottom margin.

@rwblair rwblair merged commit fa964e7 into master Jun 22, 2020
@adelavega adelavega deleted the draft_ownership branch January 29, 2021 00:15
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.

Non-editable analyses in DRAFT mode appear editable
4 participants