Skip to content

Commit 69ab85a

Browse files
[MM-493]: Fixed the bug 'don't have the permissions to create subscriptions for this project (#495)
* [MM-493]: Fixed the bug 'don't have the permissions to create subscriptions for this project' * [MM-493]: Fixed lint errors * [MM-493]: Fixed review comments * [MM-493]: Fixed CI
1 parent 8de9330 commit 69ab85a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: server/webhook.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,11 @@ func (p *Plugin) permissionToProject(ctx context.Context, userID, namespace, pro
230230
return false
231231
}
232232

233-
// Check for guest level permissions
234-
if result.Permissions.ProjectAccess == nil || result.Permissions.ProjectAccess.AccessLevel == gitlabLib.GuestPermissions {
233+
// User permission for the project
234+
userPermission := result.Permissions
235+
236+
// Check if the user has guest permission or less for both project and group level
237+
if (userPermission.ProjectAccess != nil && userPermission.ProjectAccess.AccessLevel <= gitlabLib.GuestPermissions) || (userPermission.GroupAccess != nil && userPermission.GroupAccess.AccessLevel <= gitlabLib.GuestPermissions) {
235238
return false
236239
}
237240

0 commit comments

Comments
 (0)