Fix lint issues in connect v1 resolvers

Drop the redundant embedded Resolver selector flagged by staticcheck
(QF1008) in the membership and organization permission resolvers, and
add the whitespace wsl_v5 expects around the attribute range loop and
the final return in permission.

Signed-off-by: Sacha Al Himdani <sacha@probo.com>
This commit is contained in:
Sacha Al Himdani
2026-07-08 22:02:31 +02:00
parent 86c45875a4
commit 83e7b3bdd4
3 changed files with 4 additions and 2 deletions

View File

@@ -45,7 +45,7 @@ func (r *membershipResolver) LastSession(ctx context.Context, obj *types.Members
// Permission is the resolver for the permission field.
func (r *membershipResolver) Permission(ctx context.Context, obj *types.Membership, action string, attributes map[string]any) (bool, error) {
return r.Resolver.permission(ctx, obj, action, attributes)
return r.permission(ctx, obj, action, attributes)
}
// UpdateMembership is the resolver for the updateMembership field.

View File

@@ -359,7 +359,7 @@ func (r *organizationResolver) Viewer(ctx context.Context, obj *types.Organizati
// Permission is the resolver for the permission field.
func (r *organizationResolver) Permission(ctx context.Context, obj *types.Organization, action string, attributes map[string]any) (bool, error) {
return r.Resolver.permission(ctx, obj, action, attributes)
return r.permission(ctx, obj, action, attributes)
}
// Organization returns schema.OrganizationResolver implementation.

View File

@@ -134,6 +134,7 @@ func (r *Resolver) Permission(ctx context.Context, obj types.Node, action string
func (r *Resolver) permission(ctx context.Context, obj types.Node, action string, attributes map[string]any) (bool, error) {
opts := []authz.AuthorizeFuncOption{authz.WithDryRun()}
for key, value := range attributes {
if s, ok := value.(string); ok {
opts = append(opts, authz.WithAttr(key, s))
@@ -141,6 +142,7 @@ func (r *Resolver) permission(ctx context.Context, obj types.Node, action string
}
_, err := r.authorize(ctx, obj.GetID(), action, opts...)
return err == nil, nil
}