Skip to content

Commit b935d10

Browse files
fix: match ProjectMemberOrPublicAccess structure with PR #2759
1 parent 5bc6b11 commit b935d10

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/dstack/_internal/server/security/permissions.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ async def __call__(
110110

111111
class ProjectMemberOrPublicAccess:
112112
"""
113-
Allows access to project details for:
114-
1. Project members (existing behavior)
115-
2. Any authenticated user if the project is public
113+
Allows access to project for:
114+
- Global admins
115+
- Project members
116+
- Any authenticated user if the project is public
116117
"""
117118

118119
async def __call__(
@@ -130,16 +131,13 @@ async def __call__(
130131
if project is None:
131132
raise error_not_found()
132133

133-
# Global admins always have access
134134
if user.global_role == GlobalRole.ADMIN:
135135
return user, project
136136

137-
# Check if user is a project member
138137
project_role = get_user_project_role(user=user, project=project)
139138
if project_role is not None:
140139
return user, project
141140

142-
# If not a member, check if project is public
143141
if project.is_public:
144142
return user, project
145143

0 commit comments

Comments
 (0)