diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-09-11 10:06:30 +0200 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-09-28 16:35:01 +0200 |
commit | 098c36bb634fdc580fbcf8c79885142d9ec2ba15 (patch) | |
tree | b1a7b5c098c8beb857070e4b09f426383c17c49b /server/sonar-web/src/main/webapp | |
parent | f16b5672621fa152414a1f8afb24340c67668029 (diff) | |
download | sonarqube-098c36bb634fdc580fbcf8c79885142d9ec2ba15.tar.gz sonarqube-098c36bb634fdc580fbcf8c79885142d9ec2ba15.zip |
Add missing ruby code needed for navigation
Diffstat (limited to 'server/sonar-web/src/main/webapp')
-rw-r--r-- | server/sonar-web/src/main/webapp/WEB-INF/app/controllers/permission_templates_controller.rb | 25 | ||||
-rw-r--r-- | server/sonar-web/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb | 78 |
2 files changed, 25 insertions, 78 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/permission_templates_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/permission_templates_controller.rb new file mode 100644 index 00000000000..9f230e85133 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/permission_templates_controller.rb @@ -0,0 +1,25 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 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. +# + +class PermissionTemplatesController < ApplicationController + # GET + def index + end +end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb index 5cdcf358245..9a6f420d663 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb @@ -27,87 +27,9 @@ class RolesController < ApplicationController # GET /roles/global def global - access_denied unless has_role?(:admin) end # GET /roles/projects def projects - access_denied unless has_role?(:admin) end - - # GET /roles/edit_users[?resource=<resource>] - def edit_users - @project = Project.by_key(params[:resource]) if params[:resource].present? - check_project_admin - @role = params[:role] - render :partial => 'edit_users' - end - - # POST /roles/set_users?users=<users>&role=<role>[&resource=<resource>] - def set_users - @project = Project.by_key(params[:resource]) if params[:resource].present? - check_project_admin - bad_request('Missing role') if params[:role].blank? - UserRole.grant_users(params[:users], params[:role], params[:resource]) - render :text => '', :status => 200 - end - - # GET /roles/edit_groups[?resource=<resource>] - def edit_groups - @project = Project.by_key(params[:resource]) if params[:resource].present? - check_project_admin - @role = params[:role] - render :partial => 'edit_groups' - end - - # POST /roles/set_groups?users=<users>&role=<role>[&resource=<resource>] - def set_groups - @project = Project.by_key(params[:resource]) if params[:resource].present? - check_project_admin - bad_request('Missing role') if params[:role].blank? - GroupRole.grant_groups(params[:groups], params[:role], params[:resource]) - render :text => '', :status => 200 - end - - # GET /roles/apply_template_form?criteria - def apply_template_form - @names = params[:names] - @keys = params[:keys] - @qualifiers = params[:qualifiers] || 'TRK' - @results_count = params[:results_count].to_i || 0 - @components = params[:components] - - if @components && @components.size == 1 - project = Project.by_key(@components.first) - @permission_templates = Internal.permission_templates.selectAllPermissionTemplates(project.key).to_a.sort_by {|t| t.name.downcase}.collect {|pt| [pt.name, pt.key]} - else - @permission_templates = Internal.permission_templates.selectAllPermissionTemplates().to_a.sort_by {|t| t.name.downcase}.collect {|pt| [pt.name, pt.key]} - end - - render :partial => 'apply_template_form' - end - - # POST /roles/apply_template?criteria - def apply_template - verify_post_request - require_parameters :template_key - - if params['components'].blank? - params['pageSize'] = -1 - components = Internal.component_api.findWithUncompleteProjects(params).components().to_a - params['components'] = components.collect{|component| component.key()}.join(',') - end - - Internal.permissions.applyPermissionTemplate(params) - - redirect_to :action => 'projects' - end - - - private - - def check_project_admin - access_denied unless has_role?(:admin) || has_role?(:admin, @project) - end - end |