aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsobiemir <sobiemir@aculo.pl>2019-01-07 19:19:27 +0100
committersobiemir <sobiemir@aculo.pl>2019-01-07 19:19:27 +0100
commita62923c90a386cd46363f991e7deb63f0f90c5d9 (patch)
treeb50a384797ff59b438449f95d40ba3bc64c19878
parent4f813309958b0411bc3ff16c2d8dde80f1be8f18 (diff)
downloadredmine-revision-redirect-a62923c90a386cd46363f991e7deb63f0f90c5d9.tar.gz
redmine-revision-redirect-a62923c90a386cd46363f991e7deb63f0f90c5d9.zip
Fix permissions and record update
-rw-r--r--app/controllers/revision_redirects_controller.rb5
-rw-r--r--init.rb2
2 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/revision_redirects_controller.rb b/app/controllers/revision_redirects_controller.rb
index 796647a..8f07cfa 100644
--- a/app/controllers/revision_redirects_controller.rb
+++ b/app/controllers/revision_redirects_controller.rb
@@ -1,12 +1,11 @@
class RevisionRedirectsController < ApplicationController
- before_action :authorize
- before_action :find_repository_details, :only => [:edit, :update]
+ before_action :find_repository_details, :authorize, :only => [:edit, :update]
def edit
end
def update
- if @redirect.new_record? then
+ if @redirect == nil || @redirect.new_record? then
@redirect = RevisionRedirect.new(update_params)
@redirect.repository_id = params[:id]
diff --git a/init.rb b/init.rb
index 4a25550..a7659cb 100644
--- a/init.rb
+++ b/init.rb
@@ -5,6 +5,8 @@ Redmine::Plugin.register :redmine_revision_redirect do
version '0.0.1'
url 'https://git.aculo.pl/redmine-revision-redirect'
author_url 'https://aculo.pl'
+
+ permission :edit_revision_redirects, :revision_redirects => [:edit, :update]
end
Rails.configuration.to_prepare do