|
29 | 29 | OIDC_ISSUER_SERVICE_NAMES, |
30 | 30 | lookup_custom_issuer_type, |
31 | 31 | ) |
32 | | -from warehouse.organizations.models import OrganizationProject |
33 | 32 | from warehouse.packaging.interfaces import IProjectService |
34 | 33 | from warehouse.packaging.models import ProjectFactory |
35 | 34 | from warehouse.rate_limiting.interfaces import IRateLimiter |
@@ -218,32 +217,14 @@ def mint_token( |
218 | 217 | # Try creating the new project |
219 | 218 | project_service = request.find_service(IProjectService) |
220 | 219 | try: |
221 | | - # Check if this pending publisher is for an organization |
222 | | - if pending_publisher.organization_id: |
223 | | - # For organization-owned projects, |
224 | | - # create without making the user an owner |
225 | | - new_project = project_service.create_project( |
226 | | - pending_publisher.project_name, |
227 | | - pending_publisher.added_by, |
228 | | - request, |
229 | | - creator_is_owner=False, |
230 | | - ratelimited=False, |
231 | | - ) |
232 | | - # Add the project to the organization |
233 | | - request.db.add( |
234 | | - OrganizationProject( |
235 | | - organization_id=pending_publisher.organization_id, |
236 | | - project_id=new_project.id, |
237 | | - ) |
238 | | - ) |
239 | | - else: |
240 | | - # For user-owned projects, create normally |
241 | | - new_project = project_service.create_project( |
242 | | - pending_publisher.project_name, |
243 | | - pending_publisher.added_by, |
244 | | - request, |
245 | | - ratelimited=False, |
246 | | - ) |
| 220 | + new_project = project_service.create_project( |
| 221 | + pending_publisher.project_name, |
| 222 | + pending_publisher.added_by, |
| 223 | + request, |
| 224 | + creator_is_owner=pending_publisher.organization_id is None, |
| 225 | + ratelimited=False, |
| 226 | + organization_id=pending_publisher.organization_id, |
| 227 | + ) |
247 | 228 | except HTTPException as exc: |
248 | 229 | return _invalid( |
249 | 230 | errors=[{"code": "invalid-payload", "description": str(exc)}], |
|
0 commit comments