Skip to content

Fixes mlModel graphql when user is nil

Eduardo Bonet requested to merge model_registry/fix_anonymous_access into master

What does this MR do and why?

Fixes mlModel graphql when user is nil

When anonymous users would access a query on mlModels, they would crash even if they did have access to the endpoint. This fixes by using Ability.allowed? instead of user.can?

image

How to set up and validate locally

Example below:

  1. In rails console enable the experiment fully

    Feature.enable(:model_registry)
  2. Create a model

    project_id = 1
    Ml::FindOrCreateModelService.new(Project.find_by(id:project_id), "model_1").execute
  3. Open a anonymous window, navigate to <gdk>/<project>/-/ml/models/<model_id>, then on candidates. A message 'This model has no candidates' should be displayed, instead of 500 error image

Edited by David Fernandez

Merge request reports