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

List projects to which a user is a Collaborator #234

Open
shaunanoordin opened this issue Jun 30, 2020 · 1 comment
Open

List projects to which a user is a Collaborator #234

shaunanoordin opened this issue Jun 30, 2020 · 1 comment

Comments

@shaunanoordin
Copy link
Member

Functionality Expansion

The Hamlet index page should list not only the projects that the current user is an owner of, but also the projects they're collaborators on.

Dev Notes

I'm thinking it's this bit in hamlet/views.py that needs to be changed:

@login_required
def index(request):
    with social_context(request) as p:
        context = {
            'projects': Project.where(owner=request.user.username),
        }

        return render(request, 'index.html', context)

I'm assuming that .where() is some sort of, uh, NumPy function so it needs to be transformed into something like Project.where(owner=request.user.username|collaborator=request.user.username) (link)

❗ Follow up is required: once the index page lists projects a user is a collaborator of, make sure collaborators actually have permission to view (or edit(?)) those resources. I assume this is already handled by hamlet/zooniverse_auth.py's collab_for_project() but best to check.

Status

Important, but not urgent.

@adammcmaster Is there any reason this added functionality would be a bad idea?

@shaunanoordin shaunanoordin self-assigned this Jun 30, 2020
@adammcmaster
Copy link
Contributor

I think this makes sense to implement, and you're right that that Project query is the only place that needs to be updated. Everything else will work without any changes (and actually it already works if the user types the project ID into the URL manually for any project they have permissions for in the API).

The .where() function is actually a Python client function which will translate any arguments you give it into the query string of the API request. I'm not sure whether you can query for both owner and collaborator in one go or if you'd need to do two queries and combine the results.

@shaunanoordin shaunanoordin removed their assignment Jul 25, 2022
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

No branches or pull requests

2 participants