diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2013-09-23 18:23:21 +0200 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2013-09-24 08:43:44 +0200 |
commit | aae7c1ef772005a79b9398d3abfe9d0c1c81ceaa (patch) | |
tree | 89b46bfd2e59182952280c38c05bef14cbbce71f /sonar-server/src/main | |
parent | c1994d915d17b5f004270ec1de917f4301d80010 (diff) | |
download | sonarqube-aae7c1ef772005a79b9398d3abfe9d0c1c81ceaa.tar.gz sonarqube-aae7c1ef772005a79b9398d3abfe9d0c1c81ceaa.zip |
SONAR-3871 Create permission for provisioning - initial commit for backup
Diffstat (limited to 'sonar-server/src/main')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/api/permissions_controller.rb | 8 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/db/migrate/441_add_provisioning_permission.rb | 48 |
2 files changed, 52 insertions, 4 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/permissions_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/permissions_controller.rb index 67b1da0dd99..2a951916a28 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/permissions_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/permissions_controller.rb @@ -28,7 +28,7 @@ class Api::PermissionsController < Api::ApiController # # -- Mandatory parameters # 'permission' is the key of the permission to add. - # For global permissions, available values are : admin, profileadmin, shareDashboard, scan, dryRunScan. + # For global permissions, available values are : admin, profileadmin, shareDashboard, scan, dryRunScan, provisioning. # For component permissions, available values are : user, codeviewer, admin. # 'user' is the user identifier (login) # OR @@ -45,7 +45,7 @@ class Api::PermissionsController < Api::ApiController # Requests that attempt to add an already configured permission will be silently ignored # # since 3.7 - # 'component' parameter has been added in 4.0 + # 'component' parameter and 'provisioning' permission have been added in 4.0 # def add verify_post_request @@ -64,7 +64,7 @@ class Api::PermissionsController < Api::ApiController # # -- Mandatory parameters # 'permission' is the key of the permission to add. - # For global permissions, available values are : admin, profileadmin, shareDashboard, scan, dryRunScan. + # For global permissions, available values are : admin, profileadmin, shareDashboard, scan, dryRunScan, provisioning. # For component permissions, available values are : user, codeviewer, admin. # 'user' is the user identifier (login) # OR @@ -81,7 +81,7 @@ class Api::PermissionsController < Api::ApiController # Requests that attempt to remove a non-existing permission will be silently ignored # # since 3.7 - # 'component' parameter has been added in 4.0 + # 'component' parameter and 'provisioning' permission have been added in 4.0 # def remove verify_post_request diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/441_add_provisioning_permission.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/441_add_provisioning_permission.rb new file mode 100644 index 00000000000..de2a19767e2 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/441_add_provisioning_permission.rb @@ -0,0 +1,48 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2008-2013 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube 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. +# +# SonarQube 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 this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +# +# Sonar 4.0 +# SONAR-3871 +# + +class AddProvisioningPermission < ActiveRecord::Migration + + class GroupRole < ActiveRecord::Base + end + + class UserRole < ActiveRecord::Base + end + + def self.up + group_roles=GroupRole.find(:all, :conditions => {:role => 'admin', :resource_id => nil}) + groups = group_roles.map { |ur| ur.group_id } + groups.each do |group_id| + GroupRole.create(:group_id => group_id, :role => 'provisioning', :resource_id => nil) + end + + user_roles=UserRole.find(:all, :conditions => {:role => 'admin', :resource_id => nil}) + users = user_roles.map { |ur| ur.user_id } + users.each do |user_id| + UserRole.create(:user_id => user_id, :role=> 'provisioning', :resource_id => nil) + end + end + +end |