Fix asset permissions

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-11-18 13:28:50 +01:00
parent 94bd5c7299
commit 41c0cf9daa

View File

@@ -3643,15 +3643,10 @@ func (r *mutationResolver) CreateAsset(ctx context.Context, input types.CreateAs
// UpdateAsset is the resolver for the updateAsset field.
func (r *mutationResolver) UpdateAsset(ctx context.Context, input types.UpdateAssetInput) (*types.UpdateAssetPayload, error) {
r.MustBeAuthorized(ctx, input.ID, authz.ActionUpdateAsset)
prb := r.ProboService(ctx, input.ID.TenantID())
existingAsset, err := prb.Assets.Get(ctx, input.ID)
if err != nil {
panic(fmt.Errorf("cannot get asset: %w", err))
}
r.MustBeAuthorized(ctx, existingAsset.OrganizationID, authz.ActionUpdateAsset)
asset, err := prb.Assets.Update(ctx, probo.UpdateAssetRequest{
ID: input.ID,
Name: input.Name,