-
Notifications
You must be signed in to change notification settings - Fork 186
Add public projects #2759
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
Add public projects #2759
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR currently does not work since it's missing a db migration. Please ensure you've tested the changes.
Also note that we release from master, so PRs should not introduce partially working features or should hide them behind feature flags. This PR only makes public projects visible in the list but what happens if I open the project? I assume it will error. I'm ok with adding join/leave functionality in a separate PR, but at least it should not error when opening.
I suppose we should differentiate joined and not-joined projects in the UI, so maybe the API will return some field indicating that? |
be888c4
to
84e140a
Compare
… that changing it to include public non-member projects could break existing code that assumes membership, so split into two functions
fdd03c6
to
366f9c0
Compare
@haydnli-shopify, now there is a problem that clicking on a public project (/api/projects/{project_name}/get) would result in 403 since the /get endpoint allows only project members. Is your plan to make public projects "non-clickable" in the UI before joining? Just want to confirm Another option would be to show public project details before joining – it doesn't break any confidentiality since users can join and see anyway. |
I went with your second option - the /api/projects/{project_name}/get endpoint now allows any authenticated user to view public project details before joining. Added a new ProjectMemberOrPublicAccess permission class that maintains existing member access while enabling public project discovery. By the way, You could also check the PR for the second part of this issue here #2779, which handles works after we finish merging this current PR |
I recommend installing pre-commits so that linting is done automatically: https://github.com/dstackai/dstack/blob/master/contributing/DEVELOPMENT.md |
with op.batch_alter_table("projects", schema=None) as batch_op: | ||
batch_op.add_column(sa.Column("is_public", sa.Boolean(), nullable=True)) | ||
|
||
# Set is_public to False for existing projects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid WHAT comments that duplicate the code. If LLM generated, please remove.
@haydnli-shopify, also please avoid force pushing PRs once under review – makes it unnecessary harder for others to review and contribute. If you need to pull changes from master, just do a regular merge into a PR branch. |
@haydnli-shopify Have you tested the UI? I found the public project page won't open if a user is not a member because the UI requests /api/project/{project_name}/gateways/list which is only for members. I'm strongly against making project endpoints available for non-members even for public projects since it would complicate permission system and would be harder to keep track of. So I suggest the UI changes:
I think this PR can be merged to keep things going, so please address the issue in #2795. |
Summary
Implements support for public projects to improve user onboarding experience. Users can now create public projects that are visible to all users, while maintaining backward compatibility with private projects as the default.
This PR is part of the larger self-serve membership management effort described in #2742.
Fixes #2670
Changes Made
is_public
field to Project model (database, core model, API schemas)/api/projects/create
endpoint to acceptis_public
parameterAPI Usage
Testing
All tests pass including new comprehensive coverage:
test_creates_public_project
test_creates_private_project_by_default
test_creates_private_project_explicitly
test_returns_public_projects_to_non_members
test_member_sees_both_public_and_private_projects