Backport check_project_feature_available! from EE
This commit is contained in:
parent
4b0b2f1525
commit
03228cb5b6
|
|
@ -53,9 +53,16 @@ class Projects::ApplicationController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_project_feature_available!(feature)
|
||||||
|
return render_404 unless project.feature_available?(feature, current_user)
|
||||||
|
end
|
||||||
|
|
||||||
def method_missing(method_sym, *arguments, &block)
|
def method_missing(method_sym, *arguments, &block)
|
||||||
if method_sym.to_s =~ /\Aauthorize_(.*)!\z/
|
case method_sym.to_s
|
||||||
|
when /\Aauthorize_(.*)!\z/
|
||||||
authorize_action!($1.to_sym)
|
authorize_action!($1.to_sym)
|
||||||
|
when /\Acheck_(.*)_available!\z/
|
||||||
|
check_project_feature_available!($1.to_sym)
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue