Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/groups/application_controller.rb')
-rw-r--r--app/controllers/groups/application_controller.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/controllers/groups/application_controller.rb b/app/controllers/groups/application_controller.rb
index f8cfa996447..5440908aee7 100644
--- a/app/controllers/groups/application_controller.rb
+++ b/app/controllers/groups/application_controller.rb
@@ -96,6 +96,28 @@ class Groups::ApplicationController < ApplicationController
def validate_root_group!
render_404 unless group.root?
end
+
+ def authorize_action!(action)
+ access_denied! unless can?(current_user, action, group)
+ end
+
+ def respond_to_missing?(method, *args)
+ case method.to_s
+ when /\Aauthorize_(.*)!\z/
+ true
+ else
+ super
+ end
+ end
+
+ def method_missing(method_sym, *arguments, &block)
+ case method_sym.to_s
+ when /\Aauthorize_(.*)!\z/
+ authorize_action!(Regexp.last_match(1).to_sym)
+ else
+ super
+ end
+ end
end
Groups::ApplicationController.prepend_mod_with('Groups::ApplicationController')