diff options
author | hellekin <hellekin@cepheide.org> | 2021-02-11 20:40:00 +0100 |
---|---|---|
committer | hellekin <hellekin@cepheide.org> | 2021-02-11 20:40:00 +0100 |
commit | e5619547d5544a043dfec173f17020b09f882a98 (patch) | |
tree | d6b127a0ea3b71d139531cfc25e2e68f558325f0 /app/controllers/agents_controller.rb | |
parent | 7f65f49b5036e4318b91dfc1ecd3ca21bc8ba74a (diff) | |
download | incommon-map-e5619547d5544a043dfec173f17020b09f882a98.tar.gz |
[FIX] Availability of agents
Diffstat (limited to 'app/controllers/agents_controller.rb')
-rw-r--r-- | app/controllers/agents_controller.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/agents_controller.rb b/app/controllers/agents_controller.rb index 105e443..fcbaebe 100644 --- a/app/controllers/agents_controller.rb +++ b/app/controllers/agents_controller.rb @@ -3,7 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later class AgentsController < ApplicationController - before_action :set_agent, only: [:new, :show, :edit, :update, :delete, :destroy] + before_action :set_agent, only: [:new, :show, :edit, :update, :delete, :destroy] # GET /agents def index @@ -26,7 +26,7 @@ class AgentsController < ApplicationController # GET /agents/:id/edit def edit - flash.now[:notice] = 'Please ask a maintainer to edit this resource!' unless current_user_maintainer? + flash.now[:notice] = 'Please ask a maintainer to edit this resource!' unless current_agent == @agent end # PATCH /agents/:id @@ -36,7 +36,7 @@ class AgentsController < ApplicationController # 2. Validate each change # 3. Moderate queue or save - return 403 unless current_user_maintainer? + return 403 unless current_agent == @agent respond_to do |format| if @agent.update(agent_params) @@ -51,7 +51,7 @@ class AgentsController < ApplicationController # GET /agents/:id/delete def delete - flash.now[:notice] = 'Please ask a maintainer to delete your Agent!' unless current_user_maintainer? + flash.now[:notice] = 'Please ask a maintainer to delete your Agent!' unless current_agent == @agent end # DELETE /agents/:id @@ -59,7 +59,7 @@ class AgentsController < ApplicationController return 403 # Yeah, right? # Check list # 1. User belongs to Agent and is :maintainer? - if !(current_user_maintainer? && current_user_leader?) + unless current_agent == @agent msg = 'You must be a maintainer and a leader to delete your Agent!' respond_to do |format| format.html { redirect_to :show, notice: msg } |