Add logging for read_namespace usages
What does this MR do and why?
Add a log message when the :read_namespace
ability is used. This is done to make sure that the :read_namespace
ability is no longer used and can make a change in behaviour to align with how :read_group
and :read_project
behave.
See #421150 (comment 1638311666)
Screenshots or screen recordings
Example log line:
{
"severity":"INFO",
"time":"2023-11-10T22:18:05.372Z",
"message":"Ability is in use",
"ability":"read_namespace",
"caller_locations":[
"/workspace/gitlab-development-kit/gitlab/app/models/user.rb:1311:in `can?'",
"/home/gitpod/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/commands/runner/runner_command.rb:46:in `\u003cmain\u003e'",
"/home/gitpod/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/commands/runner/runner_command.rb:46:in `eval'",
"/home/gitpod/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/railties-7.0.8/lib/rails/commands/runner/runner_command.rb:46:in `perform'",
"/home/gitpod/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'"
]
}
How to set up and validate locally
bin/rails runner "Feature.enable :log_read_namespace_usages"
bin/rails runner "User.first.can? :read_namespace"
- Check
log/application_json.log
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Niklas van Schrick