Call Ability.allowed? directly in EE services, part 1

What does this MR do and why?

Part of removing User#can? (#638221 (closed)). User#can? only calls Ability.allowed?(self, ...), so callers can check permissions directly.

  • Calls Ability.allowed? directly in these EE services: DAST profile update, approval rule params filtering, epic board reposition, on-call rotation shared logic, operations dashboard projects, deployment approval, epic transfer, external status checks, the Slack Duo group base service, and the iteration cadence and rollover services.
  • Removes those files from .rubocop_todo/gitlab/authz/use_ability_allowed.yml.
  • Moves the user.can? stubs in the dashboard projects create service spec to Ability.allowed?.

Two calls used current_user&.can?. Dropping the &. gives the same answer for a nil user:

  • approve_deployment needs update_deployment (Developer) or an approval rule that matches the user. check_access(nil) returns false.
  • update_duo_in_slack comes only from the Owner role. Ability.allowed? already returns a boolean, so the !! is gone too.

References

Screenshots or screen recordings

Not applicable, no UI change.

How to set up and validate locally

bundle exec rubocop --only Gitlab/Authz/UseAbilityAllowed ee/app/services

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

🤖 Generated with Claude Code

Merge request reports

Loading
Loading