Skip to content

Commit

Permalink
fix: use mod ID in version edit permission check (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
mircearoata authored Jan 7, 2025
1 parent 4a7c0af commit f82f620
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gql/directive.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ func canEditVersion(ctx context.Context, _ interface{}, next graphql.Resolver, f
return nil, err
}

if db.UserCanUploadModVersions(ctx, user, getArgument(ctx, field).(string)) {
versionID := getArgument(ctx, field).(string)
version, err := db.From(ctx).Version.Get(ctx, versionID)
if err != nil {
return nil, err
}

if db.UserCanUploadModVersions(ctx, user, version.ModID) {
return next(ctx)
}

Expand Down

0 comments on commit f82f620

Please sign in to comment.