Skip to content

Commit

Permalink
[MM-493]: Fixed the bug 'don't have the permissions to create subscri…
Browse files Browse the repository at this point in the history
…ptions 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
  • Loading branch information
Kshitij-Katiyar authored May 17, 2024
1 parent 8de9330 commit 69ab85a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,11 @@ func (p *Plugin) permissionToProject(ctx context.Context, userID, namespace, pro
return false
}

// Check for guest level permissions
if result.Permissions.ProjectAccess == nil || result.Permissions.ProjectAccess.AccessLevel == gitlabLib.GuestPermissions {
// User permission for the project
userPermission := result.Permissions

// Check if the user has guest permission or less for both project and group level
if (userPermission.ProjectAccess != nil && userPermission.ProjectAccess.AccessLevel <= gitlabLib.GuestPermissions) || (userPermission.GroupAccess != nil && userPermission.GroupAccess.AccessLevel <= gitlabLib.GuestPermissions) {
return false
}

Expand Down

0 comments on commit 69ab85a

Please sign in to comment.