diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-14 23:57:50 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-14 23:58:01 +0100 |
commit | f1a2949a0ad32c62e824eb9ed8ad121a7f23a076 (patch) | |
tree | 4425da7f88c458e0c68a0b4145fe3f7d08046bf9 /sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_configuration_controller.rb | |
parent | c8ca6faa8530fc6e1b42422b48500c82d6705c80 (diff) | |
download | sonarqube-f1a2949a0ad32c62e824eb9ed8ad121a7f23a076.tar.gz sonarqube-f1a2949a0ad32c62e824eb9ed8ad121a7f23a076.zip |
SONAR-2084 complete Web UI to encrypt properties
Diffstat (limited to 'sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_configuration_controller.rb')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_configuration_controller.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_configuration_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_configuration_controller.rb new file mode 100644 index 00000000000..d24569af8c4 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/encryption_configuration_controller.rb @@ -0,0 +1,54 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2008-2012 SonarSource +# mailto:contact AT sonarsource DOT com +# +# Sonar is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# Sonar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# +class EncryptionConfigurationController < ApplicationController + + SECTION=Navigation::SECTION_CONFIGURATION + before_filter :admin_required + before_filter :remove_layout + + verify :method => :post, :only => [:generate_secret, :encrypt], :redirect_to => {:action => :index} + + def index + if java_facade.hasSecretKey() + render :action => 'index' + else + render :action => 'generate_secret_form' + end + end + + def generate_secret_form + + end + + def generate_secret + render :text => java_facade.generateRandomSecretKey() + end + + def encrypt + bad_request('No secret key') unless java_facade.hasSecretKey() + render :text => java_facade.encrypt(params[:text]) + end + + private + + def remove_layout + params[:layout]='false' + end +end |