Fixes mlModel graphql when user is nil
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?
How to set up and validate locally
Example below:
-
In rails console enable the experiment fully
Feature.enable(:model_registry)
-
Create a model
project_id = 1 Ml::FindOrCreateModelService.new(Project.find_by(id:project_id), "model_1").execute
-
Open a anonymous window, navigate to
<gdk>/<project>/-/ml/models/<model_id>
, then oncandidates
. A message 'This model has no candidates' should be displayed, instead of500 error
Edited by David Fernandez