diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-09-07 11:00:04 +0200 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-09-28 16:34:53 +0200 |
commit | 71d96685b3d707e1eb22cc34ed478e5ed9dec498 (patch) | |
tree | 3084272de84e3b36af8e97918cdcd9ec565278aa /server/sonar-web/src/main/webapp | |
parent | 01d571eefe7004ff251f4472bd904fb1f504ca0d (diff) | |
download | sonarqube-71d96685b3d707e1eb22cc34ed478e5ed9dec498.tar.gz sonarqube-71d96685b3d707e1eb22cc34ed478e5ed9dec498.zip |
Delete Ruby code in the permission domain
Diffstat (limited to 'server/sonar-web/src/main/webapp')
12 files changed, 0 insertions, 812 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/permissions_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/permissions_controller.rb deleted file mode 100644 index 5f1e79ea51b..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/permissions_controller.rb +++ /dev/null @@ -1,98 +0,0 @@ -# -# 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. -# - -# -# Since 3.7 -# -class Api::PermissionsController < Api::ApiController - - # - # POST /api/permissions/add - # - # -- Mandatory parameters - # 'permission' is the key of the permission to add. - # For global permissions, available values are : admin, profileadmin, shareDashboard, scan, dryRunScan, provisioning. - # For component permissions, available values are : user, codeviewer, admin, issueadmin. - # 'user' is the user identifier (login) - # OR - # 'group' is the group identifier (group name or 'anyone') - # - # -- Optional parameters - # 'component' is the component key on which add the permission. If null, the permission should be a global permission. - # - # -- Example - # curl -X POST -v -u admin:admin 'http://localhost:9000/api/permissions/add?permission=shareDashboard&user=new_user' - # - # -- Notes - # An exception will be raised if both a user and a group are provided - # Requests that attempt to add an already configured permission will be silently ignored - # - # since 3.7 - # 'component' parameter and 'provisioning' permission have been added in 4.0 - # 'issueadmin' permission has been added in 4.1 - # - def add - verify_post_request - require_parameters :permission - require_one_of :group, :user - Internal.permissions.addPermission(params) - hash = {:user => params[:user], :group => params[:group], :permission => params[:permission]} - respond_to do |format| - format.json { render :json => jsonp(hash), :status => 200 } - format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'sonar', :status => 200) } - end - end - - # - # POST /api/permissions/remove - # - # -- Mandatory parameters - # 'permission' is the key of the permission to add. - # 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 - # 'group' is the group identifier (group name or 'anyone') - # - # -- Optional parameters - # 'component' is the component key on which add the permission. If null, the permission should be a global permission. - # - # -- Example - # curl -X POST -v -u admin:admin 'http://localhost:9000/api/permissions/remove?permission=shareDashboard&user=new_user' - # - # -- Notes - # An exception will be raised if both a user and a group are provided - # Requests that attempt to remove a non-existing permission will be silently ignored - # - # since 3.7 - # 'component' parameter and 'provisioning' permission have been added in 4.0 - # - def remove - verify_post_request - require_parameters :permission, (params[:user].nil? ? :group : :user) - Internal.permissions.removePermission(params) - hash = {:user => params[:user], :group => params[:group], :permission => params[:permission]} - respond_to do |format| - format.json { render :json => jsonp(hash), :status => 200 } - format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'sonar', :status => 200) } - end - end - -end 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 deleted file mode 100644 index 4babd23a90f..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/permission_templates_controller.rb +++ /dev/null @@ -1,329 +0,0 @@ -# -# 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. -# - -# -# @since 3.7 -# -# Note : do NOT use @template as an instance variable -# as it is a reserved variable in Rails -# -class PermissionTemplatesController < ApplicationController - - helper RolesHelper - include RolesHelper - - SECTION = Navigation::SECTION_CONFIGURATION - - before_filter :admin_required - - # - # GET - # - def index - all_templates = Internal.permission_templates.selectAllPermissionTemplates - - @permission_templates = get_templates_and_permissions(all_templates) - @root_qualifiers = get_root_qualifiers - @default_templates = get_default_templates_per_qualifier(@root_qualifiers) - end - - # - # GET /permission_templates/search_users?permission=<permission>&template=<template key>selected=<selected>&page=3&pageSize=10&query=<query> - # - def search_users - result = Internal.permission_templates.findUsersWithPermissionTemplate(params) - users = result.users() - more = result.hasMoreResults() - - respond_to do |format| - format.json { - render :json => { - :more => more, - :results => users.map { |user| { - :login => user.login(), - :name => user.name(), - :selected => user.hasPermission() - }} - } - } - end - end - - # - # POST - # - def add_user_permission - verify_post_request - require_parameters :template, :permission, :user - - Internal.permission_templates.addUserPermission(params[:template], params[:permission], params[:user]) - status = 200 - render :status => status, :text => '{}' - end - - # - # POST - # - def remove_user_permission - verify_post_request - require_parameters :template, :permission, :user - - Internal.permission_templates.removeUserPermission(params[:template], params[:permission], params[:user]) - status = 200 - render :status => status, :text => '{}' - end - - # - # GET /permission_templates/search_groups?permission=<permission>&template=<template key>selected=<selected>&page=3&pageSize=10&query=<query> - # - def search_groups - result = Internal.permission_templates.findGroupsWithPermissionTemplate(params) - groups = result.groups() - more = result.hasMoreResults() - - respond_to do |format| - format.json { - render :json => { - :more => more, - :results => groups.map { |group| - hash = { - :name => group.name(), - :selected => group.hasPermission() - } - hash[:description] = group.description() if group.description() && !group.description().blank? - hash - } - } - } - end - end - - # - # POST - # - def add_group_permission - verify_post_request - require_parameters :template, :permission, :group - - Internal.permission_templates.addGroupPermission(params[:template], params[:permission], params[:group]) - status = 200 - render :status => status, :text => '{}' - end - - # - # POST - # - def remove_group_permission - verify_post_request - require_parameters :template, :permission, :group - - Internal.permission_templates.removeGroupPermission(params[:template], params[:permission], params[:group]) - status = 200 - render :status => status, :text => '{}' - end - - # - # TODO delete it - # - def edit_users - @permission = params[:permission] - @permission_template = Internal.permission_templates.selectPermissionTemplate(params[:key]) - @users_with_permission = @permission_template.getUsersForPermission(params[:permission]).collect {|u| [u.userName, u.userLogin]} - @users_without_permission = all_users.each.collect {|u| [u.name, u.login]} - @users_with_permission - - render :partial => 'permission_templates/edit_users' - end - - # - # TODO delete it - # - def edit_groups - @permission = params[:permission] - @permission_template = Internal.permission_templates.selectPermissionTemplate(params[:key]) - @groups_with_permission = @permission_template.getGroupsForPermission(params[:permission]).collect {|g| [group_ref(g.groupName), group_ref(g.groupName)]} - @groups_without_permission = all_groups.each.collect {|g| g.nil? ? ['Anyone', 'Anyone'] : [g.name, g.name]} - @groups_with_permission - - render :partial => 'permission_templates/edit_groups' - end - - # - # TODO delete it# POST - # - def update_users_permissions - verify_post_request - require_parameters :key, :permission - - @permission_template = Internal.permission_templates.selectPermissionTemplate(params[:key]) - - selected_users = params[:users] || [] - - previous_users_with_permission = @permission_template.getUsersForPermission(params[:permission]).collect {|u| [u.userName, u.userLogin]} - new_users_with_permission = all_users.select {|u| selected_users.include?(u.login)}.collect {|u| [u.name, u.login]} - - promoted_users = new_users_with_permission - previous_users_with_permission - demoted_users = previous_users_with_permission - new_users_with_permission - - promoted_users.each do |user| - Internal.permission_templates.addUserPermission(params[:key], params[:permission], user[1]) - end - - demoted_users.each do |user| - Internal.permission_templates.removeUserPermission(params[:key], params[:permission], user[1]) - end - - redirect_to :action => 'index' - end - - # - # TODO delete it - # - def update_groups_permissions - verify_post_request - require_parameters :key, :permission - - @permission_template = Internal.permission_templates.selectPermissionTemplate(params[:key]) - - selected_groups = params[:groups] || [] - - previous_groups_with_permission = @permission_template.getGroupsForPermission(params[:permission]).collect {|g| [group_ref(g.groupName), group_ref(g.groupName)]} - new_groups_with_permission = all_groups.collect {|g| g.nil? ? ['Anyone', 'Anyone'] : [g.name, g.name]}.select {|g| selected_groups.include?(g[1])} - - promoted_groups = new_groups_with_permission - previous_groups_with_permission - demoted_groups = previous_groups_with_permission - new_groups_with_permission - - promoted_groups.each do |group| - Internal.permission_templates.addGroupPermission(params[:key], params[:permission], group[1]) - end - - demoted_groups.each do |group| - Internal.permission_templates.removeGroupPermission(params[:key], params[:permission], group[1]) - end - - redirect_to :action => 'index' - end - - # - # GET (modal form) - # - def create_form - render :partial => 'permission_templates/permission_template_form', - :locals => {:form_action => 'create', :message_title => 'new_template', :message_submit => 'create_template'} - end - - # - # POST - # - def create - verify_post_request - @permission_template = Internal.permission_templates.createPermissionTemplate(params[:name], params[:description], params[:pattern]) - redirect_to :action => 'index' - end - - # - # GET (modal form) - # - def edit_form - @permission_template = Internal.permission_templates.selectPermissionTemplate(params[:key]) - render :partial => 'permission_templates/permission_template_form', - :locals => {:form_action => 'edit', :message_title => 'edit_template', :message_submit => 'update_template'} - end - - # - # POST - # - def edit - verify_post_request - require_parameters :id, :name - Internal.permission_templates.updatePermissionTemplate(params[:id].to_i, params[:name], params[:description], params[:pattern]) - redirect_to :action => 'index' - end - - # - # GET (modal form) - # - def delete_form - @permission_template = Internal.permission_templates.selectPermissionTemplate(params[:key]) - render :partial => 'permission_templates/delete_form' - end - - # - # POST - # - def delete - verify_post_request - require_parameters :id - Internal.permission_templates.deletePermissionTemplate(params[:id].to_i) - redirect_to :action => 'index' - end - - # - # GET (modal form) - # - def default_templates_form - all_templates = Internal.permission_templates.selectAllPermissionTemplates.to_a - - @permission_templates_options = all_templates.sort_by {|t| t.name.downcase}.collect {|t| [t.name, t.key]} - @root_qualifiers = get_root_qualifiers - @default_templates = get_default_templates_per_qualifier(@root_qualifiers) - - render :partial => 'permission_templates/default_templates_form' - end - - # - # POST - # - def update_default_templates - verify_post_request - get_root_qualifiers.each do |qualifier| - Property.set("sonar.permission.template.#{qualifier}.default", params["default_template_#{qualifier}"]) - if 'TRK' == qualifier - Property.set("sonar.permission.template.default", params["default_template_#{qualifier}"]) - end - end - redirect_to :action => 'index' - end - - - private - - def get_root_qualifiers - Java::OrgSonarServerUi::JRubyFacade.getInstance().getResourceRootTypes().map {|type| type.getQualifier()}.to_a.sort - end - - def get_default_templates_per_qualifier(root_qualifiers) - default_templates = {} - default_template_property = Property.by_key("sonar.permission.template.default") - root_qualifiers.each do |qualifier| - qualifier_template = Property.by_key("sonar.permission.template.#{qualifier}.default") - default_templates[qualifier] = qualifier_template ? qualifier_template.text_value : default_template_property.text_value - end - default_templates - end - - def get_templates_and_permissions(permission_templates) - templates_keys = permission_templates.collect {|t| t.key} - permission_templates = [] - templates_keys.each do |template_key| - permission_templates << Internal.permission_templates.selectPermissionTemplate(template_key) - end - permission_templates.sort_by {|t| t.name.downcase} - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/permissions_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/permissions_controller.rb deleted file mode 100644 index 1e427ff48af..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/permissions_controller.rb +++ /dev/null @@ -1,71 +0,0 @@ -# -# Sonar, entreprise quality control 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 PermissionsController < ApplicationController - - # - # GET /permissions/search_users?permission=<permission>&component=<component_key>&selected=all&page=5%pageSize=50&query=john - # - # Possible value of 'selected' are 'selected', 'deselected' and 'all' () - # - def search_users - result = Internal.permissions.findUsersWithPermission(params) - users = result.users() - more = result.hasMoreResults() - respond_to do |format| - format.json { - render :json => { - :more => more, - :results => users.map { |user| { - :login => user.login(), - :name => user.name(), - :selected => user.hasPermission() - }} - } - } - end - end - - # - # GET /permissions/search_groups?permission=<permission>&component=<component_key>&selected=all&page=5%pageSize=50&query=users - # - # Possible value of 'selected' are 'selected', 'deselected' and 'all' () - # - def search_groups - result = Internal.permissions.findGroupsWithPermission(params) - groups = result.groups() - more = result.hasMoreResults() - respond_to do |format| - format.json { - render :json => { - :more => more, - :results => groups.map { |group| - hash = { - :name => group.name(), - :selected => group.hasPermission() - } - hash[:description] = group.description() if group.description() && !group.description().blank? - hash - } - } - } - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_default_templates_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_default_templates_form.html.erb deleted file mode 100644 index b7d7f2be32e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_default_templates_form.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -<form id="default-templates-form" method="post" action="<%= ApplicationController.root_context -%>/permission_templates/update_default_templates"> - <fieldset> - <div class="modal-head"> - <h2><%= message('permission_template.set_default_templates') -%></h2> - </div> - <div class="modal-body"> - <div class="modal-error"/> - <% @root_qualifiers.each do |qualifier| %> - <div class="modal-field"> - <%= label_tag("default_template_#{qualifier}", " For #{message('qualifier.' + qualifier).downcase}s") %> - <%= select_tag("default_template_#{qualifier}", options_for_select(@permission_templates_options, @default_templates[qualifier])) %> - </div> - <% end %> - </div> - <div class="modal-foot"> - <input type="submit" value="<%= h message('permission_template.update_permissions') -%>" id="submit-default-templates"/> - <a href="#" onclick="return closeModalWindow()" id="cancel-default-templates"><%= h message('cancel') -%></a> - </div> - </fieldset> -</form> - -<script> - $j("#default-templates-form").modalForm({ - success: function (data) { - window.location.reload(); - } - }); -</script> - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_delete_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_delete_form.html.erb deleted file mode 100644 index e308fccd733..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_delete_form.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -<form id="delete-template-form" method="post" action="<%= ApplicationController.root_context -%>/permission_templates/delete"> - <input type="hidden" name="id" value="<%= @permission_template.id -%>"> - <fieldset> - <div class="modal-head"> - <h2><%= message 'permission_template.delete_confirm_title' -%></h2> - </div> - <div class="modal-body"> - <div id="permission-template-error" class="permission-template error errors" style="display:none;" /> - <div class="info"> - <img src="<%= ApplicationController.root_context -%>/images/information.png" style="vertical-align: text-bottom"/> - <%= message 'permission_template.do_you_want_to_delete_template_xxx', :params => @permission_template.name -%> - </div> - </div> - <div class="modal-foot"> - <input type="submit" value="<%= message 'permission_template.delete_template' -%>" id="confirm-submit"/> - <a href="#" onclick="return closeModalWindow()" id="confirm-cancel"><%= h message('cancel') -%></a> - </div> - </fieldset> -</form> - -<script> - $j("#delete-template-form").modalForm({success: function (data) { - window.location.reload(); - }}); -</script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_edit_groups.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_edit_groups.html.erb deleted file mode 100644 index 78b5211d08f..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_edit_groups.html.erb +++ /dev/null @@ -1,43 +0,0 @@ -<div class="modal-head"> - <h2><%= "Edit Permission #{message("projects_role.#{@permission}")} For: " + @permission_template.name -%></h2> -</div> - -<div class="modal-body"> - <div id="select-list-group"></div> -</div> - -<div class="modal-foot"> - <a href="#" onclick="window.location.reload();return false"><%= h message('close') -%></a> -</div> - -<script> - var selectList = new SelectList({ - el: '#select-list-group', - width: '100%', - format: function (item) { - var label = item.name; - if (item.description) { - label += ' <div class="note">' + item.description + '</div>' - } - return label; - }, - searchUrl: baseUrl + '/permission_templates/search_groups?permission=<%= @permission -%>&template=<%= @permission_template.key -%>', - selectUrl: baseUrl + '/permission_templates/add_group_permission', - deselectUrl: baseUrl + '/permission_templates/remove_group_permission', - extra: { - permission: '<%= @permission -%>', - template: '<%= @permission_template.key -%>' - }, - selectParameter: 'group', - selectParameterValue: 'name', - labels: { - selected: 'With', - deselected: 'Without', - all: 'All' - }, - tooltips: { - select: 'Click to grant the permission to the group', - deselect: 'Click to revoke the permission from the group' - } - }); -</script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_edit_users.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_edit_users.html.erb deleted file mode 100644 index 6a87aacae4b..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_edit_users.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<div class="modal-head"> - <h2><%= "Edit Permission #{message("projects_role.#{@permission}")} For: " + @permission_template.name -%></h2> -</div> - -<div class="modal-body"> - <div id="select-list-user"></div> -</div> - -<div class="modal-foot"> - <a href="#" onclick="window.location.reload();return false"><%= h message('close') -%></a> -</div> - -<script> - var selectList = new SelectList({ - el: '#select-list-user', - width: '100%', - format: function (item) { return item.name + ' <div class="note">' + item.login + '</div>'; }, - searchUrl: baseUrl + '/permission_templates/search_users?permission=<%= @permission -%>&template=<%= @permission_template.key -%>', - selectUrl: baseUrl + '/permission_templates/add_user_permission', - deselectUrl: baseUrl + '/permission_templates/remove_user_permission', - extra: { - permission: '<%= @permission -%>', - template: '<%= @permission_template.key -%>' - }, - selectParameter: 'user', - selectParameterValue: 'login', - labels: { - selected: 'With', - deselected: 'Without', - all: 'All' - }, - tooltips: { - select: 'Click to grant the permission to the user', - deselect: 'Click to revoke the permission from the user' - } - }); -</script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_permission_template_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_permission_template_form.html.erb deleted file mode 100644 index 0a66c2c336f..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/permission_templates/_permission_template_form.html.erb +++ /dev/null @@ -1,38 +0,0 @@ -<form id="permission-template-form" method="post" action="<%= ApplicationController.root_context -%>/permission_templates/<%= form_action %>"> - <% if form_action == 'edit' %> - <input type="hidden" name="id" value="<%= @permission_template.id -%>"> - <% end %> - <fieldset> - <div class="modal-head"> - <h2><%= message("permission_template.#{message_title}") -%></h2> - </div> - <div class="modal-body"> - <div class="modal-error"/> - <div class="modal-field"> - <label for="name"><%= h message('name') -%> <em class="mandatory">*</em></label> - <input id="name" name="name" type="text" maxlength="256" value="<%= @permission_template ? @permission_template.name : '' -%>" autofocus="autofocus" style="width: 330px;"/> - </div> - <div class="modal-field"> - <label for="description"><%= h message('description') -%></label> - <textarea id="description" name="description" maxlength="4000" rows="10" style="width: 330px;"><%= @permission_template ? @permission_template.description : '' -%></textarea> - </div> - <div class="modal-field"> - <label for="keyPattern"><%= h message('permission_template.key_pattern') -%></label> - <input id="keyPattern" name="pattern" type="text" maxlength="500" value="<%= @permission_template ? @permission_template.keyPattern : '' -%>" style="width: 330px;"/> - </div> - </div> - <div class="modal-foot"> - <input type="submit" value="<%= h message("permission_template.#{message_submit}") -%>" id="submit-permission-template-<%= form_action %>"/> - <a href="#" onclick="return closeModalWindow()" id="cancel-<%= form_action %>-template"><%= h message('cancel') -%></a> - </div> - </fieldset> -</form> - -<script> - $j("#permission-template-form").modalForm({ - success: function (data) { - window.location.reload(); - } - }); -</script> - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb deleted file mode 100644 index d61a95becc9..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb +++ /dev/null @@ -1,49 +0,0 @@ -<form id="apply-template-form" method="post" action="<%= ApplicationController.root_context -%>/roles/apply_template"> - <input type="hidden" name="names" id="apply-template-names" value="<%= @names %>"/> - <input type="hidden" name="keys" id="apply-template-keys" value="<%= @keys %>"/> - <input type="hidden" name="qualifiers" id="apply-template-qualifiers" value="<%= @qualifiers %>"/> - <input type="hidden" name="components" id="apply-template-components" value="<%= @components %>"/> - <fieldset> - <div class="modal-head"> - <% if @components %> - <h2><%= message('projects_role.apply_template_to_xxx', :params => @names) -%></h2> - <% else %> - <h2><%= message('projects_role.apply_template') -%></h2> - <% end %> - </div> - <% if @results_count > 0 %> - <div class="modal-body"> - <div class="modal-error"/> - <div class="modal-field"> - <%= label_tag 'template_key', 'Permission Template' %> - <%= select_tag('template_key', options_for_select(@permission_templates, -1), :style => 'width: 250px;') %> - <% unless @results_count == 1 %> - <span style="float:right" class="note">(<%= "#{@results_count} #{message('qualifier.' + @qualifiers)}s" %>)</span><br/> - <% end %> - </div> - </div> - <div class="modal-foot"> - <span id="apply-template-loading-image" class="loading-image hidden"><%= image_tag 'loading.gif' %></span> - <input type="submit" value="<%= message('apply') -%>" id="apply-template-submit" class="apply-template" onclick="return displayLoadingImage()" /> - <a href="#" onclick="return closeModalWindow()" id="apply-template-cancel"><%= message('cancel') -%></a> - </div> - <% else %> - <div class="modal-body"> - <div class="info"> - <img src="<%= ApplicationController.root_context -%>/images/information.png" style="vertical-align: text-bottom"/> - <%= message 'projects_role.no_projects' -%> - </div> - </div> - <div class="modal-foot"> - <a href="#" onclick="return closeModalWindow()" id="apply-template-cancel"><%= message('cancel') -%></a> - </div> - <% end %> - </fieldset> -</form> -<script> - $j("#apply-template-form").modalForm(); - - function displayLoadingImage() { - $j('#apply-template-loading-image').removeClass("hidden"); - } -</script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/_edit_groups.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/_edit_groups.html.erb deleted file mode 100644 index b2e00e3a8c6..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/_edit_groups.html.erb +++ /dev/null @@ -1,43 +0,0 @@ -<div class="modal-head"> - <h2><%= @project ? "Edit Permission #{message("projects_role.#{h @role}")} For: " + h(@project.name) : "Edit Global Permission: #{message("global_permissions.#{h @role}")}" -%></h2> -</div> - -<div class="modal-body"> - <div id="select-users-permissions"></div> -</div> - -<div class="modal-foot"> - <a href="#" onclick="window.location.reload();return false" id="cancel-update-permission-users"><%= h message('close') -%></a> -</div> - -<script> - var selectList = new SelectList({ - el: '#select-users-permissions', - width: '100%', - format: function (item) { - var label = item.name; - if (item.description) { - label += ' <div class="note">' + item.description + '</div>' - } - return label; - }, - searchUrl: baseUrl + '/permissions/search_groups?permission=<%= u @role -%><%= @project ? "&component=" + u(@project.key) : "" -%>', - selectUrl: baseUrl + '/api/permissions/add', - deselectUrl: baseUrl + '/api/permissions/remove', - extra: { - permission: '<%= escape_javascript @role -%>' - <%= @project ? ", component: '" + escape_javascript(@project.key) + "'" : "" %> - }, - selectParameter: 'group', - selectParameterValue: 'name', - labels: { - selected: 'With', - deselected: 'Without', - all: 'All' - }, - tooltips: { - select: 'Click to grant the permission to the group', - deselect: 'Click to revoke the permission from the group' - } - }); -</script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/_edit_users.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/_edit_users.html.erb deleted file mode 100644 index a342dbd5ea0..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/_edit_users.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<div class="modal-head"> - <h2><%= @project ? "Edit Permission #{message("projects_role.#{h @role }")} For: " + h(@project.name) : "Edit Global Permission: #{message("global_permissions.#{h @role}")}" -%></h2> -</div> - -<div class="modal-body"> - <div id="select-users-permissions"></div> -</div> - -<div class="modal-foot"> - <a href="#" onclick="window.location.reload();return false" id="cancel-update-permission-users"><%= h message('close') -%></a> -</div> - -<script> - var selectList = new SelectList({ - el: '#select-users-permissions', - width: '100%', - format: function (item) { return item.name + ' <div class="note">' + item.login + '</div>'; }, - searchUrl: baseUrl + '/permissions/search_users?permission=<%= u @role -%><%= @project ? "&component=" + u(@project.key) : "" -%>', - selectUrl: baseUrl + '/api/permissions/add', - deselectUrl: baseUrl + '/api/permissions/remove', - extra: { - permission: '<%= escape_javascript @role -%>' - <%= @project ? ", component: '" + escape_javascript(@project.key) + "'" : "" %> - }, - selectParameter: 'user', - selectParameterValue: 'login', - labels: { - selected: 'With', - deselected: 'Without', - all: 'All' - }, - tooltips: { - select: 'Click to grant the permission to the user', - deselect: 'Click to revoke the permission from the user' - } - }); -</script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/_tabs.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/_tabs.html.erb deleted file mode 100644 index 71b40fc05bb..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/roles/_tabs.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<% - selected_tab = nil unless defined?(:selected_tab) -%> -<ul class="tabs"> - <li> - <a href="<%= url_for :controller => 'roles', :action => 'projects' %>" <%= "class='selected'" if selected_tab=='Projects' -%> - id="tab-projects"><%= message('projects') -%></a> - </li> - <li> - <a href="<%= url_for :controller => 'permission_templates', :action => 'index' -%>" <%= "class='selected'" if selected_tab=='Permission templates' -%> - id="tab-perm-templates"><%= message('permission_templates') -%></a> - </li> -</ul> |