Groups::ApplicationController should have def method_missing for optimizing before_action :authorize_xxx

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Description

Projects::ApplicationController has the following method.

def method_missing(method_sym, *arguments, &block)
  case method_sym.to_s
  when /\Aauthorize_(.*)!\z/
    authorize_action!($1.to_sym)
  when /\Acheck_(.*)_available!\z/
    check_project_feature_available!($1.to_sym)
  else
    super
  end
end

This method is convenient for defining policy. We usualy use before_action :authorize_xxx! in each controller. However Groups::ApplicationController doesn't have the same archtecture. We should have it for the consistency.

Proposal

Implement the same mechanizm in Groups::ApplicationController.

Links / references

  • https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12582#note_33915888

/cc @godfat

Edited Sep 28, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading