diff options
Diffstat (limited to 'chef-server-api/app/controllers/application.rb')
-rw-r--r-- | chef-server-api/app/controllers/application.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/chef-server-api/app/controllers/application.rb b/chef-server-api/app/controllers/application.rb index 6db4dda034..f6236b8511 100644 --- a/chef-server-api/app/controllers/application.rb +++ b/chef-server-api/app/controllers/application.rb @@ -88,6 +88,14 @@ class ChefServerApi::Application < Merb::Controller end end + def is_admin_or_validator + if @auth_user.admin || @auth_user.name == Chef::Config[:validation_client_name] + true + else + raise Unauthorized, "You are not allowed to take this action." + end + end + def is_correct_node if @auth_user.admin || @auth_user.name == params[:id] true |