OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Chore/reimplement global roles (#8730)
ulferts7f34799a33e5
diff --git a/Gemfile.lock b/Gemfile.lockindex 213bd3e6a5a..78ca9269a03 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -109,11 +109,6 @@ PATHopenproject-github_integration (1.0.0)openproject-webhooks-PATH- remote: modules/global_roles- specs:- openproject-global_roles (1.0.0)-PATHremote: modules/gridsspecs:@@ -1013,7 +1008,6 @@ DEPENDENCIESopenproject-boards!openproject-documents!openproject-github_integration!- openproject-global_roles!openproject-job_status!openproject-ldap_groups!openproject-meeting!diff --git a/Gemfile.modules b/Gemfile.modulesindex 5550badf1d2..5be2195915c 100644--- a/Gemfile.modules+++ b/Gemfile.modules@@ -20,7 +20,6 @@ group :opf_plugins do# included so that engines can reference OpenProject::Version$:.push File.expand_path("../lib", __FILE__)- gem 'openproject-global_roles', path: 'modules/global_roles'gem 'openproject-auth_plugins', path: 'modules/auth_plugins'gem 'openproject-auth_saml', path: 'modules/auth_saml'gem 'openproject-openid_connect', path: 'modules/openid_connect'diff --git a/app/contracts/members/base_contract.rb b/app/contracts/members/base_contract.rbindex 2fe5bbfa3dc..0cbe33e4bdd 100644--- a/app/contracts/members/base_contract.rb+++ b/app/contracts/members/base_contract.rb@@ -37,19 +37,46 @@ module Membersvalidate :user_allowed_to_managevalidate :roles_grantable+ validate :project_set+ validate :project_manageable++ privatedef user_allowed_to_manage- if model.project && !user.allowed_to?(:manage_members, model.project)- errors.add :base, :error_unauthorized- end+ errors.add :base, :error_unauthorized unless user_allowed_to_manage?enddef roles_grantableunmarked_roles = model.member_roles.reject(&:marked_for_destruction?).map(&:role)- unless unmarked_roles.all? { |r| r.builtin == Role::NON_BUILTIN && r.class == Role }- errors.add(:roles, :ungrantable)- end+ errors.add(:roles, :ungrantable) unless unmarked_roles.all? { |r| role_grantable?(r) }+ end++ def project_set+ errors.add(:project, :blank) unless project_set_or_admin?+ end++ def project_manageable+ errors.add(:project, :invalid) unless project_manageable_or_blank?+ end++ def role_grantable?(role)+ role.builtin == Role::NON_BUILTIN &&+ ((model.project && role.class == Role) || (!model.project && role.class == GlobalRole))+ end++ def user_allowed_to_manage?+ user.allowed_to?(:manage_members,+ model.project,+ global: model.project.nil?)+ end++ def project_manageable_or_blank?+ !model.project || user.allowed_to?(:manage_members, model.project)+ end++ def project_set_or_admin?+ model.project || user.admin?endendenddiff --git a/app/controllers/users/memberships_controller.rb b/app/controllers/users/memberships_controller.rbindex 8c8a03379eb..24fab02731d 100644--- a/app/controllers/users/memberships_controller.rb+++ b/app/controllers/users/memberships_controller.rb@@ -43,28 +43,37 @@ class Users::MembershipsController < ApplicationControllerdef destroy@membership = @user.memberships.find(params[:id])+ tab = redirected_to_tab(@membership)if @membership.deletable? && request.delete?- @membership.destroy && @membership = nil+ @membership.destroy+ @membership = nil+flash[:notice] = I18n.t(:notice_successful_delete)end- redirect_to controller: '/users', action: 'edit', id: @user, tab: 'memberships'+ redirect_to controller: '/users', action: 'edit', id: @user, tab: tabendprivatedef update_or_create(save_record, message)- @membership = params[:id].present? ? Member.find(params[:id]) : Member.new(principal: @user)- service = ::Members::EditMembershipService.new(@membership, save: save_record, current_user: current_user)- result = service.call(attributes: permitted_params.membership)+ @membership = params[:id].present? ? Member.find(params[:id]) : Member.new(principal: @user, project: nil)++ result = ::Members::EditMembershipService+ .new(@membership, save: save_record, current_user: current_user)+ .call(attributes: permitted_params.membership)if result.success?flash[:notice] = I18n.t(message)elseflash[:error] = result.errors.full_messages.join("\n")end- redirect_to controller: '/users', action: 'edit', id: @user, tab: 'memberships'++ redirect_to controller: '/users',+ action: 'edit',+ id: @user,+ tab: redirected_to_tab(@membership)enddef find_user@@ -72,4 +81,12 @@ class Users::MembershipsController < ApplicationControllerrescue ActiveRecord::RecordNotFoundrender_404end++ def redirected_to_tab(membership)+ if membership.project+ 'memberships'+ else+ 'global_roles'+ end+ endenddiff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rbindex 3f88f430f77..a4d22e91cbf 100644--- a/app/helpers/application_helper.rb+++ b/app/helpers/application_helper.rb@@ -457,28 +457,6 @@ module ApplicationHelper"<meta name='ROBOTS' content='#{h(content)}' />".html_safeend- # Returns true if arg is expected in the API response- def include_in_api_response?(arg)- unless @included_in_api_response- param = params[:include]- @included_in_api_response = param.is_a?(Array) ? param.map(&:to_s) : param.to_s.split(',')- @included_in_api_response.map!(&:strip)- end- @included_in_api_response.include?(arg.to_s)- end-- # Returns options or nil if nometa param or X-OpenProject-Nometa header- # was set in the request- def api_meta(options)- if params[:nometa].present? || request.headers['X-OpenProject-Nometa']- # compatibility mode for activeresource clients that raise- # an error when deserializing an array with attributes- nil- else- options- end- end-## Returns the footer text displayed in the layout file.#diff --git a/modules/global_roles/lib/open_project/global_roles/patches/roles_helper_patch.rb b/app/helpers/members_helper.rbsimilarity index 58%rename from modules/global_roles/lib/open_project/global_roles/patches/roles_helper_patch.rbrename to app/helpers/members_helper.rbindex 01ca4c9ad5d..1be5a1b173b 100644--- a/modules/global_roles/lib/open_project/global_roles/patches/roles_helper_patch.rb+++ b/app/helpers/members_helper.rb@@ -1,3 +1,4 @@+#-- encoding: UTF-8#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -26,18 +27,21 @@# See docs/COPYRIGHT.rdoc for more details.#++-require_dependency 'roles_helper'--module OpenProject::GlobalRoles::Patches- module RolesHelperPatch- def self.included(base)- base.class_eval do- def permissions_id(permissions)- 'permissions_' + permissions[0].hash.to_s- end- end+module MembersHelper+ # Adds a link that either:+ # * sends a delete request to memberships in case only one role is assigned to the member+ # * sends a patch request to memberships in case there is more than one role assigned to the member+ #+ # If it is the later, the ids of the non delete roles are appended to the url so that they are kept.+ def global_member_role_deletion_link(member, role)+ if member.roles.length == 1+ link_to('',+ user_membership_path(user_id: member.user_id, id: member.id),+ { method: :delete, class: 'icon icon-delete', title: t(:button_delete) })+ else+ link_to('',+ user_membership_path(user_id: member.user_id, id: member.id, 'membership[role_ids]' => member.roles - [role]),+ { method: :patch, class: 'icon icon-delete', title: t(:button_delete) })endend-end--RolesHelper.send(:include, OpenProject::GlobalRoles::Patches::RolesHelperPatch)+end\ No newline at end of filediff --git a/modules/global_roles/app/models/global_role.rb b/app/models/global_role.rbsimilarity index 75%rename from modules/global_roles/app/models/global_role.rbrename to app/models/global_role.rbindex ddca7f155d8..e433ca3e2a5 100644--- a/modules/global_roles/app/models/global_role.rb+++ b/app/models/global_role.rb@@ -26,26 +26,4 @@# See docs/COPYRIGHT.rdoc for more details.#++-class GlobalRole < Role- has_many :principal_roles, foreign_key: :role_id, dependent: :destroy- has_many :principals, through: :principal_roles, dependent: :destroy-- def initialize(*args)- super- self.assignable = false- end-- def to_s- name- end-- def assignable=(value)- fail ArgumentError if value == true-- super- end-- def assignable_to?(_user)- true- end-end+class GlobalRole < Role; enddiff --git a/app/models/member.rb b/app/models/member.rbindex 823a221a3a3..0e41f28ecda 100644--- a/app/models/member.rb+++ b/app/models/member.rb@@ -1,4 +1,5 @@#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -28,13 +29,15 @@#++class Member < ApplicationRecord+ include ::Scopes::Scoped+extend DeprecatedAliasbelongs_to :principal, foreign_key: 'user_id'has_many :member_roles, dependent: :destroy, autosave: true, validate: falsehas_many :roles, through: :member_rolesbelongs_to :project- validates_presence_of :project, :principal+ validates_presence_of :principalvalidates_uniqueness_of :user_id, scope: :project_idvalidate :validate_presence_of_role@@ -47,18 +50,9 @@ class Member < ApplicationRecordafter_save :save_notificationafter_destroy :destroy_notification- scope :of, ->(project) {- where(project_id: project)- }-- def self.visible(user)- view_members = Project.where(id: Project.allowed_to(user, :view_members))- manage_members = Project.where(id: Project.allowed_to(user, :manage_members))-- project_scope = view_members.or(manage_members)-- where(project_id: project_scope.select(:id))- end+ scope_classes Members::Scopes::Global,+ Members::Scopes::Visible,+ Members::Scopes::Ofdef nameprincipal.namediff --git a/app/models/member_role.rb b/app/models/member_role.rbindex e1778de77eb..025afed1bc7 100644--- a/app/models/member_role.rb+++ b/app/models/member_role.rb@@ -28,7 +28,7 @@#++class MemberRole < ApplicationRecord- belongs_to :member+ belongs_to :member, touch: truebelongs_to :roleafter_create :add_role_to_group_usersdiff --git a/modules/global_roles/spec/spec_helper.rb b/app/models/members/scopes/global.rbsimilarity index 86%rename from modules/global_roles/spec/spec_helper.rbrename to app/models/members/scopes/global.rbindex 21c7a2b0afa..4f40ece24d1 100644--- a/modules/global_roles/spec/spec_helper.rb+++ b/app/models/members/scopes/global.rb@@ -1,3 +1,5 @@+#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -26,7 +28,11 @@# See docs/COPYRIGHT.rdoc for more details.#++-require 'spec_helper'--require File.join(File.dirname(__FILE__), 'plugin_spec_helper')-include OpenProject::GlobalRoles::PluginSpecHelper+# Find all members that are global, i.e. have not project+module Members::Scopes+ class Global+ def self.fetch+ Member.where(project: nil)+ end+ end+enddiff --git a/modules/global_roles/lib/open_project/global_roles/patches.rb b/app/models/members/scopes/of.rbsimilarity index 87%rename from modules/global_roles/lib/open_project/global_roles/patches.rbrename to app/models/members/scopes/of.rbindex 7c31c212e30..c31a0a9613a 100644--- a/modules/global_roles/lib/open_project/global_roles/patches.rb+++ b/app/models/members/scopes/of.rb@@ -1,3 +1,5 @@+#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -26,5 +28,11 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::GlobalRoles::Patches+# Find all members of a project+module Members::Scopes+ class Of+ def self.fetch(project)+ Member.where(project_id: project)+ end+ endenddiff --git a/modules/global_roles/lib/open_project/global_roles/patches/permission_patch.rb b/app/models/members/scopes/visible.rbsimilarity index 66%rename from modules/global_roles/lib/open_project/global_roles/patches/permission_patch.rbrename to app/models/members/scopes/visible.rbindex c74f19dfa0e..c6c084defea 100644--- a/modules/global_roles/lib/open_project/global_roles/patches/permission_patch.rb+++ b/app/models/members/scopes/visible.rb@@ -1,3 +1,5 @@+#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -26,36 +28,32 @@# See docs/COPYRIGHT.rdoc for more details.#++-require_dependency 'open_project/access_control'--module OpenProject::GlobalRoles::Patches- module PermissionPatch- def self.included(base)- base.prepend(InstanceMethods)- end+# Find all members visible to the inquiring user+module Members::Scopes+ class Visible+ class << self+ def fetch(user)+ if user.admin?+ visible_for_admins+ else+ visible_for_non_admins(user)+ end+ end- module InstanceMethods- def initialize(name, hash, options)- @global = options[:global] || false+ private- super(name, hash, options)- end+ def visible_for_non_admins(user)+ view_members = Project.where(id: Project.allowed_to(user, :view_members))+ manage_members = Project.where(id: Project.allowed_to(user, :manage_members))- def global?- @global || global_require- end+ project_scope = view_members.or(manage_members)- def global=(bool)- @global = bool+ Member.where(project_id: project_scope.select(:id))end- private-- def global_require- @require && @require == :global+ def visible_for_admins+ Member.allendendendend--OpenProject::AccessControl::Permission.send(:include, OpenProject::GlobalRoles::Patches::PermissionPatch)diff --git a/app/models/principal.rb b/app/models/principal.rbindex 439090892c4..8b90125025a 100644--- a/app/models/principal.rb+++ b/app/models/principal.rb@@ -47,7 +47,7 @@ class Principal < ApplicationRecordhas_many :members, foreign_key: 'user_id', dependent: :destroyhas_many :memberships, -> {includes(:project, :roles)- .where(projects: { active: true })+ .where(["projects.active = ? OR project_id IS NULL", true]).order(Arel.sql('projects.name ASC'))# haven't been able to produce the order using hashes},diff --git a/app/models/queries/members.rb b/app/models/queries/members.rbindex 4a768326bac..6c591046e82 100644--- a/app/models/queries/members.rb+++ b/app/models/queries/members.rb@@ -40,6 +40,8 @@ module Queries::MembersQueries::Register.filter query, filter_ns::GroupFilterQueries::Register.filter query, filter_ns::RoleFilterQueries::Register.filter query, filter_ns::PrincipalFilter+ Queries::Register.filter query, filter_ns::CreatedAtFilter+ Queries::Register.filter query, filter_ns::UpdatedAtFilterorder_ns = Queries::Members::Ordersdiff --git a/modules/global_roles/lib/open_project/global_roles.rb b/app/models/queries/members/filters/created_at_filter.rbsimilarity index 89%rename from modules/global_roles/lib/open_project/global_roles.rbrename to app/models/queries/members/filters/created_at_filter.rbindex b73896e5ba7..e1750b96318 100644--- a/modules/global_roles/lib/open_project/global_roles.rb+++ b/app/models/queries/members/filters/created_at_filter.rb@@ -1,3 +1,5 @@+#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -26,8 +28,8 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject- module GlobalRoles- require 'open_project/global_roles/engine'+class Queries::Members::Filters::CreatedAtFilter < Queries::Members::Filters::MemberFilter+ def type+ :datetime_pastendenddiff --git a/modules/global_roles/config/routes.rb b/app/models/queries/members/filters/updated_at_filter.rbsimilarity index 89%rename from modules/global_roles/config/routes.rbrename to app/models/queries/members/filters/updated_at_filter.rbindex 2681e15c077..0f5af169a66 100644--- a/modules/global_roles/config/routes.rb+++ b/app/models/queries/members/filters/updated_at_filter.rb@@ -1,3 +1,5 @@+#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -26,6 +28,8 @@# See docs/COPYRIGHT.rdoc for more details.#++-OpenProject::Application.routes.draw do- resources :principal_roles+class Queries::Members::Filters::UpdatedAtFilter < Queries::Members::Filters::MemberFilter+ def type+ :datetime_past+ endenddiff --git a/app/models/queries/members/orders/default_order.rb b/app/models/queries/members/orders/default_order.rbindex 39a8394bd02..2d6633f4804 100644--- a/app/models/queries/members/orders/default_order.rb+++ b/app/models/queries/members/orders/default_order.rb@@ -32,6 +32,6 @@ class Queries::Members::Orders::DefaultOrder < Queries::BaseOrderself.model = Memberdef self.key- /\A(id|created_on)\z/+ /\A(id|created_at|updated_at)\z/endenddiff --git a/app/seeders/basic_data/role_seeder.rb b/app/seeders/basic_data/role_seeder.rbindex 547a39eb376..a51a628da78 100644--- a/app/seeders/basic_data/role_seeder.rb+++ b/app/seeders/basic_data/role_seeder.rb@@ -34,6 +34,10 @@ module BasicDataRole.create!(attributes)end+ global_roles.each do |attributes|+ GlobalRole.create!(attributes)+ end+builtin_roles.each do |attributes|Role.find_by!(name: attributes[:name]).update(attributes)end@@ -52,6 +56,10 @@ module BasicData[project_admin, member, reader]end+ def global_roles+ [project_creator]+ end+def builtin_roles[non_member, anonymous]end@@ -175,5 +183,13 @@ module BasicData]}end++ def project_creator+ {+ name: I18n.t(:default_role_project_creator),+ position: 6,+ permissions: [:add_project]+ }+ endendenddiff --git a/app/services/groups/add_users_service.rb b/app/services/groups/add_users_service.rbindex 81042aaec44..8f421dea442 100644--- a/app/services/groups/add_users_service.rb+++ b/app/services/groups/add_users_service.rb@@ -103,7 +103,7 @@ module Groups-- We need to return all members for the given group memberships-- even if they already exist as members (e.g., added individually) to ensure we add all roles-- to mark that we reset the created_at date since replacing the member- ON CONFLICT(project_id, user_id) DO UPDATE SET created_on = CURRENT_TIMESTAMP+ ON CONFLICT(project_id, user_id) DO UPDATE SET updated_at = CURRENT_TIMESTAMPRETURNING id, user_id, project_id)-- copy the member roles of the groupdiff --git a/app/views/roles/_form.html.erb b/app/views/roles/_form.html.erbindex 14243399159..14ecfa6e1b2 100644--- a/app/views/roles/_form.html.erb+++ b/app/views/roles/_form.html.erb@@ -27,7 +27,7 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<%= render :partial => 'shared/global_roles_header' %>+<%= render :partial => 'users/global_roles_header' %><% roles ||= nil %>@@ -50,12 +50,6 @@ See docs/COPYRIGHT.rdoc for more details.<% end %></div>-<% if role.new_record? || role.is_a?(GlobalRole) %>- <div id="global_attributes" style="display:none">- <%= render partial: "global_attributes", locals: { f: f, role: role, roles: roles&.select {|r| r.is_a?(GlobalRole)} }%>- </div>-<% end %>-<% if role.new_record? || !role.is_a?(GlobalRole) %><div id="member_attributes"><%= render partial: "member_attributes", locals: { f: f, role: role, roles: roles&.select {|r| !r.is_a?(GlobalRole)} }%>diff --git a/modules/global_roles/app/views/principal_roles/_errors.html.erb b/app/views/users/_assigned_global_role.html.erbsimilarity index 86%rename from modules/global_roles/app/views/principal_roles/_errors.html.erbrename to app/views/users/_assigned_global_role.html.erbindex 2dd732ced59..91162cce166 100644--- a/modules/global_roles/app/views/principal_roles/_errors.html.erb+++ b/app/views/users/_assigned_global_role.html.erb@@ -27,4 +27,11 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<%= error_messages_for 'principal_role' %>+<tr id="assigned_global_role_<%= role.id%>">+ <td class="role">+ <%=h role %>+ </td>+ <td class="buttons">+ <%= global_member_role_deletion_link(member, role) %>+ </td>+</tr>diff --git a/modules/global_roles/app/views/users/_available_global_role.html.erb b/app/views/users/_available_global_role.html.erbsimilarity index 88%rename from modules/global_roles/app/views/users/_available_global_role.html.erbrename to app/views/users/_available_global_role.html.erbindex 179d333775d..30ad53ef73d 100644--- a/modules/global_roles/app/views/users/_available_global_role.html.erb+++ b/app/views/users/_available_global_role.html.erb@@ -29,11 +29,10 @@ See docs/COPYRIGHT.rdoc for more details.<div class="principal_role_option form--field" id= "principal_role_option_<%= h(role.id) %>"><label class="form--label-with-check-box" for="principal_role_role_ids_<%= role.id %>">- <%= check_box_tag 'principal_role[role_ids][]',+ <%= check_box_tag 'membership[role_ids][]',role.id,false,- id: "principal_role_role_ids_#{role.id}",- disabled: !role.assignable_to?(@user) %>+ id: "principal_role_role_ids_#{role.id}" %><%= h(role)%></label></div>diff --git a/modules/global_roles/app/views/users/_available_global_roles.html.erb b/app/views/users/_available_global_roles.html.erbsimilarity index 77%rename from modules/global_roles/app/views/users/_available_global_roles.html.erbrename to app/views/users/_available_global_roles.html.erbindex 7df80429b74..957f4b07b92 100644--- a/modules/global_roles/app/views/users/_available_global_roles.html.erb+++ b/app/views/users/_available_global_roles.html.erb@@ -27,22 +27,27 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<% def available_additional_global_roles available_roles, user- (available_roles || []) - user.global_roles.reload-end%>+<% available_roles = GlobalRole.all - (global_member&.roles || []) %><div class="grid-content" id="available_principal_roles"><fieldset class="form--fieldset"><legend class="form--fieldset-legend"><%= Role.model_name.human(:count => 2) %></legend>- <% if available_additional_global_roles(global_roles, user).count == 0 %>+ <% if available_roles.empty? %><span id="no_additional_principal_roles"><%= no_results_box %></span><% else %><span id="additional_principal_roles">- <%= form_for(:principal_roles, :url => principal_roles_path, :method => :post) do %>- <%= hidden_field_tag 'principal_role[principal_id]', user.id %>- <% available_additional_global_roles(global_roles, user).each do |role| %>+ <%= form_for(:principal_roles, :url => user_memberships_path(user_id: user), :method => :post) do %>+ <% if global_member %>+ <%= hidden_field_tag(:id, global_member.id ) %>++ <% global_member.roles.each do |role| %>+ <%= hidden_field_tag('membership[role_ids][]', role.id ) %>+ <% end %>+ <% end %>++ <% available_roles.each do |role| %><%= render :partial => 'users/available_global_role', :locals => {:role => role} %><% end %><p><br/><%= styled_button_tag t(:button_add), class: '-with-icon icon-checkmark' %></p>diff --git a/modules/global_roles/app/views/users/_global_roles.html.erb b/app/views/users/_global_roles.html.erbsimilarity index 70%rename from modules/global_roles/app/views/users/_global_roles.html.erbrename to app/views/users/_global_roles.html.erbindex 8074ec31111..9d3030ba181 100644--- a/modules/global_roles/app/views/users/_global_roles.html.erb+++ b/app/views/users/_global_roles.html.erb@@ -27,11 +27,13 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<%= render partial: 'shared/global_roles_header' %>+<%= render partial: 'global_roles_header' %>++<% global_member = Member.global.where(principal: @user).includes(:roles).first %><div class="grid-block" id="principal_global_roles_content"><div id="assigned_principal_roles" class="grid-content">- <% if @user.principal_roles.empty? %>+ <% unless global_member&.roles&.any? %><%= no_results_box %><% else %><div class="generic-table--container">@@ -43,22 +45,21 @@ See docs/COPYRIGHT.rdoc for more details.</colgroup><thead><tr>- <th>- <div class="generic-table--sort-header-outer">- <div class="generic-table--sort-header">- <span>- <%= Role.model_name.human %>- </span>- </div>+ <th>+ <div class="generic-table--sort-header-outer">+ <div class="generic-table--sort-header">+ <span>+ <%= Role.model_name.human %>+ </span></div>- </th>- <%= call_hook(:view_users_global_roles_table_header, :user => @user )%>- <th><div class="generic-table--empty-header"></div></th>- </tr>+ </div>+ </th>+ <th><div class="generic-table--empty-header"></div></th>+ </tr></thead><tbody id="table_principal_roles_body">- <% @user.principal_roles.each do |principal_role| %>- <%= render :partial => 'principal_roles/show_table_row', :locals => {:principal_role => principal_role} %>+ <% global_member.roles.each do |role| %>+ <%= render :partial => 'assigned_global_role', :locals => { :role => role, member: global_member } %><%end%></tbody></table>@@ -68,5 +69,5 @@ See docs/COPYRIGHT.rdoc for more details.<% end %></div>- <%= render partial: 'users/available_global_roles', locals: { user: @user, global_roles: @global_roles}%>+ <%= render partial: 'users/available_global_roles', locals: { user: @user, global_member: global_member }%></div>diff --git a/modules/global_roles/app/views/shared/_global_roles_header.html.erb b/app/views/users/_global_roles_header.html.erbsimilarity index 100%rename from modules/global_roles/app/views/shared/_global_roles_header.html.erbrename to app/views/users/_global_roles_header.html.erbdiff --git a/app/views/users/_memberships.html.erb b/app/views/users/_memberships.html.erbindex 1aeae0ace6c..3165ed0ffd5 100644--- a/app/views/users/_memberships.html.erb+++ b/app/views/users/_memberships.html.erb@@ -66,7 +66,7 @@ See docs/COPYRIGHT.rdoc for more details.</tr></thead><tbody>- <% @user.memberships.each do |membership| %>+ <% @user.memberships.where.not(project: nil).each do |membership| %><% next if membership.new_record? %><tr id="member-<%= membership.id %>" class="member"><td class="project">diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erbindex a16df0549af..4878c8de6b2 100644--- a/app/views/users/show.html.erb+++ b/app/views/users/show.html.erb@@ -64,7 +64,7 @@ See docs/COPYRIGHT.rdoc for more details.<% for membership in @memberships %><li><%= link_to_project(membership.project) %>- (<%=h membership.roles.sort.collect(&:to_s).join(', ') %>, <%= format_date(membership.created_on) %>)+ (<%=h membership.roles.sort.collect(&:to_s).join(', ') %>, <%= format_date(membership.created_at) %>)</li><% end %></ul>diff --git a/config/constants/ar_to_api_conversions.rb b/config/constants/ar_to_api_conversions.rbindex 658f3f46905..78d1eb4ce31 100644--- a/config/constants/ar_to_api_conversions.rb+++ b/config/constants/ar_to_api_conversions.rb@@ -28,6 +28,10 @@module Constantsclass ARToAPIConversions++ # Conversions that are bidirectional:+ # * from the API to AR+ # * from AR to the APIWELL_KNOWN_CONVERSIONS = {assigned_to: 'assignee',version: 'version',@@ -46,6 +50,13 @@ module Constantsmessage: 'post'}.freeze+ # Conversions that are unidirectional (from the API to AR)+ # This can be used to still support renamed filters/sort_by, like for created/updatedOn.+ WELL_KNOWN_API_TO_AR_CONVERSIONS = {+ created_on: 'created_at',+ updated_on: 'updated_at',+ }.freeze+class << selfdef add(map)conversions.push(map)@@ -55,6 +66,13 @@ module Constantsconversions.inject(:merge)end+ def api_to_ar_conversions+ @api_to_ar_conversions ||= Constants::ARToAPIConversions.all.inject({}) do |result, (k, v)|+ result[v.underscore] = k.to_s+ result+ end.merge(WELL_KNOWN_API_TO_AR_CONVERSIONS.stringify_keys)+ end+privatedef conversionsdiff --git a/config/initializers/permissions.rb b/config/initializers/permissions.rbindex 5d9cf85cd52..c6f8611bcce 100644--- a/config/initializers/permissions.rb+++ b/config/initializers/permissions.rb@@ -54,7 +54,8 @@ OpenProject::AccessControl.map do |map|map.permission :add_project,{ projects: %i[new create] },- require: :loggedin+ require: :loggedin,+ global: truemap.permission :edit_project,edit_project_hash,diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 143415cd8c5..14cc6864f3d 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1054,6 +1054,7 @@ en:default_role_anonymous: "Anonymous"default_role_developer: "Developer"default_role_project_admin: "Project admin"+ default_role_project_creator: "Project creator"default_role_non_member: "Non member"default_role_reader: "Reader"default_role_member: "Member"@@ -1453,7 +1454,6 @@ en:label_group_new: "New group"label_group: "Group"label_group_named: "Group %{name}"- label_group_plural: "Groups"label_help: "Help"label_here: herelabel_hide: "Hide"@@ -1797,6 +1797,11 @@ en:other: "%{count} projects"zero: "no projects"label_yesterday: "yesterday"+ label_role_type: "Type"+ label_member_role: "Project Role"+ label_global_role: "Global Role"+ label_not_changeable: "(not changeable)"+ label_global: "Global"auth_source:using_abstract_auth_source: "Can't use an abstract authentication source."diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex 4b96bee0d49..d7b1514e26d 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -279,7 +279,6 @@ en:general_text_yes: "yes"general_text_No: "No"general_text_Yes: "Yes"- global_roles: Global Roleshal:error:@@ -376,6 +375,7 @@ en:label_filename: "File"label_filesize: "Size"label_general: "General"+ label_global_roles: "Global Roles"label_greater_or_equal: ">="label_group: 'Group'label_group_by: "Group by"diff --git a/modules/global_roles/db/migrate/20100528100562_aggregated_global_roles_migrations.rb b/db/migrate/20100528100562_aggregated_global_roles_migrations.rbsimilarity index 100%rename from modules/global_roles/db/migrate/20100528100562_aggregated_global_roles_migrations.rbrename to db/migrate/20100528100562_aggregated_global_roles_migrations.rbdiff --git a/db/migrate/20200925084550_members_allow_null_on_project.rb b/db/migrate/20200925084550_members_allow_null_on_project.rbnew file mode 100644index 00000000000..62bfa571cba--- /dev/null+++ b/db/migrate/20200925084550_members_allow_null_on_project.rb@@ -0,0 +1,126 @@+class MembersAllowNullOnProject < ActiveRecord::Migration[6.0]+ def change+ change_column_null :members, :project_id, true+ change_column_default :members, :project_id, from: 0, to: nil+ add_column :members, :updated_at, :timestamp, default: -> { 'CURRENT_TIMESTAMP' }++ reversible do |rev|+ rev.up do+ add_updated_at_values+ migrate_principal_roles_data+ end++ rev.down do+ migrate_global_members_data+ end+ end++ change_column_null :members, :updated_at, false+ rename_column :members, :created_on, :created_at++ drop_table :principal_roles do |t|+ t.column :role_id, :integer, null: false, index: true+ t.column :principal_id, :integer, null: false, index: true+ t.timestamps+ end+ end++ private++ def add_updated_at_values+ execute <<~SQL+ UPDATE+ members+ SET+ updated_at = created_on+ SQL+ end++ def migrate_principal_roles_data+ fetch_principal_roles.each do |principal_id, records|+ member_id = insert_into_members(principal_id, records.first['created_at'], records.first['updated_at'])+ insert_into_member_roles(member_id, records.map { |r| r['role_id'] })+ end+ end++ def fetch_principal_roles+ select_all("SELECT * from principal_roles")+ .to_a+ .group_by { |r| r["principal_id"] }+ end++ def insert_into_members(principal_id, created_at, updated_at)+ member_id = select_all <<~SQL+ INSERT INTO+ members(user_id, created_on, updated_at)+ VALUES (#{principal_id}, '#{created_at}', '#{updated_at}')+ RETURNING id+ SQL++ member_id.to_a.first['id']+ end++ def insert_into_member_roles(member_id, role_ids)+ values = role_ids.map { |role_id| "(#{member_id}, #{role_id})" }++ execute <<~SQL+ INSERT INTO+ member_roles(member_id, role_id)+ VALUES #{values.join(', ') }+ SQL+ end++ def migrate_global_members_data+ insert_into_principal_roles+ delete_global_members+ end++ def insert_into_principal_roles+ execute <<~SQL+ INSERT INTO+ principal_roles (principal_id, role_id, created_at, updated_at)+ SELECT+ user_id,+ role_id,+ created_on,+ created_on+ FROM+ members+ JOIN+ member_roles+ ON+ members.id = member_roles.member_id+ WHERE+ members.project_id IS NULL+ SQL+ end++ def delete_global_members+ execute <<~SQL+ DELETE+ FROM+ members+ WHERE+ project_id IS NULL+ SQL++ execute <<~SQL+ DELETE+ FROM+ member_roles+ WHERE+ id IN (+ SELECT+ member_roles.id+ FROM+ member_roles+ LEFT JOIN+ members+ ON+ member_roles.member_id = members.id+ WHERE+ members.id IS NULL+ )+ SQL+ end+end\ No newline at end of filediff --git a/docs/api/apiv3/endpoints/members.apib b/docs/api/apiv3/endpoints/members.apibindex 20da0709e8e..332f8684a1d 100644--- a/docs/api/apiv3/endpoints/members.apib+++ b/docs/api/apiv3/endpoints/members.apib@@ -2,11 +2,13 @@Users and groups can become members of a project. Such a membership will also have one or more roles assigned to it. By that, memberships control the permissions a user has within a project.+There are also memberships that do not govern the permissions within a certain project but rather govern global permissions. Currently, this is only relevant for the "Create project" permission. Those memberships do not have a project associated.+## Linked Properties| Link | Description | Type | Constraints | Supported operations ||:-------------------:|----------------------------------------- | ------------- | -------------------------------------------------------------- | -------------------- || self | This membership | Membership | not null | READ |-| project | The project for which the membership is granted | Project | not null | READ |+| project | The project for which the membership is granted | Project | | READ || roles | The list of roles the user or group is granted in the project | RoleCollection | not null | READ || principal | The user or group that was granted membership | User or Group | not null | READ |@@ -15,8 +17,9 @@ Users and groups can become members of a project. Such a membership will also ha| :---------: | --------------------------------------------- | ----------- | ----------- | -------------------- || id | Membership id | Integer | x > 0 | READ || createdAt | Time of creation | DateTime | not null | READ |+| updatedAt | Time of latest update | DateTime | not null | READ |-## Membership [/api/v3/memberships/{id}]+## View membership [/api/v3/memberships/{id}]+ Model+ Body@@ -60,6 +63,7 @@ Users and groups can become members of a project. Such a membership will also ha"_type": "Membership","id": 11,"createdAt": "2015-03-20T12:56:56Z",+ "updatedAt": "2018-12-20T18:16:11Z","_embedded": {"project": "<-- omitted for brevity -->","principal": "<-- omitted for brevity -->",@@ -76,7 +80,7 @@ Users and groups can become members of a project. Such a membership will also ha+ Response 200 (application/hal+json)- [Membership][]+ [View membership][]+ Response 404 (application/hal+json)@@ -96,7 +100,87 @@ Users and groups can become members of a project. Such a membership will also ha"message": "The requested resource could not be found."}-## Update Membership [PATCH]+## Create membership [/api/v3/memberships]++## Create membership [POST]++Creates a new membership applying the attributes provided in the body.++You can use the form and schema to be retrieve the valid attribute values and by that be guided towards successful creation.+++ Request Create memberships++ + Body++ {+ "project": {+ "href": "/api/v3/projects/1"+ },+ "principal": {+ "href": "/api/v3/users/5"+ },+ "roles": [+ {+ "href": "/api/v3/roles/5"+ },+ {+ "href": "/api/v3/roles/8"+ }+ ]+ }+++ Response 201++ [View membership][]+++ Response 400 (application/hal+json)++ Occurs when the client did not send a valid JSON object in the request body.++ + Body++ {+ "_type": "Error",+ "errorIdentifier": "urn:openproject-org:api:v3:errors:InvalidRequestBody",+ "message": "The request body was not a single JSON object."+ }+++ Response 403 (application/hal+json)++ Returned if the client does not have sufficient permissions.++ **Required permission:** Manage members++ + Body++ {+ "_type": "Error",+ "errorIdentifier": "urn:openproject-org:api:v3:errors:MissingPermission",+ "message": "You are not authorized to access this resource."+ }+++ Response 422 (application/hal+json)++ Returned if:++ * a constraint for a property was violated (`PropertyConstraintViolation`)++ + Body++ {+ "_type": "Error",+ "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",+ "message": "Project can't be blank.",+ "_embedded": {+ "details": {+ "attribute": "project"+ }+ }+ }++## Update membership [/api/v3/memberships/{id}]++## Update membership [PATCH]Updates the given membership by applying the attributes provided in the body.@@ -122,7 +206,7 @@ Updates the given membership by applying the attributes provided in the body.+ Response 200- [Membership][]+ [View membership][]+ Response 400 (application/hal+json)@@ -187,7 +271,9 @@ Updates the given membership by applying the attributes provided in the body.}}-## Delete Membership [DELETE]+## Delete membership [/api/v3/memberships/{id}]++## Delete membership [DELETE]Deletes the membership.@@ -232,7 +318,7 @@ Deletes the membership."message": "The requested resource could not be found."}-## Memberships [/api/v3/memberships{?filters}]+## List memberships [/api/v3/memberships{?filters}]+ Model+ Body@@ -272,7 +358,8 @@ Deletes the membership.},"_type": "Membership","id": 11,- "createdAt": "2015-03-20T12:56:56Z"+ "createdAt": "2015-03-20T12:56:56Z",+ "updatedAt": "2018-12-20T18:16:11Z"},{"_links": {@@ -299,7 +386,8 @@ Deletes the membership.},"_type": "Membership","id": 41,- "createdAt": "2019-12-22T12:56:06Z"+ "createdAt": "2019-12-22T12:56:06Z",+ "updatedAt": "2020-12-20T18:16:12Z"}]}@@ -321,88 +409,15 @@ Returns a collection of memberships. The client can choose to filter the members+ project: filters memberships based on the id of the project.+ role: filters memberships based on the id of any role assigned to the membership.+ status: filters memberships based on the status of the principal.+ + created_at: filters memberships based on the time the membership was created.+ + updated_at: filters memberships based on the time the membership was updated last.+ Response 200 (application/hal+json)- [Memberships][]--## Create membership [POST]--Creates a new membership applying the attributes provided in the body.--You can use the form and schema to be retrieve the valid attribute values and by that be guided towards successful creation.--+ Request Create memberships-- + Body-- {- "project": {- "href": "/api/v3/projects/1"- },- "principal": {- "href": "/api/v3/users/5"- },- "roles": [- {- "href": "/api/v3/roles/5"- },- {- "href": "/api/v3/roles/8"- }- ]- }--+ Response 201-- [Membership][]--+ Response 400 (application/hal+json)-- Occurs when the client did not send a valid JSON object in the request body.-- + Body-- {- "_type": "Error",- "errorIdentifier": "urn:openproject-org:api:v3:errors:InvalidRequestBody",- "message": "The request body was not a single JSON object."- }--+ Response 403 (application/hal+json)-- Returned if the client does not have sufficient permissions.-- **Required permission:** Manage members-- + Body+ [List memberships][]- {- "_type": "Error",- "errorIdentifier": "urn:openproject-org:api:v3:errors:MissingPermission",- "message": "You are not authorized to access this resource."- }--+ Response 422 (application/hal+json)-- Returned if:-- * a constraint for a property was violated (`PropertyConstraintViolation`)- + Body-- {- "_type": "Error",- "errorIdentifier": "urn:openproject-org:api:v3:errors:PropertyConstraintViolation",- "message": "Project can't be blank.",- "_embedded": {- "details": {- "attribute": "project"- }- }- }--## Membership schema [/api/v3/memberships/schemas]+## View membership schema [/api/v3/memberships/schemas]+ Model+ Body@@ -424,10 +439,17 @@ You can use the form and schema to be retrieve the valid attribute values and by"hasDefault": false,"writable": false},+ "updatedAt": {+ "type": "DateTime",+ "name": "Updated on",+ "required": true,+ "hasDefault": false,+ "writable": false+ },"project": {"type": "Project","name": "Project",- "required": true,+ "required": false,"hasDefault": false,"writable": true,"_links": {}@@ -460,7 +482,7 @@ You can use the form and schema to be retrieve the valid attribute values and by+ Response 200 (application/hal+json)- [Membership schema][]+ [View membership schema][]+ Response 403 (application/hal+json)@@ -544,10 +566,17 @@ For more details and all possible responses see the general specification of [Fo"hasDefault": false,"writable": false},+ "updatedAt": {+ "type": "DateTime",+ "name": "Updated on",+ "required": true,+ "hasDefault": false,+ "writable": false+ },"project": {"type": "Project","name": "Project",- "required": true,+ "required": false,"hasDefault": false,"writable": true,"_links": {@@ -576,7 +605,7 @@ For more details and all possible responses see the general specification of [Fo"writable": true,"_links": {"allowedValues": {- "href": "/api/v3/roles?filters=%5B%7B%22unit%22%3A%7B%22operator%22%3A%22%3D%22%2C%22values%22%3A%5B%22project%22%5D%7D%7D%5D"+ "href": "/api/v3/roles}}},@@ -688,10 +717,17 @@ For more details and all possible responses see the general specification of [Fo"hasDefault": false,"writable": false},+ "updatedAt": {+ "type": "DateTime",+ "name": "Updated on",+ "required": true,+ "hasDefault": false,+ "writable": false+ },"project": {"type": "Project","name": "Project",- "required": true,+ "required": false,"hasDefault": false,"writable": false,"_links": {}diff --git a/frontend/src/app/modules/augmenting/dynamic-scripts/global_roles.ts b/frontend/src/app/modules/augmenting/dynamic-scripts/global_roles.tsindex 3229b7bec75..38f891f7073 100644--- a/frontend/src/app/modules/augmenting/dynamic-scripts/global_roles.ts+++ b/frontend/src/app/modules/augmenting/dynamic-scripts/global_roles.ts@@ -59,7 +59,6 @@},show_global_forms: function () {- $('#global_attributes').show();$('#global_permissions').show();},@@ -69,7 +68,6 @@},hide_global_forms: function () {- $('#global_attributes').hide();$('#global_permissions').hide();},diff --git a/frontend/src/app/modules/grids/widgets/members/members.component.ts b/frontend/src/app/modules/grids/widgets/members/members.component.tsindex abeab2378b6..cf65b4a83a3 100644--- a/frontend/src/app/modules/grids/widgets/members/members.component.ts+++ b/frontend/src/app/modules/grids/widgets/members/members.component.ts@@ -120,7 +120,7 @@ export class WidgetMembersComponent extends AbstractWidgetComponent implements O}private get listMembersParams() {- let params:Apiv3ListParameters = { sortBy: [['created_on', 'desc']], pageSize: DISPLAYED_MEMBERS_LIMIT };+ let params:Apiv3ListParameters = { sortBy: [['created_at', 'desc']], pageSize: DISPLAYED_MEMBERS_LIMIT };if (this.currentProject.id) {params['filters'] = [['project_id', '=', [this.currentProject.id]]];diff --git a/lib/api/utilities/property_name_converter.rb b/lib/api/utilities/property_name_converter.rbindex b7a9aa2d4d7..e00d08255e0 100644--- a/lib/api/utilities/property_name_converter.rb+++ b/lib/api/utilities/property_name_converter.rb@@ -69,7 +69,7 @@ module APIattribute = underscore_attribute attribute.to_s.underscoreattribute = collapse_custom_field_name(attribute)- special_conversion = special_api_to_ar_conversions[attribute]+ special_conversion = Constants::ARToAPIConversions.api_to_ar_conversions[attribute]if refer_to_idsspecial_conversion = denormalize_foreign_key_name(special_conversion, context)@@ -86,13 +86,6 @@ module APIprivate- def special_api_to_ar_conversions- @api_to_ar_conversions ||= Constants::ARToAPIConversions.all.inject({}) do |result, (k, v)|- result[v.underscore] = k.to_s- result- end- end-# Unifies different attributes refering to the same thing via a foreign key# e.g. status_id -> statusdef normalize_foreign_key_name(attribute)diff --git a/lib/api/v3/memberships/membership_representer.rb b/lib/api/v3/memberships/membership_representer.rbindex 9b4846a5901..389a5ee54c1 100644--- a/lib/api/v3/memberships/membership_representer.rb+++ b/lib/api/v3/memberships/membership_representer.rb@@ -88,8 +88,8 @@ module APIendend- date_time_property :created_on,- as: 'createdAt'+ date_time_property :created_at+ date_time_property :updated_atself.to_eager_load = %i[principalprojectdiff --git a/lib/api/v3/memberships/schemas/membership_schema_representer.rb b/lib/api/v3/memberships/schemas/membership_schema_representer.rbindex cb5c2a8b793..187d440d9c7 100644--- a/lib/api/v3/memberships/schemas/membership_schema_representer.rb+++ b/lib/api/v3/memberships/schemas/membership_schema_representer.rb@@ -44,9 +44,12 @@ module APIschema :created_at,type: 'DateTime'+ schema :updated_at,+ type: 'DateTime'+schema_with_allowed_link :project,has_default: false,- required: true,+ required: false,href_callback: ->(*) {allowed_projects_href}@@ -64,7 +67,7 @@ module APIhas_default: false,required: true,href_callback: ->(*) {- api_v3_paths.path_for(:roles, filters: [{ unit: { operator: '=', values: ['project'] } }])+ allowed_roles_href}def self.represented_class@@ -103,6 +106,18 @@ module APIfiltersend++ def allowed_roles_href+ filters = represented.new_record? ? {} : { filters: allowed_roles_filters }++ api_v3_paths.path_for(:roles, **filters)+ end++ def allowed_roles_filters+ value = represented.project ? 'project' : 'system'++ [{ unit: { operator: '=', values: [value] } }]+ endendendenddiff --git a/lib/open_project/access_control.rb b/lib/open_project/access_control.rbindex dc9036f2298..1b9b7ce43bd 100644--- a/lib/open_project/access_control.rb+++ b/lib/open_project/access_control.rb@@ -92,9 +92,13 @@ module OpenProject@loggedin_only_permissions ||= @permissions.select(&:require_loggedin?)end+ def global_permissions+ @permissions.select(&:global?)+ end+def available_project_modules@available_project_modules ||= begin- (@permissions.map(&:project_module) + @project_modules_without_permissions)+ (@permissions.reject(&:global?).map(&:project_module) + @project_modules_without_permissions).uniq.compact.reject { |name| disabled_project_modules.include? name }diff --git a/lib/open_project/access_control/permission.rb b/lib/open_project/access_control/permission.rbindex b837fd70f7c..2187c3e5269 100644--- a/lib/open_project/access_control/permission.rb+++ b/lib/open_project/access_control/permission.rb@@ -41,6 +41,7 @@ module OpenProject@actions = []@public = options[:public] || false@require = options[:require]+ @global = options[:global] || false@dependencies = Array(options[:dependencies]) || []@project_module = options[:project_module]hash.each do |controller, actions|@@ -57,6 +58,10 @@ module OpenProject@publicend+ def global?+ @global+ end+def require_member?@require && @require == :memberenddiff --git a/lib/open_project/ui/extensible_tabs.rb b/lib/open_project/ui/extensible_tabs.rbindex 03a44a8f483..435e74d03a7 100644--- a/lib/open_project/ui/extensible_tabs.rb+++ b/lib/open_project/ui/extensible_tabs.rb@@ -32,7 +32,7 @@ module OpenProjectclass ExtensibleTabsclass << selfdef tabs- @@tabs ||= {+ @tabs ||= {user: core_user_tabs}end@@ -71,7 +71,14 @@ module OpenProjectname: 'groups',partial: 'users/groups',path: ->(params) { tab_edit_user_path(params[:user], tab: :groups) },- label: :label_group_plural, if: ->(*) { Group.all.any? }+ label: :label_group_plural,+ if: ->(*) { Group.all.any? }+ },+ {+ name: 'global_roles',+ partial: 'users/global_roles',+ path: ->(params) { tab_edit_user_path(params[:user], tab: :global_roles) },+ label: :label_global_roles}]enddiff --git a/modules/global_roles/app/controllers/principal_roles_controller.rb b/modules/global_roles/app/controllers/principal_roles_controller.rbdeleted file mode 100644index 39e56ac45d6..00000000000--- a/modules/global_roles/app/controllers/principal_roles_controller.rb+++ /dev/null@@ -1,90 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--class PrincipalRolesController < ApplicationController- def create- @principal_roles = new_principal_roles_from_params- @global_roles = GlobalRole.all- @user = Principal.find(principle_role_params[:principal_id])-- call_hook :principal_roles_controller_create_before_save,- principal_roles: @principal_roles-- @principal_roles.each(&:save) unless performed?-- call_hook :principal_roles_controller_create_before_respond,- principal_roles: @principal_roles-- redirect_to_edit_user(@user) unless performed?- end-- def destroy- @principal_role = PrincipalRole.find(params[:id])- @user = Principal.find(@principal_role.principal_id)- @global_roles = GlobalRole.all-- call_hook :principal_roles_controller_destroy_before_destroy,- principal_role: @principal_role-- @principal_role.destroy unless performed?-- call_hook :principal_roles_controller_destroy_before_respond,- principal_role: @principal_role-- redirect_to_edit_user(@user) unless performed?- end-- private-- def new_principal_roles_from_params- pr_params = principle_role_params.dup- role_ids = pr_params[:role_id] ? [pr_params.delete(:role_id)] : pr_params.delete(:role_ids)- principal_id = pr_params.delete(:principal_id)-- roles = Role.find role_ids-- principal_roles = []- role_ids.map(&:to_i).each do |role_id|- role = PrincipalRole.new(pr_params)- role.principal_id = principal_id- role.role = roles.detect { |r| r.id == role_id }- principal_roles << role- end- principal_roles- end-- private-- def redirect_to_edit_user(user)- redirect_to tab_edit_user_path user, tab: 'global_roles'- end-- def principle_role_params- params.require(:principal_role).permit(*PermittedParams.permitted_attributes[:global_roles_principal_role])- end-enddiff --git a/modules/global_roles/app/views/principal_roles/_show_table_row.html.erb b/modules/global_roles/app/views/principal_roles/_show_table_row.html.erbdeleted file mode 100644index d831921e4cf..00000000000--- a/modules/global_roles/app/views/principal_roles/_show_table_row.html.erb+++ /dev/null@@ -1,45 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program 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 General Public License for more details.--You should have received a copy of the GNU 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.--See docs/COPYRIGHT.rdoc for more details.--++#%>--<tr id="principal_role-<%= principal_role.id %>">-<td class="role assigned_global_role_<%= principal_role.role_id%>">- <%=h principal_role.role %>-</td>-<%= call_hook(:principal_roles_table_row, :user => @user, :principal_role => principal_role )%>-<td class="buttons">-<% buttons = {:edit => false} %>-<%= call_hook(:principal_roles_edit_button_needed, :buttons => buttons) %>-<% if buttons[:edit]%>- <%= link_to '', '', :class => 'icon icon-edit', :title => t(:button_edit) %>-<%end%>- <%= link_to('',- principal_role,- { method: :delete, class: 'icon icon-delete', title: t(:button_delete) }) %>-</td>-</tr>diff --git a/modules/global_roles/app/views/roles/_global_attributes.html.erb b/modules/global_roles/app/views/roles/_global_attributes.html.erbdeleted file mode 100644index eadd4ccacb9..00000000000--- a/modules/global_roles/app/views/roles/_global_attributes.html.erb+++ /dev/null@@ -1,28 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program 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 General Public License for more details.--You should have received a copy of the GNU 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.--See docs/COPYRIGHT.rdoc for more details.--++#%>diff --git a/modules/global_roles/app/views/roles/_global_form.html.erb b/modules/global_roles/app/views/roles/_global_form.html.erbdeleted file mode 100644index eadd4ccacb9..00000000000--- a/modules/global_roles/app/views/roles/_global_form.html.erb+++ /dev/null@@ -1,28 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program 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 General Public License for more details.--You should have received a copy of the GNU 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.--See docs/COPYRIGHT.rdoc for more details.--++#%>diff --git a/modules/global_roles/config/locales/crowdin/ar.yml b/modules/global_roles/config/locales/crowdin/ar.ymldeleted file mode 100644index 0423e280c24..00000000000--- a/modules/global_roles/config/locales/crowdin/ar.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-ar:- error_can_not_be_assigned: لا يمكن تعيين الدور لهذا المستخدم- global_roles: الأدوار العالمية- label_role_type: النّوع- label_member_role: دور المشروع- label_global_role: الدور العالمي- label_not_changeable: (غير قابل للتغيير)- label_no_assignable_role: لا يوجد دور عالمي متاح للمهمة- label_global: عالمي- seeders:- default_role_project_creator: 'Project creator'diff --git a/modules/global_roles/config/locales/crowdin/bg.yml b/modules/global_roles/config/locales/crowdin/bg.ymldeleted file mode 100644index f1da2166f1f..00000000000--- a/modules/global_roles/config/locales/crowdin/bg.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-bg:- error_can_not_be_assigned: Ролята не може да бъде възложена на този потребител- global_roles: Глобални роли- label_role_type: Тип- label_member_role: Project Role- label_global_role: Global Role- label_not_changeable: (не може да се променя)- label_no_assignable_role: No global role available for assignment- label_global: Global- seeders:- default_role_project_creator: 'Създател на проект'diff --git a/modules/global_roles/config/locales/crowdin/ca.yml b/modules/global_roles/config/locales/crowdin/ca.ymldeleted file mode 100644index b846a212c8d..00000000000--- a/modules/global_roles/config/locales/crowdin/ca.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-ca:- error_can_not_be_assigned: The role can not be assigned to this user- global_roles: Global Roles- label_role_type: Tipus- label_member_role: Project Role- label_global_role: Global Role- label_not_changeable: (not changeable)- label_no_assignable_role: No global role available for assignment- label_global: Global- seeders:- default_role_project_creator: 'Project creator'diff --git a/modules/global_roles/config/locales/crowdin/cs.yml b/modules/global_roles/config/locales/crowdin/cs.ymldeleted file mode 100644index f57896277d9..00000000000--- a/modules/global_roles/config/locales/crowdin/cs.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-cs:- error_can_not_be_assigned: Roli nelze přiřadit k tomuto uživateli- global_roles: Globální role- label_role_type: Typ- label_member_role: Projektová role- label_global_role: Globální role- label_not_changeable: (neměnitelné)- label_no_assignable_role: Žádná globální role není dostupná pro přiřazení- label_global: Globální- seeders:- default_role_project_creator: 'Tvůrce projektu'diff --git a/modules/global_roles/config/locales/crowdin/da.yml b/modules/global_roles/config/locales/crowdin/da.ymldeleted file mode 100644index b7bce269d0b..00000000000--- a/modules/global_roles/config/locales/crowdin/da.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-da:- error_can_not_be_assigned: The role can not be assigned to this user- global_roles: Global Roles- label_role_type: Type- label_member_role: Project Role- label_global_role: Global Role- label_not_changeable: (not changeable)- label_no_assignable_role: No global role available for assignment- label_global: Global- seeders:- default_role_project_creator: 'Project creator'diff --git a/modules/global_roles/config/locales/crowdin/de.yml b/modules/global_roles/config/locales/crowdin/de.ymldeleted file mode 100644index d10dd8c4eac..00000000000--- a/modules/global_roles/config/locales/crowdin/de.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-de:- error_can_not_be_assigned: Die Rolle kann diesem Nutzer nicht zugewiesen werden- global_roles: Globale Rollen- label_role_type: Typ- label_member_role: Projekt Rolle- label_global_role: Globale Rolle- label_not_changeable: (nicht veränderbar)- label_no_assignable_role: Keine globale Rolle zuweisbar- label_global: Global- seeders:- default_role_project_creator: 'Projektersteller'diff --git a/modules/global_roles/config/locales/crowdin/el.yml b/modules/global_roles/config/locales/crowdin/el.ymldeleted file mode 100644index 51da41b3d36..00000000000--- a/modules/global_roles/config/locales/crowdin/el.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-el:- error_can_not_be_assigned: Ο ρόλος δεν μπορεί να ανατεθεί στον χρήστη- global_roles: Καθολικοί Ρόλοι- label_role_type: Τύπος- label_member_role: Ρόλος στο έργο- label_global_role: Καθολικός Ρόλος- label_not_changeable: (μη μεταβλητό)- label_no_assignable_role: Δεν υπάρχει διαθέσιμος καθολικός ρόλος για ανάθεση- label_global: Καθολικό- seeders:- default_role_project_creator: 'Δημιουργός έργου'diff --git a/modules/global_roles/config/locales/crowdin/es.yml b/modules/global_roles/config/locales/crowdin/es.ymldeleted file mode 100644index c236d23fe68..00000000000--- a/modules/global_roles/config/locales/crowdin/es.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-es:- error_can_not_be_assigned: No se puede asignar el rol a este usuario- global_roles: Roles globales- label_role_type: Tipo- label_member_role: Rol de proyecto- label_global_role: Rol global- label_not_changeable: (no modificable)- label_no_assignable_role: No hay ningún rol global disponible para asignar- label_global: Global- seeders:- default_role_project_creator: 'Creador del proyecto'diff --git a/modules/global_roles/config/locales/crowdin/fi.yml b/modules/global_roles/config/locales/crowdin/fi.ymldeleted file mode 100644index 367be4e9d43..00000000000--- a/modules/global_roles/config/locales/crowdin/fi.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-fi:- error_can_not_be_assigned: Roolia ei voi antaa tälle käyttäjälle- global_roles: Yleiset roolit- label_role_type: Tyyppi- label_member_role: Projektirooli- label_global_role: Yleinen rooli- label_not_changeable: (ei vaihdettavissa)- label_no_assignable_role: Yleistä roolia ei ole saatavilla annettavaksi- label_global: Yleinen- seeders:- default_role_project_creator: 'Projektin luoja'diff --git a/modules/global_roles/config/locales/crowdin/fil.yml b/modules/global_roles/config/locales/crowdin/fil.ymldeleted file mode 100644index ca770b41be4..00000000000--- a/modules/global_roles/config/locales/crowdin/fil.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-fil:- error_can_not_be_assigned: The role can not be assigned to this user- global_roles: Global Roles- label_role_type: Uri- label_member_role: Project Role- label_global_role: Global Role- label_not_changeable: (not changeable)- label_no_assignable_role: No global role available for assignment- label_global: Global- seeders:- default_role_project_creator: 'Project creator'diff --git a/modules/global_roles/config/locales/crowdin/fr.yml b/modules/global_roles/config/locales/crowdin/fr.ymldeleted file mode 100644index eed8b9fe3dd..00000000000--- a/modules/global_roles/config/locales/crowdin/fr.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-fr:- error_can_not_be_assigned: Le rôle ne peut pas être assigné à cet utilisateur- global_roles: Rôles globaux- label_role_type: Type- label_member_role: Rôle du projet- label_global_role: Rôle global- label_not_changeable: (non modifiable)- label_no_assignable_role: Aucun rôle global disponible pour l'assignation- label_global: Global- seeders:- default_role_project_creator: 'Créateur du projet'diff --git a/modules/global_roles/config/locales/crowdin/hr.yml b/modules/global_roles/config/locales/crowdin/hr.ymldeleted file mode 100644index e36d4517bb8..00000000000--- a/modules/global_roles/config/locales/crowdin/hr.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-hr:- error_can_not_be_assigned: Rola ne može biti dodijeljena ovom korisniku- global_roles: Globalne role- label_role_type: Tip- label_member_role: Projekt role- label_global_role: Globalne role- label_not_changeable: (ne promijenjiv)- label_no_assignable_role: Nema dostupnih globalnih rola za ovaj zadatak- label_global: Globalne- seeders:- default_role_project_creator: 'Project creator'diff --git a/modules/global_roles/config/locales/crowdin/hu.yml b/modules/global_roles/config/locales/crowdin/hu.ymldeleted file mode 100644index 24312ebc143..00000000000--- a/modules/global_roles/config/locales/crowdin/hu.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-hu:- error_can_not_be_assigned: A szerep nem rendelhető ehhez a felhasználóhoz- global_roles: Globális szerepek- label_role_type: Típus- label_member_role: Projekt szerep- label_global_role: Globális szerep- label_not_changeable: (nem módosítható)- label_no_assignable_role: Nincs hozzárendelhető globális szerep- label_global: Globális- seeders:- default_role_project_creator: 'Projekt létrehozója'diff --git a/modules/global_roles/config/locales/crowdin/id.yml b/modules/global_roles/config/locales/crowdin/id.ymldeleted file mode 100644index 094c4d2547f..00000000000--- a/modules/global_roles/config/locales/crowdin/id.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-id:- error_can_not_be_assigned: Peran tidak dapat ditugaskan untuk pengguna ini- global_roles: Peran global- label_role_type: Tipe- label_member_role: Peran proyek- label_global_role: Peran global- label_not_changeable: (tidak berubah)- label_no_assignable_role: Tidak ada peran global yang tersedia untuk tugas- label_global: Global- seeders:- default_role_project_creator: 'Pencipta proyek'diff --git a/modules/global_roles/config/locales/crowdin/it.yml b/modules/global_roles/config/locales/crowdin/it.ymldeleted file mode 100644index 562a5be760b..00000000000--- a/modules/global_roles/config/locales/crowdin/it.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-it:- error_can_not_be_assigned: Il ruolo non può essere assegnato a questo utente- global_roles: Ruoli globali- label_role_type: Tipo- label_member_role: Ruolo di progetto- label_global_role: Ruolo globale- label_not_changeable: (non modificabile)- label_no_assignable_role: Nessun ruolo globale disponibile per l'assegnazione- label_global: Globale- seeders:- default_role_project_creator: 'Creatore del progetto'diff --git a/modules/global_roles/config/locales/crowdin/ja.yml b/modules/global_roles/config/locales/crowdin/ja.ymldeleted file mode 100644index b12285e2697..00000000000--- a/modules/global_roles/config/locales/crowdin/ja.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-ja:- error_can_not_be_assigned: このユーザーに役割を割り当てることはできません- global_roles: グローバルロール- label_role_type: 種別- label_member_role: プロジェクトの役割- label_global_role: グローバルロール- label_not_changeable: '(変更不可)'- label_no_assignable_role: 割り当てに使用できるグローバルロールはありません- label_global: 全般- seeders:- default_role_project_creator: 'プロジェクトの作成者'diff --git a/modules/global_roles/config/locales/crowdin/ko.yml b/modules/global_roles/config/locales/crowdin/ko.ymldeleted file mode 100644index c637bea5338..00000000000--- a/modules/global_roles/config/locales/crowdin/ko.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-ko:- error_can_not_be_assigned: 역할을 이 사용자에게 할당할 수 없습니다.- global_roles: 글로벌 역할- label_role_type: 타입- label_member_role: 프로젝트 역할- label_global_role: 글로벌 역할- label_not_changeable: (변경할 수 없음)- label_no_assignable_role: 할당을 위해 글로벌 역할을 사용할 수 없음- label_global: 글로벌- seeders:- default_role_project_creator: '프로젝트 생성자'diff --git a/modules/global_roles/config/locales/crowdin/lt.yml b/modules/global_roles/config/locales/crowdin/lt.ymldeleted file mode 100644index a5cbdead431..00000000000--- a/modules/global_roles/config/locales/crowdin/lt.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-lt:- error_can_not_be_assigned: Rolė negali būti priskirta šiam vartotojui- global_roles: Globalios rolės- label_role_type: Tipas- label_member_role: Projekto rolė- label_global_role: Globali rolė- label_not_changeable: (negalima pakeisti)- label_no_assignable_role: Jokia globali rolė nėra prieinama šiam priskyrimui- label_global: Globali- seeders:- default_role_project_creator: 'Projekto autorius'diff --git a/modules/global_roles/config/locales/crowdin/nl.yml b/modules/global_roles/config/locales/crowdin/nl.ymldeleted file mode 100644index b20eb5d290e..00000000000--- a/modules/global_roles/config/locales/crowdin/nl.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-nl:- error_can_not_be_assigned: De functie kan niet worden toegewezen aan deze gebruiker- global_roles: Globale functies- label_role_type: Type- label_member_role: Project functie- label_global_role: Globale functie- label_not_changeable: (niet wijzigbaar)- label_no_assignable_role: Geen globale rol toewijsbaar- label_global: Globaal- seeders:- default_role_project_creator: 'Project creator'diff --git a/modules/global_roles/config/locales/crowdin/no.yml b/modules/global_roles/config/locales/crowdin/no.ymldeleted file mode 100644index 249b21f725b..00000000000--- a/modules/global_roles/config/locales/crowdin/no.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-"no":- error_can_not_be_assigned: The role can not be assigned to this user- global_roles: Global Roles- label_role_type: Type- label_member_role: Project Role- label_global_role: Global Role- label_not_changeable: (not changeable)- label_no_assignable_role: No global role available for assignment- label_global: Global- seeders:- default_role_project_creator: 'Project creator'diff --git a/modules/global_roles/config/locales/crowdin/pl.yml b/modules/global_roles/config/locales/crowdin/pl.ymldeleted file mode 100644index c387e0207ae..00000000000--- a/modules/global_roles/config/locales/crowdin/pl.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-pl:- error_can_not_be_assigned: Rola nie może być przypisana do tego użytkownika- global_roles: Role ogólne- label_role_type: Typ- label_member_role: Rola projektu- label_global_role: Globalna rola- label_not_changeable: (niezmienialne)- label_no_assignable_role: Brak dostępnej roli do przydzielenia- label_global: Globalna- seeders:- default_role_project_creator: 'Twórca projektu'diff --git a/modules/global_roles/config/locales/crowdin/pt.yml b/modules/global_roles/config/locales/crowdin/pt.ymldeleted file mode 100644index 2b9a481c070..00000000000--- a/modules/global_roles/config/locales/crowdin/pt.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-pt:- error_can_not_be_assigned: O papel não pode ser atribuído a este usuário- global_roles: Papéis globais- label_role_type: Tipo- label_member_role: Papel no projeto- label_global_role: Papel global- label_not_changeable: (não modificável)- label_no_assignable_role: Nenhum papel global disponível para atribuição- label_global: Global- seeders:- default_role_project_creator: 'Criador do projeto'diff --git a/modules/global_roles/config/locales/crowdin/ro.yml b/modules/global_roles/config/locales/crowdin/ro.ymldeleted file mode 100644index 0367838340c..00000000000--- a/modules/global_roles/config/locales/crowdin/ro.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-ro:- error_can_not_be_assigned: The role can not be assigned to this user- global_roles: Global Roles- label_role_type: Tip- label_member_role: Project Role- label_global_role: Global Role- label_not_changeable: (not changeable)- label_no_assignable_role: No global role available for assignment- label_global: Global- seeders:- default_role_project_creator: 'Project creator'diff --git a/modules/global_roles/config/locales/crowdin/ru.yml b/modules/global_roles/config/locales/crowdin/ru.ymldeleted file mode 100644index a26babaf601..00000000000--- a/modules/global_roles/config/locales/crowdin/ru.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-ru:- error_can_not_be_assigned: Роль не может быть назначена для этого пользователя- global_roles: Глобальная роль- label_role_type: Тип- label_member_role: Роль проекта- label_global_role: Глобальная роль- label_not_changeable: (неизменяемая)- label_no_assignable_role: Нет глобальной роли, доступной для назначения- label_global: Глобальная- seeders:- default_role_project_creator: 'Создатель проекта'diff --git a/modules/global_roles/config/locales/crowdin/sk.yml b/modules/global_roles/config/locales/crowdin/sk.ymldeleted file mode 100644index d15a3da413f..00000000000--- a/modules/global_roles/config/locales/crowdin/sk.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-sk:- error_can_not_be_assigned: Rola nemôže byť priradená tomuto používateľovi- global_roles: Globálne roly- label_role_type: Typ- label_member_role: Rola projektu- label_global_role: Globálna rola- label_not_changeable: (nemodifikovateľná)- label_no_assignable_role: Nie je dostupná žiadna globálna rola pre priradenie- label_global: Globálna- seeders:- default_role_project_creator: 'Projekt vytvoril'diff --git a/modules/global_roles/config/locales/crowdin/sl.yml b/modules/global_roles/config/locales/crowdin/sl.ymldeleted file mode 100644index ab0d8c8d792..00000000000--- a/modules/global_roles/config/locales/crowdin/sl.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-sl:- error_can_not_be_assigned: Te vloge ni mogoče dodeliti temu uporabniku- global_roles: Globalna pravila- label_role_type: Vrsta- label_member_role: Projektne vloge- label_global_role: Globalne vloge- label_not_changeable: (ne spremenljivo)- label_no_assignable_role: Nobena globalna vloga ni na voljo za to nalogo- label_global: Globalno- seeders:- default_role_project_creator: 'Avtor projekta'diff --git a/modules/global_roles/config/locales/crowdin/sv.yml b/modules/global_roles/config/locales/crowdin/sv.ymldeleted file mode 100644index 5dbb1e9c535..00000000000--- a/modules/global_roles/config/locales/crowdin/sv.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-sv:- error_can_not_be_assigned: Rollen kan inte tilldelas denna användare- global_roles: Globala roller- label_role_type: Typ- label_member_role: Projektroll- label_global_role: Globalroll- label_not_changeable: (kan inte ändras)- label_no_assignable_role: Ingen global roll tillgänglig för tilldelning- label_global: Global- seeders:- default_role_project_creator: 'Projektskapare'diff --git a/modules/global_roles/config/locales/crowdin/tr.yml b/modules/global_roles/config/locales/crowdin/tr.ymldeleted file mode 100644index 559c2cf50ca..00000000000--- a/modules/global_roles/config/locales/crowdin/tr.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-tr:- error_can_not_be_assigned: Bu kullanıcı için rol atanabilir değil- global_roles: Küresel rolleri- label_role_type: Tür- label_member_role: Proje rolü- label_global_role: Küresel rolü- label_not_changeable: (değiştirilemez)- label_no_assignable_role: Atanabilir küresel rolü mevcut değil- label_global: Küresel- seeders:- default_role_project_creator: 'Proje yaratıcısı'diff --git a/modules/global_roles/config/locales/crowdin/uk.yml b/modules/global_roles/config/locales/crowdin/uk.ymldeleted file mode 100644index b8bd764729f..00000000000--- a/modules/global_roles/config/locales/crowdin/uk.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-uk:- error_can_not_be_assigned: Роль не може бути призначена цьому користувачеві- global_roles: Глобальні ролі- label_role_type: Тип- label_member_role: Роль проекту- label_global_role: Глобальна роль- label_not_changeable: (не змінюється)- label_no_assignable_role: Немає глобальної ролі для призначення- label_global: Глобальний- seeders:- default_role_project_creator: 'Творець проекту'diff --git a/modules/global_roles/config/locales/crowdin/vi.yml b/modules/global_roles/config/locales/crowdin/vi.ymldeleted file mode 100644index d756ca8c668..00000000000--- a/modules/global_roles/config/locales/crowdin/vi.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-vi:- error_can_not_be_assigned: The role can not be assigned to this user- global_roles: Global Roles- label_role_type: Kiểu- label_member_role: Project Role- label_global_role: Global Role- label_not_changeable: (not changeable)- label_no_assignable_role: No global role available for assignment- label_global: Global- seeders:- default_role_project_creator: 'Project creator'diff --git a/modules/global_roles/config/locales/crowdin/zh-CN.yml b/modules/global_roles/config/locales/crowdin/zh-CN.ymldeleted file mode 100644index 000419d97ec..00000000000--- a/modules/global_roles/config/locales/crowdin/zh-CN.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-zh-CN:- error_can_not_be_assigned: 无法将角色分配给此用户- global_roles: 全局角色- label_role_type: 类型- label_member_role: 项目角色- label_global_role: 全局角色- label_not_changeable: '(不变)'- label_no_assignable_role: 无可用于分配的全局角色- label_global: 全局- seeders:- default_role_project_creator: '项目创建人'diff --git a/modules/global_roles/config/locales/crowdin/zh-TW.yml b/modules/global_roles/config/locales/crowdin/zh-TW.ymldeleted file mode 100644index 352b8d4701f..00000000000--- a/modules/global_roles/config/locales/crowdin/zh-TW.yml+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-#OpenProject is an open source project management software.-#Copyright (C) 2012-2020 the OpenProject GmbH-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License version 3.-#OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-#Copyright (C) 2006-2017 Jean-Philippe Lang-#Copyright (C) 2010-2013 the ChiliProject Team-#This program is free software; you can redistribute it and/or-#modify it under the terms of the GNU General Public License-#as published by the Free Software Foundation; either version 2-#of the License, or (at your option) any later version.-#This program 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 General Public License for more details.-#You should have received a copy of the GNU 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.-#See docs/COPYRIGHT.rdoc for more details.-#++-zh-TW:- error_can_not_be_assigned: 無法將角色指派給此使用者- global_roles: 全域角色- label_role_type: 類型- label_member_role: 專案角色- label_global_role: 全域角色- label_not_changeable: (不可更改)- label_no_assignable_role: 沒有可用於分配的全域角色- label_global: 全域設定- seeders:- default_role_project_creator: '專案建立者'diff --git a/modules/global_roles/config/locales/en.yml b/modules/global_roles/config/locales/en.ymldeleted file mode 100644index 7288d17a865..00000000000--- a/modules/global_roles/config/locales/en.yml+++ /dev/null@@ -1,42 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--en:- error_can_not_be_assigned: The role can not be assigned to this user-- global_roles: Global Roles-- label_role_type: Type- label_member_role: Project Role- label_global_role: Global Role- label_not_changeable: (not changeable)- label_no_assignable_role: No global role available for assignment- label_global: Global-- seeders:- default_role_project_creator: 'Project creator'diff --git a/modules/global_roles/doc/CHANGELOG.md b/modules/global_roles/doc/CHANGELOG.mddeleted file mode 100644index ccaa5496ab5..00000000000--- a/modules/global_roles/doc/CHANGELOG.md+++ /dev/null@@ -1,76 +0,0 @@-<!---- copyright-OpenProject Global Roles Plugin--Copyright (C) 2010 - 2014 the OpenProject Foundation (OPF)--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-version 3.--This program 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 General Public License for more details.--You should have received a copy of the GNU 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.--++-->--# Changelog--* `#8374` Global Roles associated permissions become invisible--## 1.0.2--* `#5357` Adapt released plugins to base on plugins functionality--## 1.0.1--* `#4024` Subpages have no unique page titles-* `#4255` Fix: Permissions not displayed when editing a global role--## 1.0.1.pre5--* `#3333` [CodeClimate] Mass Assignment RolesController-* `#2256` [Accessibility] linearisation of issue show form (2)-* Rewritten Javascript to exclusively use jQuery--## 1.0.1.pre4--* `#2154` [Accessibility] Link form elements to their label - new role--## 1.0.1.pre3--* Adaptations for new icon font--## 1.0.1.pre2--* `#2459` Squashed old migrations--## 1.0.1.pre1--* `#1797` Adaptions to Migration of DTAG Customizing-* `#2070` Adaptions for moving core assets to other locations--## 1.0.0--* `#1643` Public Release of Global Roles Plugin--## 1.0.0.pre4--* adapted cukes to changed steps from core--## 1.0.0.pre3--* `#1461` Fix for: Integration Activity Plugin--## 1.0.0.pre2--* '#1319' Fix for failures on CI--## 1.0.0.pre1--* First rails 3 version-* `#1284` Created initial changelogdiff --git a/modules/global_roles/doc/COPYRIGHT.md b/modules/global_roles/doc/COPYRIGHT.mddeleted file mode 100644index 727dcd78eeb..00000000000--- a/modules/global_roles/doc/COPYRIGHT.md+++ /dev/null@@ -1,18 +0,0 @@-OpenProject Global Roles Plugin--This Plugin adds global roles to OpenProject--Copyright (C) 2010 - 2014 the OpenProject Foundation (OPF)--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-version 3.--This program 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 General Public License for more details.--You should have received a copy of the GNU 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.diff --git a/modules/global_roles/doc/COPYRIGHT_short.md b/modules/global_roles/doc/COPYRIGHT_short.mddeleted file mode 100644index 0103718ba19..00000000000--- a/modules/global_roles/doc/COPYRIGHT_short.md+++ /dev/null@@ -1,16 +0,0 @@-OpenProject Global Roles Plugin--Copyright (C) 2010 - 2014 the OpenProject Foundation (OPF)--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-version 3.--This program 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 General Public License for more details.--You should have received a copy of the GNU 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.diff --git a/modules/global_roles/doc/GPL.txt b/modules/global_roles/doc/GPL.txtdeleted file mode 100644index 94a9ed024d3..00000000000--- a/modules/global_roles/doc/GPL.txt+++ /dev/null@@ -1,674 +0,0 @@- GNU GENERAL PUBLIC LICENSE- Version 3, 29 June 2007-- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>- Everyone is permitted to copy and distribute verbatim copies- of this license document, but changing it is not allowed.-- Preamble-- The GNU General Public License is a free, copyleft license for-software and other kinds of works.-- The licenses for most software and other practical works are designed-to take away your freedom to share and change the works. By contrast,-the GNU General Public License is intended to guarantee your freedom to-share and change all versions of a program--to make sure it remains free-software for all its users. We, the Free Software Foundation, use the-GNU General Public License for most of our software; it applies also to-any other work released this way by its authors. You can apply it to-your programs, too.-- When we speak of free software, we are referring to freedom, not-price. Our General Public Licenses are designed to make sure that you-have the freedom to distribute copies of free software (and charge for-them if you wish), that you receive source code or can get it if you-want it, that you can change the software or use pieces of it in new-free programs, and that you know you can do these things.-- To protect your rights, we need to prevent others from denying you-these rights or asking you to surrender the rights. Therefore, you have-certain responsibilities if you distribute copies of the software, or if-you modify it: responsibilities to respect the freedom of others.-- For example, if you distribute copies of such a program, whether-gratis or for a fee, you must pass on to the recipients the same-freedoms that you received. You must make sure that they, too, receive-or can get the source code. And you must show them these terms so they-know their rights.-- Developers that use the GNU GPL protect your rights with two steps:-(1) assert copyright on the software, and (2) offer you this License-giving you legal permission to copy, distribute and/or modify it.-- For the developers' and authors' protection, the GPL clearly explains-that there is no warranty for this free software. For both users' and-authors' sake, the GPL requires that modified versions be marked as-changed, so that their problems will not be attributed erroneously to-authors of previous versions.-- Some devices are designed to deny users access to install or run-modified versions of the software inside them, although the manufacturer-can do so. This is fundamentally incompatible with the aim of-protecting users' freedom to change the software. The systematic-pattern of such abuse occurs in the area of products for individuals to-use, which is precisely where it is most unacceptable. Therefore, we-have designed this version of the GPL to prohibit the practice for those-products. If such problems arise substantially in other domains, we-stand ready to extend this provision to those domains in future versions-of the GPL, as needed to protect the freedom of users.-- Finally, every program is threatened constantly by software patents.-States should not allow patents to restrict development and use of-software on general-purpose computers, but in those that do, we wish to-avoid the special danger that patents applied to a free program could-make it effectively proprietary. To prevent this, the GPL assures that-patents cannot be used to render the program non-free.-- The precise terms and conditions for copying, distribution and-modification follow.-- TERMS AND CONDITIONS-- 0. Definitions.-- "This License" refers to version 3 of the GNU General Public License.-- "Copyright" also means copyright-like laws that apply to other kinds of-works, such as semiconductor masks.-- "The Program" refers to any copyrightable work licensed under this-License. Each licensee is addressed as "you". "Licensees" and-"recipients" may be individuals or organizations.-- To "modify" a work means to copy from or adapt all or part of the work-in a fashion requiring copyright permission, other than the making of an-exact copy. The resulting work is called a "modified version" of the-earlier work or a work "based on" the earlier work.-- A "covered work" means either the unmodified Program or a work based-on the Program.-- To "propagate" a work means to do anything with it that, without-permission, would make you directly or secondarily liable for-infringement under applicable copyright law, except executing it on a-computer or modifying a private copy. Propagation includes copying,-distribution (with or without modification), making available to the-public, and in some countries other activities as well.-- To "convey" a work means any kind of propagation that enables other-parties to make or receive copies. Mere interaction with a user through-a computer network, with no transfer of a copy, is not conveying.-- An interactive user interface displays "Appropriate Legal Notices"-to the extent that it includes a convenient and prominently visible-feature that (1) displays an appropriate copyright notice, and (2)-tells the user that there is no warranty for the work (except to the-extent that warranties are provided), that licensees may convey the-work under this License, and how to view a copy of this License. If-the interface presents a list of user commands or options, such as a-menu, a prominent item in the list meets this criterion.-- 1. Source Code.-- The "source code" for a work means the preferred form of the work-for making modifications to it. "Object code" means any non-source-form of a work.-- A "Standard Interface" means an interface that either is an official-standard defined by a recognized standards body, or, in the case of-interfaces specified for a particular programming language, one that-is widely used among developers working in that language.-- The "System Libraries" of an executable work include anything, other-than the work as a whole, that (a) is included in the normal form of-packaging a Major Component, but which is not part of that Major-Component, and (b) serves only to enable use of the work with that-Major Component, or to implement a Standard Interface for which an-implementation is available to the public in source code form. A-"Major Component", in this context, means a major essential component-(kernel, window system, and so on) of the specific operating system-(if any) on which the executable work runs, or a compiler used to-produce the work, or an object code interpreter used to run it.-- The "Corresponding Source" for a work in object code form means all-the source code needed to generate, install, and (for an executable-work) run the object code and to modify the work, including scripts to-control those activities. However, it does not include the work's-System Libraries, or general-purpose tools or generally available free-programs which are used unmodified in performing those activities but-which are not part of the work. For example, Corresponding Source-includes interface definition files associated with source files for-the work, and the source code for shared libraries and dynamically-linked subprograms that the work is specifically designed to require,-such as by intimate data communication or control flow between those-subprograms and other parts of the work.-- The Corresponding Source need not include anything that users-can regenerate automatically from other parts of the Corresponding-Source.-- The Corresponding Source for a work in source code form is that-same work.-- 2. Basic Permissions.-- All rights granted under this License are granted for the term of-copyright on the Program, and are irrevocable provided the stated-conditions are met. This License explicitly affirms your unlimited-permission to run the unmodified Program. The output from running a-covered work is covered by this License only if the output, given its-content, constitutes a covered work. This License acknowledges your-rights of fair use or other equivalent, as provided by copyright law.-- You may make, run and propagate covered works that you do not-convey, without conditions so long as your license otherwise remains-in force. You may convey covered works to others for the sole purpose-of having them make modifications exclusively for you, or provide you-with facilities for running those works, provided that you comply with-the terms of this License in conveying all material for which you do-not control copyright. Those thus making or running the covered works-for you must do so exclusively on your behalf, under your direction-and control, on terms that prohibit them from making any copies of-your copyrighted material outside their relationship with you.-- Conveying under any other circumstances is permitted solely under-the conditions stated below. Sublicensing is not allowed; section 10-makes it unnecessary.-- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.-- No covered work shall be deemed part of an effective technological-measure under any applicable law fulfilling obligations under article-11 of the WIPO copyright treaty adopted on 20 December 1996, or-similar laws prohibiting or restricting circumvention of such-measures.-- When you convey a covered work, you waive any legal power to forbid-circumvention of technological measures to the extent such circumvention-is effected by exercising rights under this License with respect to-the covered work, and you disclaim any intention to limit operation or-modification of the work as a means of enforcing, against the work's-users, your or third parties' legal rights to forbid circumvention of-technological measures.-- 4. Conveying Verbatim Copies.-- You may convey verbatim copies of the Program's source code as you-receive it, in any medium, provided that you conspicuously and-appropriately publish on each copy an appropriate copyright notice;-keep intact all notices stating that this License and any-non-permissive terms added in accord with section 7 apply to the code;-keep intact all notices of the absence of any warranty; and give all-recipients a copy of this License along with the Program.-- You may charge any price or no price for each copy that you convey,-and you may offer support or warranty protection for a fee.-- 5. Conveying Modified Source Versions.-- You may convey a work based on the Program, or the modifications to-produce it from the Program, in the form of source code under the-terms of section 4, provided that you also meet all of these conditions:-- a) The work must carry prominent notices stating that you modified- it, and giving a relevant date.-- b) The work must carry prominent notices stating that it is- released under this License and any conditions added under section- 7. This requirement modifies the requirement in section 4 to- "keep intact all notices".-- c) You must license the entire work, as a whole, under this- License to anyone who comes into possession of a copy. This- License will therefore apply, along with any applicable section 7- additional terms, to the whole of the work, and all its parts,- regardless of how they are packaged. This License gives no- permission to license the work in any other way, but it does not- invalidate such permission if you have separately received it.-- d) If the work has interactive user interfaces, each must display- Appropriate Legal Notices; however, if the Program has interactive- interfaces that do not display Appropriate Legal Notices, your- work need not make them do so.-- A compilation of a covered work with other separate and independent-works, which are not by their nature extensions of the covered work,-and which are not combined with it such as to form a larger program,-in or on a volume of a storage or distribution medium, is called an-"aggregate" if the compilation and its resulting copyright are not-used to limit the access or legal rights of the compilation's users-beyond what the individual works permit. Inclusion of a covered work-in an aggregate does not cause this License to apply to the other-parts of the aggregate.-- 6. Conveying Non-Source Forms.-- You may convey a covered work in object code form under the terms-of sections 4 and 5, provided that you also convey the-machine-readable Corresponding Source under the terms of this License,-in one of these ways:-- a) Convey the object code in, or embodied in, a physical product- (including a physical distribution medium), accompanied by the- Corresponding Source fixed on a durable physical medium- customarily used for software interchange.-- b) Convey the object code in, or embodied in, a physical product- (including a physical distribution medium), accompanied by a- written offer, valid for at least three years and valid for as- long as you offer spare parts or customer support for that product- model, to give anyone who possesses the object code either (1) a- copy of the Corresponding Source for all the software in the- product that is covered by this License, on a durable physical- medium customarily used for software interchange, for a price no- more than your reasonable cost of physically performing this- conveying of source, or (2) access to copy the- Corresponding Source from a network server at no charge.-- c) Convey individual copies of the object code with a copy of the- written offer to provide the Corresponding Source. This- alternative is allowed only occasionally and noncommercially, and- only if you received the object code with such an offer, in accord- with subsection 6b.-- d) Convey the object code by offering access from a designated- place (gratis or for a charge), and offer equivalent access to the- Corresponding Source in the same way through the same place at no- further charge. You need not require recipients to copy the- Corresponding Source along with the object code. If the place to- copy the object code is a network server, the Corresponding Source- may be on a different server (operated by you or a third party)- that supports equivalent copying facilities, provided you maintain- clear directions next to the object code saying where to find the- Corresponding Source. Regardless of what server hosts the- Corresponding Source, you remain obligated to ensure that it is- available for as long as needed to satisfy these requirements.-- e) Convey the object code using peer-to-peer transmission, provided- you inform other peers where the object code and Corresponding- Source of the work are being offered to the general public at no- charge under subsection 6d.-- A separable portion of the object code, whose source code is excluded-from the Corresponding Source as a System Library, need not be-included in conveying the object code work.-- A "User Product" is either (1) a "consumer product", which means any-tangible personal property which is normally used for personal, family,-or household purposes, or (2) anything designed or sold for incorporation-into a dwelling. In determining whether a product is a consumer product,-doubtful cases shall be resolved in favor of coverage. For a particular-product received by a particular user, "normally used" refers to a-typical or common use of that class of product, regardless of the status-of the particular user or of the way in which the particular user-actually uses, or expects or is expected to use, the product. A product-is a consumer product regardless of whether the product has substantial-commercial, industrial or non-consumer uses, unless such uses represent-the only significant mode of use of the product.-- "Installation Information" for a User Product means any methods,-procedures, authorization keys, or other information required to install-and execute modified versions of a covered work in that User Product from-a modified version of its Corresponding Source. The information must-suffice to ensure that the continued functioning of the modified object-code is in no case prevented or interfered with solely because-modification has been made.-- If you convey an object code work under this section in, or with, or-specifically for use in, a User Product, and the conveying occurs as-part of a transaction in which the right of possession and use of the-User Product is transferred to the recipient in perpetuity or for a-fixed term (regardless of how the transaction is characterized), the-Corresponding Source conveyed under this section must be accompanied-by the Installation Information. But this requirement does not apply-if neither you nor any third party retains the ability to install-modified object code on the User Product (for example, the work has-been installed in ROM).-- The requirement to provide Installation Information does not include a-requirement to continue to provide support service, warranty, or updates-for a work that has been modified or installed by the recipient, or for-the User Product in which it has been modified or installed. Access to a-network may be denied when the modification itself materially and-adversely affects the operation of the network or violates the rules and-protocols for communication across the network.-- Corresponding Source conveyed, and Installation Information provided,-in accord with this section must be in a format that is publicly-documented (and with an implementation available to the public in-source code form), and must require no special password or key for-unpacking, reading or copying.-- 7. Additional Terms.-- "Additional permissions" are terms that supplement the terms of this-License by making exceptions from one or more of its conditions.-Additional permissions that are applicable to the entire Program shall-be treated as though they were included in this License, to the extent-that they are valid under applicable law. If additional permissions-apply only to part of the Program, that part may be used separately-under those permissions, but the entire Program remains governed by-this License without regard to the additional permissions.-- When you convey a copy of a covered work, you may at your option-remove any additional permissions from that copy, or from any part of-it. (Additional permissions may be written to require their own-removal in certain cases when you modify the work.) You may place-additional permissions on material, added by you to a covered work,-for which you have or can give appropriate copyright permission.-- Notwithstanding any other provision of this License, for material you-add to a covered work, you may (if authorized by the copyright holders of-that material) supplement the terms of this License with terms:-- a) Disclaiming warranty or limiting liability differently from the- terms of sections 15 and 16 of this License; or-- b) Requiring preservation of specified reasonable legal notices or- author attributions in that material or in the Appropriate Legal- Notices displayed by works containing it; or-- c) Prohibiting misrepresentation of the origin of that material, or- requiring that modified versions of such material be marked in- reasonable ways as different from the original version; or-- d) Limiting the use for publicity purposes of names of licensors or- authors of the material; or-- e) Declining to grant rights under trademark law for use of some- trade names, trademarks, or service marks; or-- f) Requiring indemnification of licensors and authors of that- material by anyone who conveys the material (or modified versions of- it) with contractual assumptions of liability to the recipient, for- any liability that these contractual assumptions directly impose on- those licensors and authors.-- All other non-permissive additional terms are considered "further-restrictions" within the meaning of section 10. If the Program as you-received it, or any part of it, contains a notice stating that it is-governed by this License along with a term that is a further-restriction, you may remove that term. If a license document contains-a further restriction but permits relicensing or conveying under this-License, you may add to a covered work material governed by the terms-of that license document, provided that the further restriction does-not survive such relicensing or conveying.-- If you add terms to a covered work in accord with this section, you-must place, in the relevant source files, a statement of the-additional terms that apply to those files, or a notice indicating-where to find the applicable terms.-- Additional terms, permissive or non-permissive, may be stated in the-form of a separately written license, or stated as exceptions;-the above requirements apply either way.-- 8. Termination.-- You may not propagate or modify a covered work except as expressly-provided under this License. Any attempt otherwise to propagate or-modify it is void, and will automatically terminate your rights under-this License (including any patent licenses granted under the third-paragraph of section 11).-- However, if you cease all violation of this License, then your-license from a particular copyright holder is reinstated (a)-provisionally, unless and until the copyright holder explicitly and-finally terminates your license, and (b) permanently, if the copyright-holder fails to notify you of the violation by some reasonable means-prior to 60 days after the cessation.-- Moreover, your license from a particular copyright holder is-reinstated permanently if the copyright holder notifies you of the-violation by some reasonable means, this is the first time you have-received notice of violation of this License (for any work) from that-copyright holder, and you cure the violation prior to 30 days after-your receipt of the notice.-- Termination of your rights under this section does not terminate the-licenses of parties who have received copies or rights from you under-this License. If your rights have been terminated and not permanently-reinstated, you do not qualify to receive new licenses for the same-material under section 10.-- 9. Acceptance Not Required for Having Copies.-- You are not required to accept this License in order to receive or-run a copy of the Program. Ancillary propagation of a covered work-occurring solely as a consequence of using peer-to-peer transmission-to receive a copy likewise does not require acceptance. However,-nothing other than this License grants you permission to propagate or-modify any covered work. These actions infringe copyright if you do-not accept this License. Therefore, by modifying or propagating a-covered work, you indicate your acceptance of this License to do so.-- 10. Automatic Licensing of Downstream Recipients.-- Each time you convey a covered work, the recipient automatically-receives a license from the original licensors, to run, modify and-propagate that work, subject to this License. You are not responsible-for enforcing compliance by third parties with this License.-- An "entity transaction" is a transaction transferring control of an-organization, or substantially all assets of one, or subdividing an-organization, or merging organizations. If propagation of a covered-work results from an entity transaction, each party to that-transaction who receives a copy of the work also receives whatever-licenses to the work the party's predecessor in interest had or could-give under the previous paragraph, plus a right to possession of the-Corresponding Source of the work from the predecessor in interest, if-the predecessor has it or can get it with reasonable efforts.-- You may not impose any further restrictions on the exercise of the-rights granted or affirmed under this License. For example, you may-not impose a license fee, royalty, or other charge for exercise of-rights granted under this License, and you may not initiate litigation-(including a cross-claim or counterclaim in a lawsuit) alleging that-any patent claim is infringed by making, using, selling, offering for-sale, or importing the Program or any portion of it.-- 11. Patents.-- A "contributor" is a copyright holder who authorizes use under this-License of the Program or a work on which the Program is based. The-work thus licensed is called the contributor's "contributor version".-- A contributor's "essential patent claims" are all patent claims-owned or controlled by the contributor, whether already acquired or-hereafter acquired, that would be infringed by some manner, permitted-by this License, of making, using, or selling its contributor version,-but do not include claims that would be infringed only as a-consequence of further modification of the contributor version. For-purposes of this definition, "control" includes the right to grant-patent sublicenses in a manner consistent with the requirements of-this License.-- Each contributor grants you a non-exclusive, worldwide, royalty-free-patent license under the contributor's essential patent claims, to-make, use, sell, offer for sale, import and otherwise run, modify and-propagate the contents of its contributor version.-- In the following three paragraphs, a "patent license" is any express-agreement or commitment, however denominated, not to enforce a patent-(such as an express permission to practice a patent or covenant not to-sue for patent infringement). To "grant" such a patent license to a-party means to make such an agreement or commitment not to enforce a-patent against the party.-- If you convey a covered work, knowingly relying on a patent license,-and the Corresponding Source of the work is not available for anyone-to copy, free of charge and under the terms of this License, through a-publicly available network server or other readily accessible means,-then you must either (1) cause the Corresponding Source to be so-available, or (2) arrange to deprive yourself of the benefit of the-patent license for this particular work, or (3) arrange, in a manner-consistent with the requirements of this License, to extend the patent-license to downstream recipients. "Knowingly relying" means you have-actual knowledge that, but for the patent license, your conveying the-covered work in a country, or your recipient's use of the covered work-in a country, would infringe one or more identifiable patents in that-country that you have reason to believe are valid.-- If, pursuant to or in connection with a single transaction or-arrangement, you convey, or propagate by procuring conveyance of, a-covered work, and grant a patent license to some of the parties-receiving the covered work authorizing them to use, propagate, modify-or convey a specific copy of the covered work, then the patent license-you grant is automatically extended to all recipients of the covered-work and works based on it.-- A patent license is "discriminatory" if it does not include within-the scope of its coverage, prohibits the exercise of, or is-conditioned on the non-exercise of one or more of the rights that are-specifically granted under this License. You may not convey a covered-work if you are a party to an arrangement with a third party that is-in the business of distributing software, under which you make payment-to the third party based on the extent of your activity of conveying-the work, and under which the third party grants, to any of the-parties who would receive the covered work from you, a discriminatory-patent license (a) in connection with copies of the covered work-conveyed by you (or copies made from those copies), or (b) primarily-for and in connection with specific products or compilations that-contain the covered work, unless you entered into that arrangement,-or that patent license was granted, prior to 28 March 2007.-- Nothing in this License shall be construed as excluding or limiting-any implied license or other defenses to infringement that may-otherwise be available to you under applicable patent law.-- 12. No Surrender of Others' Freedom.-- If conditions are imposed on you (whether by court order, agreement or-otherwise) that contradict the conditions of this License, they do not-excuse you from the conditions of this License. If you cannot convey a-covered work so as to satisfy simultaneously your obligations under this-License and any other pertinent obligations, then as a consequence you may-not convey it at all. For example, if you agree to terms that obligate you-to collect a royalty for further conveying from those to whom you convey-the Program, the only way you could satisfy both those terms and this-License would be to refrain entirely from conveying the Program.-- 13. Use with the GNU Affero General Public License.-- Notwithstanding any other provision of this License, you have-permission to link or combine any covered work with a work licensed-under version 3 of the GNU Affero General Public License into a single-combined work, and to convey the resulting work. The terms of this-License will continue to apply to the part which is the covered work,-but the special requirements of the GNU Affero General Public License,-section 13, concerning interaction through a network will apply to the-combination as such.-- 14. Revised Versions of this License.-- The Free Software Foundation may publish revised and/or new versions of-the GNU General Public License from time to time. Such new versions will-be similar in spirit to the present version, but may differ in detail to-address new problems or concerns.-- Each version is given a distinguishing version number. If the-Program specifies that a certain numbered version of the GNU General-Public License "or any later version" applies to it, you have the-option of following the terms and conditions either of that numbered-version or of any later version published by the Free Software-Foundation. If the Program does not specify a version number of the-GNU General Public License, you may choose any version ever published-by the Free Software Foundation.-- If the Program specifies that a proxy can decide which future-versions of the GNU General Public License can be used, that proxy's-public statement of acceptance of a version permanently authorizes you-to choose that version for the Program.-- Later license versions may give you additional or different-permissions. However, no additional obligations are imposed on any-author or copyright holder as a result of your choosing to follow a-later version.-- 15. Disclaimer of Warranty.-- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.-- 16. Limitation of Liability.-- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF-SUCH DAMAGES.-- 17. Interpretation of Sections 15 and 16.-- If the disclaimer of warranty and limitation of liability provided-above cannot be given local legal effect according to their terms,-reviewing courts shall apply local law that most closely approximates-an absolute waiver of all civil liability in connection with the-Program, unless a warranty or assumption of liability accompanies a-copy of the Program in return for a fee.-- END OF TERMS AND CONDITIONS-- How to Apply These Terms to Your New Programs-- If you develop a new program, and you want it to be of the greatest-possible use to the public, the best way to achieve this is to make it-free software which everyone can redistribute and change under these terms.-- To do so, attach the following notices to the program. It is safest-to attach them to the start of each source file to most effectively-state the exclusion of warranty; and each file should have at least-the "copyright" line and a pointer to where the full notice is found.-- <one line to give the program's name and a brief idea of what it does.>- Copyright (C) <year> <name of author>-- This program is free software: you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation, either version 3 of the License, or- (at your option) any later version.-- This program 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 General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.--Also add information on how to contact you by electronic and paper mail.-- If the program does terminal interaction, make it output a short-notice like this when it starts in an interactive mode:-- <program> Copyright (C) <year> <name of author>- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.- This is free software, and you are welcome to redistribute it- under certain conditions; type `show c' for details.--The hypothetical commands `show w' and `show c' should show the appropriate-parts of the General Public License. Of course, your program's commands-might be different; for a GUI interface, you would use an "about box".-- You should also get your employer (if you work as a programmer) or school,-if any, to sign a "copyright disclaimer" for the program, if necessary.-For more information on this, and how to apply and follow the GNU GPL, see-<http://www.gnu.org/licenses/>.-- The GNU General Public License does not permit incorporating your program-into proprietary programs. If your program is a subroutine library, you-may consider it more useful to permit linking proprietary applications with-the library. If this is what you want to do, use the GNU Lesser General-Public License instead of this License. But first, please read-<http://www.gnu.org/philosophy/why-not-lgpl.html>.diff --git a/modules/global_roles/lib/open_project/global_roles/engine.rb b/modules/global_roles/lib/open_project/global_roles/engine.rbdeleted file mode 100644index d9ddebe450f..00000000000--- a/modules/global_roles/lib/open_project/global_roles/engine.rb+++ /dev/null@@ -1,94 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'open_project/plugins'--module OpenProject::GlobalRoles- class Engine < ::Rails::Engine- engine_name :openproject_global_roles-- include OpenProject::Plugins::ActsAsOpEngine-- register 'openproject-global_roles',- author_url: 'https://www.openproject.com',- bundled: true-- assets %w(global_roles/global_roles.js)-- # We still override version and project settings views from the core! URH- override_core_views!-- patches %i[Principal User UsersController]- patch_with_namespace :BasicData, :RoleSeeder-- add_tab_entry :user,- name: 'global_roles',- partial: 'users/global_roles',- path: ->(params) { tab_edit_user_path(params[:user], tab: :global_roles) },- label: :global_roles-- initializer 'patch helper' do- require_relative 'patches/roles_helper_patch'- end-- global_roles_attributes = [:id, :principal_id, :role_id, role_ids: []]- additional_permitted_attributes global_roles_principal_role: global_roles_attributes-- initializer 'global_roles.patch_access_control' do- require 'open_project/global_roles/patches/access_control_patch'- require 'open_project/global_roles/patches/permission_patch'- end-- initializer 'global_roles.register_global_permission' do- OpenProject::AccessControl.permission(:add_project).global = true- end-- config.to_prepare do- principal_roles_table = PrincipalRole.arel_table.alias('global_role_principal_roles')- query = Authorization::UserGlobalRolesQuery- roles_table = query.roles_table- users_table = query.users_table-- query.transformations- .register :all,- :principal_roles_join,- before: [:roles_join] do |statement, user|-- statement.outer_join(principal_roles_table)- .on(users_table[:id].eq(principal_roles_table[:principal_id]))- end-- query.transformations- .register query.roles_member_roles_join,- :or_is_principal_role do |statement, user|-- statement.or(principal_roles_table[:role_id].eq(roles_table[:id]))- end- end- end-enddiff --git a/modules/global_roles/lib/open_project/global_roles/patches/access_control_patch.rb b/modules/global_roles/lib/open_project/global_roles/patches/access_control_patch.rbdeleted file mode 100644index b39ba34407e..00000000000--- a/modules/global_roles/lib/open_project/global_roles/patches/access_control_patch.rb+++ /dev/null@@ -1,63 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--module OpenProject::GlobalRoles::Patches- module AccessControlPatch- def self.included(base)- base.send(:extend, ClassMethods)-- base.class_eval do- class << self- unless method_defined?(:available_project_modules_without_no_global)- alias_method :available_project_modules_without_no_global, :available_project_modules- end- alias_method :available_project_modules, :available_project_modules_with_no_global- end- end- end-- module ClassMethods- def available_project_modules_with_no_global- project_modules_with_permissions = @permissions.reject(&:global?).map(&:project_module)-- @available_project_modules = (project_modules_with_permissions + @project_modules_without_permissions)- .uniq- .compact- .reject { |name| disabled_project_modules.include? name }-- available_project_modules_without_no_global- end-- def global_permissions- @permissions.select(&:global?)- end- end- end-end--OpenProject::AccessControl.send(:include, OpenProject::GlobalRoles::Patches::AccessControlPatch)diff --git a/modules/global_roles/lib/open_project/global_roles/patches/principal_patch.rb b/modules/global_roles/lib/open_project/global_roles/patches/principal_patch.rbdeleted file mode 100644index 3951c425fbc..00000000000--- a/modules/global_roles/lib/open_project/global_roles/patches/principal_patch.rb+++ /dev/null@@ -1,40 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--module OpenProject::GlobalRoles::Patches- module PrincipalPatch- def self.included(base)- base.class_eval do- has_many :principal_roles, dependent: :destroy- has_many :global_roles, through: :principal_roles, source: :role- end- end- end-end--Principal.send(:include, OpenProject::GlobalRoles::Patches::PrincipalPatch)diff --git a/modules/global_roles/lib/open_project/global_roles/patches/role_seeder_patch.rb b/modules/global_roles/lib/open_project/global_roles/patches/role_seeder_patch.rbdeleted file mode 100644index 473b6abe3eb..00000000000--- a/modules/global_roles/lib/open_project/global_roles/patches/role_seeder_patch.rb+++ /dev/null@@ -1,21 +0,0 @@-module OpenProject::GlobalRoles::Patches- module RoleSeederPatch- def self.included(base)- base.prepend InstanceMethods- end-- module InstanceMethods- def roles- super + [project_creator]- end-- def project_creator- { name: I18n.t(:'seeders.default_role_project_creator'),- position: 6,- permissions: [:add_project],- type: 'GlobalRole'- }- end- end- end-enddiff --git a/modules/global_roles/lib/open_project/global_roles/patches/user_patch.rb b/modules/global_roles/lib/open_project/global_roles/patches/user_patch.rbdeleted file mode 100644index a6a3f61e735..00000000000--- a/modules/global_roles/lib/open_project/global_roles/patches/user_patch.rb+++ /dev/null@@ -1,40 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--module OpenProject::GlobalRoles::Patches- module UserPatch- def self.included(base)- base.class_eval do- has_many :principal_roles, dependent: :destroy, foreign_key: 'principal_id'- has_many :global_roles, through: :principal_roles, source: :role- end- end- end-end--User.send(:include, OpenProject::GlobalRoles::Patches::UserPatch)diff --git a/modules/global_roles/lib/open_project/global_roles/patches/users_controller_patch.rb b/modules/global_roles/lib/open_project/global_roles/patches/users_controller_patch.rbdeleted file mode 100644index 73bdd8fdcd1..00000000000--- a/modules/global_roles/lib/open_project/global_roles/patches/users_controller_patch.rb+++ /dev/null@@ -1,51 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require_dependency 'users_controller'--module OpenProject::GlobalRoles::Patches- module UsersControllerPatch- def self.included(base)- base.prepend InstanceMethods-- base.class_eval do- before_action :add_global_roles, only: [:edit]- end- end-- module InstanceMethods- private-- def add_global_roles- @global_roles = GlobalRole.all- end- end- end-end--UsersController.send(:include, OpenProject::GlobalRoles::Patches::UsersControllerPatch)diff --git a/modules/global_roles/lib/openproject-global_roles.rb b/modules/global_roles/lib/openproject-global_roles.rbdeleted file mode 100644index 3514a11f2c7..00000000000--- a/modules/global_roles/lib/openproject-global_roles.rb+++ /dev/null@@ -1,29 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'open_project/global_roles'diff --git a/modules/global_roles/openproject-global_roles.gemspec b/modules/global_roles/openproject-global_roles.gemspecdeleted file mode 100644index aa3e4b7c0fd..00000000000--- a/modules/global_roles/openproject-global_roles.gemspec+++ /dev/null@@ -1,19 +0,0 @@-# encoding: UTF-8--Gem::Specification.new do |s|- s.name = 'openproject-global_roles'- s.version = '1.0.0'- s.authors = 'OpenProject GmbH'- s.email = '[email protected]'- s.homepage = 'https://community.openproject.org/projects/plugin-global-roles'- s.summary = 'OpenProject Global Roles'- s.description = "Adds global roles not bound to a project. A user can have a global role allowing to- perform actions outside of the scope of a specific project normally only allowed for administrators.- By assigning the permission to create projects to a global role, non-administrators can create top-level projects."- s.license = 'GPLv3'-- s.files = Dir['{app,config,db,lib,doc}/**/*', 'README.md']- s.test_files = Dir['spec/**/*']-- s.add_development_dependency 'factory_girl_rails', '~> 4.0'-enddiff --git a/modules/global_roles/spec/controllers/principal_roles_controller_spec.rb b/modules/global_roles/spec/controllers/principal_roles_controller_spec.rbdeleted file mode 100644index 533c33234ae..00000000000--- a/modules/global_roles/spec/controllers/principal_roles_controller_spec.rb+++ /dev/null@@ -1,120 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require File.dirname(__FILE__) + '/../spec_helper'--describe PrincipalRolesController, type: :controller do- let(:current_user) { FactoryBot.build_stubbed(:admin) }-- before(:each) do- login_as(current_user)-- @principal_role = mock_model PrincipalRole-- allow(@principal_role).to receive(:id).and_return(23)- allow(PrincipalRole).to receive(:find).and_return @principal_role- end-- describe '#post' do- before :each do- @params = { 'principal_role' => { 'principal_id' => '3', 'role_ids' => ['7'] } }- end-- describe '#create' do- before :each do- end-- describe 'SUCCESS' do- before :each do- @global_role = mock_model(GlobalRole)- allow(@global_role).to receive(:id).and_return(42)- ##- # Note this test uses doubles which may break depending on the loaded plugins.- # Specifically extra stubs have been added for these tests to work with the- # openproject-impermanent_memberships plugin which would be otherwise unexpected.- # Those stubs are marked with the comment "only necessary with impermanent-memberships".- #- # If this problem occurs again with another plugin (or the same, really) this should be fixed for good- # by using FactoryBot to create actual model instances.- # I'm only patching this up right now because I don't want to spend any more time on it and- # the added methods are orthogonal to the test, also additional, unused stubs won't break things- # as opposed to missing ones.- #- # And yet: @TODO Don't use doubles but FactoryBot.- allow(@global_role).to receive(:id).and_return(42)- allow(@global_role).to receive(:permanent?).and_return(false) # only necessary with impermanent-memberships- allow(Role).to receive(:find).and_return([@global_role])- allow(PrincipalRole).to receive(:new).and_return(@principal_role)- @user = mock_model User- allow(@user).to receive(:valid?).and_return(true)- allow(@user).to receive(:logged?).and_return(true)- allow(@user).to receive(:global_roles).and_return([]) # only necessary with impermanent-memberships- allow(Principal).to receive(:find).and_return(@user)- allow(@principal_role).to receive(:role=)- allow(@principal_role).to receive(:role).and_return(@global_role)- allow(@principal_role).to receive(:principal_id=)- allow(@principal_role).to receive(:save)- allow(@principal_role).to receive(:role_id).and_return(@global_role.id)- allow(@principal_role).to receive(:valid?).and_return(true)- end-- before :each do- post :create, params: @params- end-- it { expect(response).to redirect_to tab_edit_user_path(@user, tab: 'global_roles') }- end- end- end-- describe '#delete' do- before :each do- allow(@principal_role).to receive(:principal_id).and_return(1)- @user = mock_model User- allow(@user).to receive(:logged?).and_return(true)- # only necessary with impermanent-memberships- allow(@user).to receive(:global_roles).and_return([])- allow(Principal).to receive(:find).and_return(@user)- allow(@principal_role).to receive(:destroy)-- # only necessary with impermanent-memberships- allow(@principal_role).to receive(:role).and_return(Struct.new(:id, :permanent?).new(42, false))- @params = { 'id' => '1' }- end-- describe '#destroy' do- describe 'SUCCESS' do- before :each do- delete :destroy, params: @params- end-- it { expect(response).to redirect_to tab_edit_user_path(@user, tab: 'global_roles') }- end- end- end-enddiff --git a/modules/global_roles/spec/controllers/users_controller_spec.rb b/modules/global_roles/spec/controllers/users_controller_spec.rbdeleted file mode 100644index e4b9cb3dd54..00000000000--- a/modules/global_roles/spec/controllers/users_controller_spec.rb+++ /dev/null@@ -1,54 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require File.dirname(__FILE__) + '/../spec_helper'--describe UsersController, type: :controller do- before(:each) do- allow(@controller).to receive(:require_admin).and_return(true)- allow(@controller).to receive(:check_if_login_required)- allow(@controller).to receive(:set_localization)- @global_roles = [mock_model(GlobalRole), mock_model(GlobalRole)]- allow(GlobalRole).to receive(:all).and_return(@global_roles)- user_mock = mock_model User- allow(user_mock).to receive(:logged?).and_return(true)- allow(User).to receive(:find).with(any_args).and_return(user_mock)-- disable_log_requesting_user- end-- describe 'get' do- before :each do- get 'edit', params: { id: 1 }- end-- it { expect(response).to be_successful }- it { expect(assigns(:global_roles)).to eql @global_roles }- it { expect(response).to render_template 'users/edit' }- end-enddiff --git a/modules/global_roles/spec/lib/access_control_spec.rb b/modules/global_roles/spec/lib/access_control_spec.rbdeleted file mode 100644index b0fedefa3c1..00000000000--- a/modules/global_roles/spec/lib/access_control_spec.rb+++ /dev/null@@ -1,73 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')--describe OpenProject::AccessControl do- before(:each) do- stash_access_control_permissions-- OpenProject::AccessControl.map do |map|- map.permission :proj0, { dont: :care }, require: :member- map.permission :global0, { dont: :care }, global: true- map.permission :proj1, { dont: :care }-- map.project_module :global_module do |mod|- mod.permission :global1, { dont: :care }, global: true- end-- map.project_module :project_module do |mod|- mod.permission :proj2, { dont: :care }- end-- map.project_module :mixed_module do |mod|- mod.permission :proj3, { dont: :care }- mod.permission :global2, { dont: :care }, global: true- end- end- end-- after(:each) do- restore_access_control_permissions- end-- describe 'class methods' do- describe '#global_permissions' do- it { expect(OpenProject::AccessControl.global_permissions.size).to eq(3) }- it { expect(OpenProject::AccessControl.global_permissions.collect(&:name)).to include(:global0) }- it { expect(OpenProject::AccessControl.global_permissions.collect(&:name)).to include(:global1) }- it { expect(OpenProject::AccessControl.global_permissions.collect(&:name)).to include(:global2) }- end-- describe '#available_project_modules' do- it { expect(OpenProject::AccessControl.available_project_modules.include?(:global_module)).to be_falsey }- it { expect(OpenProject::AccessControl.available_project_modules.include?(:global_module)).to be_falsey }- it { expect(OpenProject::AccessControl.available_project_modules.include?(:mixed_module)).to be_truthy }- end- end-enddiff --git a/modules/global_roles/spec/lib/loader_spec.rb b/modules/global_roles/spec/lib/loader_spec.rbdeleted file mode 100644index a7d8fd9f735..00000000000--- a/modules/global_roles/spec/lib/loader_spec.rb+++ /dev/null@@ -1,47 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require File.dirname(__FILE__) + '/../spec_helper'--describe 'Seeding' do- describe '#load' do- before :each do- stash_access_control_permissions- create_non_member_role- create_anonymous_role- end-- after(:each) do- restore_access_control_permissions- end-- it 'expects all generated roles to have the type \'Role\'' do- expect(Role.pluck(:type).uniq).to match_array ['Role']- end- end-enddiff --git a/modules/global_roles/spec/lib/permission_spec.rb b/modules/global_roles/spec/lib/permission_spec.rbdeleted file mode 100644index 0d7d279c861..00000000000--- a/modules/global_roles/spec/lib/permission_spec.rb+++ /dev/null@@ -1,58 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')--describe OpenProject::AccessControl::Permission do- describe 'WHEN setting global permission' do- describe 'creating with', :new do- before { @permission = OpenProject::AccessControl::Permission.new(:perm, { cont: [:action] }, { global: true }) }- describe '#global?' do- it { expect(@permission.global?).to be_truthy }- end- end- end-- describe 'setting non_global' do- describe 'creating with', :new do- before { @permission = OpenProject::AccessControl::Permission.new :perm, { cont: [:action] }, { global: false } }-- describe '#global?' do- it { expect(@permission.global?).to be_falsey }- end- end-- describe 'creating with', :new do- before { @permission = OpenProject::AccessControl::Permission.new :perm, { cont: [:action] }, {} }-- describe '#global?' do- it { expect(@permission.global?).to be_falsey }- end- end- end-enddiff --git a/modules/global_roles/spec/models/principal_role_spec.rb b/modules/global_roles/spec/models/principal_role_spec.rbdeleted file mode 100644index ddce7eeec45..00000000000--- a/modules/global_roles/spec/models/principal_role_spec.rb+++ /dev/null@@ -1,57 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')--describe PrincipalRole, type: :model do- describe '#valid?' do- before(:each) do- @principal_role = FactoryBot.build(:principal_role)- end-- describe 'role not assignable to user' do- before :each do- allow(@principal_role.role).to receive(:assignable_to?).and_return(false)- end-- it { expect(@principal_role.valid?).to be_falsey }- it {- @principal_role.valid?- expect(@principal_role.errors[:base]).to include(I18n.t(:error_can_not_be_assigned))- }- end-- describe 'role assignable to user' do- before(:each) do- allow(@principal_role.role).to receive(:assignable_to?).and_return(true)- end-- it { expect(@principal_role.valid?).to be_truthy }- end- end-enddiff --git a/modules/global_roles/spec/models/principal_spec.rb b/modules/global_roles/spec/models/principal_spec.rbdeleted file mode 100644index 9501b95c8cb..00000000000--- a/modules/global_roles/spec/models/principal_spec.rb+++ /dev/null@@ -1,53 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require File.dirname(__FILE__) + '/../spec_helper'--describe Principal, type: :model do- describe 'ATTRIBUTES' do- before :each do- end-- it { is_expected.to have_many :principal_roles }- it { is_expected.to have_many :global_roles }- end-- describe 'WHEN deleting a principal' do- let(:principal) { FactoryBot.build(:user) }- let(:role) { FactoryBot.build(:global_role) }-- before do- FactoryBot.create(:principal_role, role: role,- principal: principal)- principal.destroy- end-- it { expect(Role.find_by_id(role.id)).to eq(role) }- it { expect(PrincipalRole.where(id: principal.id)).to eq([]) }- end-enddiff --git a/modules/global_roles/spec/models/users/allowed_to_spec.rb b/modules/global_roles/spec/models/users/allowed_to_spec.rbdeleted file mode 100644index af9f445b0bc..00000000000--- a/modules/global_roles/spec/models/users/allowed_to_spec.rb+++ /dev/null@@ -1,162 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'spec_helper'--describe User, 'allowed to' do- let(:user) { member.principal }- let(:anonymous) { FactoryBot.build(:anonymous) }- let(:project) { FactoryBot.build(:project, public: false) }- let(:project2) { FactoryBot.build(:project, public: false) }- let(:role) { FactoryBot.build(:role) }- let(:role2) { FactoryBot.build(:role) }- let(:anonymous_role) { FactoryBot.build(:anonymous_role) }- let(:member) { FactoryBot.build(:member, project: project,- roles: [role]) }-- let(:action) { :the_one }- let(:other_action) { :another }- let(:public_action) { :view_project }- let(:global_permission) { OpenProject::AccessControl.permissions.find { |p| p.global? } }- let(:global_role) { FactoryBot.build(:global_role, :permissions => [global_permission.name]) }- let(:principal_role) { FactoryBot.build(:empty_principal_role, principal: user,- role: global_role) }--- before do- user.save!- anonymous.save!- end-- context "w/o the context being a project- w/o the user being member in a project- w/ the user having the global role- w/ the global role having the necessary permission" do- before do- global_role.save!-- principal_role.save!- end-- it 'is true' do- expect(user.allowed_to?(global_permission.name, nil, global: true)).to be_truthy- end- end-- context "w/o the context being a project- w/o the user being member in a project- w/ the user having the global role- w/o the global role having the necessary permission" do-- before do- global_role.permissions = []- global_role.save!-- principal_role.save!- end-- it 'is false' do- expect(user.allowed_to?(global_permission.name, nil, global: true)).to be_falsey- end- end-- context "w/o the context being a project- w/o the user being member in a project- w/o the user having the global role- w/ the global role having the necessary permission" do-- before do- global_role.permissions = []- global_role.save!- end-- it 'is false' do- expect(user.allowed_to?(global_permission.name, nil, global: true)).to be_falsey- end- end-- context "w/o the context being a project- w/o the user being member in a project- w/o the user having the global role- w/ the user being admin" do-- before do- user.update_attribute(:admin, true)- end-- it 'is true' do- expect(user.allowed_to?(global_permission.name, nil, global: true)).to be_truthy- end- end-- context "w/ the context being a project- w/o the user being member in the project- w/ the user having the global role- w/o the global role having the necessary permission" do- before do- global_role.permissions = []- global_role.save!-- principal_role.save!- end-- it 'is false' do- expect(user.allowed_to?(global_permission.name, project)).to be_falsey- end- end-- context "w/ the context being a project- w/o the user being member in a project- w/o the user having the global role- w/ the global role having the necessary permission" do-- before do- global_role.permissions = []- global_role.save!- end-- it 'is false' do- expect(user.allowed_to?(global_permission.name, project)).to be_falsey- end- end-- context "w/ the context being a project- w/o the user being member in a project- w/o the user having the global role- w/ the user being admin" do-- before do- user.update_attribute(:admin, true)- end-- it 'is true' do- expect(user.allowed_to?(global_permission.name, project)).to be_truthy- end- end-end-diff --git a/modules/global_roles/spec/plugin_spec_helper.rb b/modules/global_roles/spec/plugin_spec_helper.rbdeleted file mode 100644index 8cc209eb997..00000000000--- a/modules/global_roles/spec/plugin_spec_helper.rb+++ /dev/null@@ -1,192 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--module OpenProject- module GlobalRoles- module PluginSpecHelper- def costs_plugin_loaded?- plugin_loaded?('costs')- end-- def plugin_loaded?(name)- Redmine::Plugin.all.detect { |x| x.id == name.to_sym }.present?- end-- def doubled_permissions- [- double('Permission', name: :perm1, project_module: 'Foo'),- double('Permission', name: :perm2, project_module: 'Foo'),- double('Permission', name: :perm3, project_module: 'Foo'),- ]- end-- def mocks_for_member_roles- @role = mock_model Role- allow(Role).to receive(:new).and_return(@role)-- mock_permissions_on @role-- mock_role_find-- @non_mem = mock_model Role- allow(@non_mem).to receive(:permissions).and_return(@non_mem_perm)- allow(Role).to receive(:non_member).and_return(@non_mem)- @non_mem_perm = [:nm_perm1, :nm_perm2]- end-- def mocks_for_global_roles- @role = mock_model GlobalRole- allow(GlobalRole).to receive(:new).and_return(@role)- mock_permissions_on @role- end-- def mock_permissions_on(role)- permissions = doubled_permissions- allow(role).to receive(:setable_permissions).and_return(permissions)- perm4 = double('Permission', name: :perm4, project_module: 'Foo')- allow(role).to receive(:permissions).and_return(permissions << perm4)- end-- def mock_role_find- mock_member_role_find- mock_global_role_find- end-- def mock_member_role_find- @role1 = mock_model Role- @role2 = mock_model Role- @global_role1 = mock_model GlobalRole- @global_role2 = mock_model GlobalRole- @roles = [@role1, @global_role2, @role2, @global_role1]- allow(Role).to receive(:find).and_return(@roles)- allow(Role).to receive(:all).and_return(@roles)- allow(Role).to receive(:order).and_return(@roles)- allow(@roles).to receive(:page).and_return(@roles)- allow(@roles).to receive(:per_page).and_return(@roles)- end-- def mock_global_role_find- @global_role1 = mock_model GlobalRole- @global_role2 = mock_model GlobalRole- @global_roles = [@global_role1, @global_role2]- allow(GlobalRole).to receive(:find).and_return(@global_roles)- allow(GlobalRole).to receive(:all).and_return(@global_roles)- end-- def mocks_for_creating(role_class)- role = mock_model role_class- allow(role_class).to receive(:new).and_return role- allow(role).to receive(:attributes=)- allow(role).to receive(:changed).and_return([])- mock_permissions_on role- role- end-- def disable_flash_sweep- @controller.instance_eval { allow(flash).to receive(:sweep) }- end-- def disable_log_requesting_user- allow(@controller).to receive(:log_requesting_user)- end-- def response_should_render(method, *params)- unless @page- @page ||= double('page')- expect(controller).to receive(:render).with(:update).and_yield(@page)- expect(controller).to receive(:render).with(no_args)- end-- expect(@page).to receive(method).with(*params)- end-- def mock_permissions_for_setable_permissions- @public_perm = mock_permissions('public_perm1', public: true)- @perm1 = mock_permissions('member_perm1')- @perm2 = mock_permissions('member_perm2')- @global_perm = mock_permissions('global_perm1', global: true)-- @perms = [@public_perm, @perm1, @global_perm, @perm2]- allow(OpenProject::AccessControl).to receive(:permissions).and_return(@perms)- allow(OpenProject::AccessControl).to receive(:public_permissions).and_return([@public_perm])- allow(OpenProject::AccessControl).to receive(:global_permissions).and_return([@global_perm])- end-- def mock_global_permissions(permissions)- mapped = permissions.map do |name, options|- mock_permissions(name, options.merge(global: true))- end-- mapped_modules = permissions.map do |_, options|- options[:project_module] || 'Foo'- end.uniq-- allow(OpenProject::AccessControl).to receive(:modules).and_wrap_original do |m, *args|- m.call(*args) + mapped_modules.map { |name| { order: 0, name: name } }- end- allow(OpenProject::AccessControl).to receive(:permissions).and_wrap_original do |m, *args|- m.call(*args) + mapped- end- allow(OpenProject::AccessControl).to receive(:global_permissions).and_wrap_original do |m, *args|- m.call(*args) + mapped- end- end-- def mock_permissions(name, options = {})- ::OpenProject::AccessControl::Permission.new(- name,- { does_not: :matter },- { project_module: 'Foo', public: false, global: false }.merge(options)- )- end-- def create_non_member_role- create_builtin_role 'No member', Role::BUILTIN_NON_MEMBER- end-- def create_anonymous_role- create_builtin_role 'Anonymous', Role::BUILTIN_ANONYMOUS- end-- def create_builtin_role(name, const)- Role.create(name: name, position: 0) do |role|- role.builtin = const- end- end-- def stash_access_control_permissions- @stashed_permissions = OpenProject::AccessControl.permissions.dup- OpenProject::AccessControl.permissions.clear- end-- def restore_access_control_permissions- OpenProject::AccessControl.instance_variable_set(:@permissions, @stashed_permissions)- end- end- end-enddiff --git a/modules/global_roles/spec/views/users/_available_global_roles.html.erb_spec.rb b/modules/global_roles/spec/views/users/_available_global_roles.html.erb_spec.rbdeleted file mode 100644index 818b89c5ed7..00000000000--- a/modules/global_roles/spec/views/users/_available_global_roles.html.erb_spec.rb+++ /dev/null@@ -1,43 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program 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 General Public License for more details.-#-# You should have received a copy of the GNU 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.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'spec_helper'--describe 'users/_available_global_roles' do- let(:user) { FactoryBot.create :user }- let(:global_roles) { FactoryBot.create_list :global_role, 3 }-- it 'links to the principal roles controller using a path, not a URL' do- render partial: 'users/available_global_roles',- locals: { user: user,- global_roles: global_roles }-- expect(response.body).not_to match principal_roles_url- expect(response.body).to match principal_roles_path- end-enddiff --git a/spec/contracts/members/create_contract_spec.rb b/spec/contracts/members/create_contract_spec.rbindex 256638d89a1..b50f772006a 100644--- a/spec/contracts/members/create_contract_spec.rb+++ b/spec/contracts/members/create_contract_spec.rb@@ -48,14 +48,6 @@ describe Members::CreateContract doendend- context 'if the project is nil' do- let(:member_project) { nil }-- it 'is invalid' do- expect_valid(false, project: %i(blank))- end- end-context 'if the principal is a builtin user' dolet(:member_principal) { FactoryBot.build_stubbed(:anonymous) }diff --git a/spec/contracts/members/shared_contract_examples.rb b/spec/contracts/members/shared_contract_examples.rbindex dc0b6c28bb2..88ee8fabb12 100644--- a/spec/contracts/members/shared_contract_examples.rb+++ b/spec/contracts/members/shared_contract_examples.rb@@ -30,7 +30,7 @@ require 'spec_helper'shared_examples_for 'member contract' dolet(:current_user) do- FactoryBot.build_stubbed(:user) do |user|+ FactoryBot.build_stubbed(:user, admin: current_user_admin) do |user|allow(user).to receive(:allowed_to?) do |permission, permission_project|permissions.include?(permission) && member_project == permission_project@@ -41,12 +41,16 @@ shared_examples_for 'member contract' doFactoryBot.build_stubbed(:project)endlet(:member_roles) do- [FactoryBot.build_stubbed(:role)]+ [role]endlet(:member_principal) doFactoryBot.build_stubbed(:user)end+ let(:role) do+ FactoryBot.build_stubbed(:role)+ endlet(:permissions) { [:manage_members] }+ let(:current_user_admin) { false }def expect_valid(valid, symbols = {})expect(contract.validate).to eq(valid)@@ -90,6 +94,44 @@ shared_examples_for 'member contract' doexpect_valid(false, base: %i(error_unauthorized))endend++ context 'if the project is nil (global membership)' do+ let(:member_project) { nil }+ let(:role) do+ FactoryBot.build_stubbed(:global_role)+ end++ context 'if the user is no admin' do+ it 'is invalid' do+ expect_valid(false, project: %i(blank))+ end+ end++ context 'if the user is admin and the role is global' do+ let(:current_user_admin) { true }++ it_behaves_like 'is valid'+ end++ context 'if the role is not a global role' do+ let(:current_user_admin) { true }+ let(:role) do+ FactoryBot.build_stubbed(:role)+ end++ it 'is invalid' do+ expect_valid(false, roles: %i(ungrantable))+ end+ end+ end++ context 'if the project is set to one not being manageable by the user' do+ let(:permissions) { [] }++ it 'is invalid' do+ expect_valid(false, project: %i(invalid))+ end+ endenddescribe 'principal' dodiff --git a/modules/global_roles/spec/factories/global_role_factory.rb b/spec/factories/global_role_factory.rbsimilarity index 100%rename from modules/global_roles/spec/factories/global_role_factory.rbrename to spec/factories/global_role_factory.rbdiff --git a/spec/factories/member_factory.rb b/spec/factories/member_factory.rbindex 30dedadf859..e9aa4c758b1 100644--- a/spec/factories/member_factory.rb+++ b/spec/factories/member_factory.rb@@ -54,4 +54,8 @@ FactoryBot.define domember.principal ||= options.user || FactoryBot.build_stubbed(:user)endend++ factory :global_member, parent: :member do+ project { nil }+ endenddiff --git a/modules/global_roles/spec/features/global_create_project_spec.rb b/spec/features/global_roles/global_create_project_spec.rbsimilarity index 87%rename from modules/global_roles/spec/features/global_create_project_spec.rbrename to spec/features/global_roles/global_create_project_spec.rbindex 183d889e627..afcf10fcfee 100644--- a/modules/global_roles/spec/features/global_create_project_spec.rb+++ b/spec/features/global_roles/global_create_project_spec.rb@@ -26,7 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#++-require_relative '../spec_helper'+require 'spec_helper'describe 'Global role: Global Create project', type: :feature, js: true dolet(:user) { FactoryBot.create(:admin) }@@ -64,18 +64,17 @@ describe 'Global role: Global Create project', type: :feature, js: true doenddescribe 'Create Project displayed to user' do- # Given there is a global role "Global"let!(:global_role) { FactoryBot.create(:global_role, name: 'Global', permissions: %i[add_project]) }- let!(:member_role) { FactoryBot.create(:role, permissions: %i[]) }- # And the global role "Global" may have the following rights:- # And the user "bob" has the global role "Global"+let(:user) { FactoryBot.create :user }- let!(:principal_role) { FactoryBot.create(:principal_role, principal: user, role: global_role) }- # When I am already logged in as "bob"+ let!(:global_member) do+ FactoryBot.create(:global_member,+ principal: user,+ roles: [global_role])+ end+it 'does show the global permission' do- # And I go to the overall projects pagevisit projects_path- # Then I should see "Project" within ".toolbar-itemsexpect(page).to have_selector('.button.-alt-highlight', text: 'Project')# Can add new projectdiff --git a/modules/global_roles/spec/features/global_role_assignment_spec.rb b/spec/features/global_roles/global_role_assignment_spec.rbsimilarity index 81%rename from modules/global_roles/spec/features/global_role_assignment_spec.rbrename to spec/features/global_roles/global_role_assignment_spec.rbindex 25d180bf4a4..f6c61407a8a 100644--- a/modules/global_roles/spec/features/global_role_assignment_spec.rb+++ b/spec/features/global_roles/global_role_assignment_spec.rb@@ -26,40 +26,34 @@# See docs/COPYRIGHT.rdoc for more details.#++-require_relative '../spec_helper'+require 'spec_helper'+require_relative './mock_global_permissions'describe 'Global role: Global role assignment', type: :feature, js: true dobefore dologin_as(current_user)end- # @javascriptdescribe 'Going to the global role assignment page' do- # Given there is the global permission "global1" of the module "global"- # And there is the global permission "global2" of the module "global"before domock_global_permissions [['global1', project_module: :global], ['global2', project_module: :global]]end- # And there is a global role "global_role1"let!(:global_role1) { FactoryBot.create :global_role, name: 'global_role1', permissions: %i[global1] }- # And there is a global role "global_role2"let!(:global_role2) { FactoryBot.create :global_role, name: 'global_role2', permissions: %i[global2] }- # And there is 1 User with:- # | Login | bob |- # | Firstname | Bob |- # | Lastname | Bobbit |- # And the user "bob" has the global role "global_role1"+let!(:user) { FactoryBot.create :user }- let!(:principal_role) { FactoryBot.create(:principal_role, principal: user, role: global_role1) }- # And I am already admin+ let!(:global_member) do+ FactoryBot.create(:global_member,+ principal: user,+ roles: [global_role1])+ end+let(:current_user) { FactoryBot.create :admin }it 'allows global roles management' do- # When I go to the edit page of the user called "bob"visit edit_user_path user- # And I click on "Global Roles"click_link 'Global Roles'- # Then I should see "global_role1" within "#table_principal_roles"+page.within('#table_principal_roles') doexpect(page).to have_text 'global_role1'end@@ -88,7 +82,7 @@ describe 'Global role: Global role assignment', type: :feature, js: true doend# And I delete the assigned role "global_role"- page.within("#principal_role-#{principal_role.id}") do+ page.within("#assigned_global_role_#{global_role1.id}") dopage.find('.buttons a.icon-delete').clickenddiff --git a/modules/global_roles/spec/features/global_role_crud_spec.rb b/spec/features/global_roles/global_role_crud_spec.rbsimilarity index 97%rename from modules/global_roles/spec/features/global_role_crud_spec.rbrename to spec/features/global_roles/global_role_crud_spec.rbindex 8ff85d91f71..995c9c7da0f 100644--- a/modules/global_roles/spec/features/global_role_crud_spec.rb+++ b/spec/features/global_roles/global_role_crud_spec.rb@@ -26,7 +26,8 @@# See docs/COPYRIGHT.rdoc for more details.#++-require_relative '../spec_helper'+require 'spec_helper'+require_relative './mock_global_permissions'describe 'Global role: Global role CRUD', type: :feature, js: true do# Scenario: Global Role creationdiff --git a/modules/global_roles/spec/features/member_roles_spec.rb b/spec/features/global_roles/member_roles_spec.rbsimilarity index 98%rename from modules/global_roles/spec/features/member_roles_spec.rbrename to spec/features/global_roles/member_roles_spec.rbindex 710399c2788..c2e80542424 100644--- a/modules/global_roles/spec/features/member_roles_spec.rb+++ b/spec/features/global_roles/member_roles_spec.rb@@ -26,7 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#++-require_relative '../spec_helper'+require 'spec_helper'describe 'Global role: Unchanged Member Roles', type: :feature, js: true dolet(:admin) { FactoryBot.create(:admin) }diff --git a/spec/features/global_roles/mock_global_permissions.rb b/spec/features/global_roles/mock_global_permissions.rbnew file mode 100644index 00000000000..04b3c4aa9b9--- /dev/null+++ b/spec/features/global_roles/mock_global_permissions.rb@@ -0,0 +1,27 @@+def mock_global_permissions(permissions)+ mapped = permissions.map do |name, options|+ mock_permissions(name, options.merge(global: true))+ end++ mapped_modules = permissions.map do |_, options|+ options[:project_module] || 'Foo'+ end.uniq++ allow(OpenProject::AccessControl).to receive(:modules).and_wrap_original do |m, *args|+ m.call(*args) + mapped_modules.map { |name| { order: 0, name: name } }+ end+ allow(OpenProject::AccessControl).to receive(:permissions).and_wrap_original do |m, *args|+ m.call(*args) + mapped+ end+ allow(OpenProject::AccessControl).to receive(:global_permissions).and_wrap_original do |m, *args|+ m.call(*args) + mapped+ end+end++def mock_permissions(name, options = {})+ ::OpenProject::AccessControl::Permission.new(+ name,+ { does_not: :matter },+ { project_module: 'Foo', public: false, global: false }.merge(options)+ )+enddiff --git a/modules/global_roles/spec/features/no_module_spec.rb b/spec/features/global_roles/no_module_spec.rbsimilarity index 96%rename from modules/global_roles/spec/features/no_module_spec.rbrename to spec/features/global_roles/no_module_spec.rbindex 73796f8118f..38b960b3bde 100644--- a/modules/global_roles/spec/features/no_module_spec.rb+++ b/spec/features/global_roles/no_module_spec.rb@@ -26,7 +26,8 @@# See docs/COPYRIGHT.rdoc for more details.#++-require_relative '../spec_helper'+require 'spec_helper'+require_relative './mock_global_permissions'describe 'Global role: No module', type: :feature, js: true dolet(:admin) { FactoryBot.create(:admin) }diff --git a/spec/features/projects/project_status_administration_spec.rb b/spec/features/projects/project_status_administration_spec.rbindex e27be61170c..29983818b98 100644--- a/spec/features/projects/project_status_administration_spec.rb+++ b/spec/features/projects/project_status_administration_spec.rb@@ -30,10 +30,10 @@ require 'spec_helper'describe 'Projects status administration', type: :feature, js: true dolet(:current_user) do- FactoryBot.create(:user).tap do |user|- FactoryBot.create(:principal_role,- principal: user,- role: FactoryBot.create(:global_role, permissions: global_permissions))+ FactoryBot.create(:user).tap do |u|+ FactoryBot.create(:global_member,+ principal: u,+ roles: [FactoryBot.create(:global_role, permissions: global_permissions)])endendlet(:global_permissions) { [:add_project] }diff --git a/spec/lib/api/v3/memberships/membership_representer_rendering_spec.rb b/spec/lib/api/v3/memberships/membership_representer_rendering_spec.rbindex 9b852b63f40..9350ff23ef6 100644--- a/spec/lib/api/v3/memberships/membership_representer_rendering_spec.rb+++ b/spec/lib/api/v3/memberships/membership_representer_rendering_spec.rb@@ -35,8 +35,7 @@ describe ::API::V3::Memberships::MembershipRepresenter, 'rendering' doFactoryBot.build_stubbed(:member,member_roles: [member_role1, member_role2, member_role2, marked_member_role],principal: principal,- project: project,- created_on: Time.current)+ project: project)endlet(:project) { FactoryBot.build_stubbed(:project) }let(:roles) { [role1, role2] }@@ -128,6 +127,14 @@ describe ::API::V3::Memberships::MembershipRepresenter, 'rendering' dolet(:href) { api_v3_paths.project(project.id) }let(:title) { project.name }end++ context 'for a global member' do+ let(:project) { nil }++ it_behaves_like 'has an empty link' do+ let(:link) { 'project' }+ end+ endenddescribe 'principal' do@@ -182,10 +189,17 @@ describe ::API::V3::Memberships::MembershipRepresenter, 'rendering' dodescribe 'createdAt' doit_behaves_like 'has UTC ISO 8601 date and time' do- let(:date) { member.created_on }+ let(:date) { member.created_at }let(:json_path) { 'createdAt' }endend++ describe 'updatedAt' do+ it_behaves_like 'has UTC ISO 8601 date and time' do+ let(:date) { member.updated_at }+ let(:json_path) { 'updatedAt' }+ end+ endenddescribe '_embedded' do@@ -201,6 +215,15 @@ describe ::API::V3::Memberships::MembershipRepresenter, 'rendering' do.to be_json_eql(project.name.to_json).at_path("#{embedded_path}/name")end++ context 'for a global member' do+ let(:project) { nil }++ it 'has no project embedded' do+ is_expected+ .not_to have_json_path(embedded_path)+ end+ endenddescribe 'principal' dodiff --git a/spec/lib/api/v3/memberships/schemas/membership_schema_representer_spec.rb b/spec/lib/api/v3/memberships/schemas/membership_schema_representer_spec.rbindex 55e2a04f315..f1b346f07ec 100644--- a/spec/lib/api/v3/memberships/schemas/membership_schema_representer_spec.rb+++ b/spec/lib/api/v3/memberships/schemas/membership_schema_representer_spec.rb@@ -109,6 +109,17 @@ describe ::API::V3::Memberships::Schemas::MembershipSchemaRepresenter doendend+ describe 'updatedAt' do+ let(:path) { 'updatedAt' }++ it_behaves_like 'has basic schema properties' do+ let(:type) { 'DateTime' }+ let(:name) { Version.human_attribute_name('updated_at') }+ let(:required) { true }+ let(:writable) { false }+ end+ end+describe 'project' dolet(:path) { 'project' }@@ -116,7 +127,7 @@ describe ::API::V3::Memberships::Schemas::MembershipSchemaRepresenter doit_behaves_like 'has basic schema properties' dolet(:type) { 'Project' }let(:name) { Member.human_attribute_name('project') }- let(:required) { true }+ let(:required) { false }let(:writable) { true }end@@ -157,7 +168,7 @@ describe ::API::V3::Memberships::Schemas::MembershipSchemaRepresenter doit_behaves_like 'has basic schema properties' dolet(:type) { 'Project' }let(:name) { Version.human_attribute_name('project') }- let(:required) { true }+ let(:required) { false }let(:writable) { false }end@@ -249,9 +260,33 @@ describe ::API::V3::Memberships::Schemas::MembershipSchemaRepresenter docontext 'if embedding' dolet(:embedded) { true }- it_behaves_like 'links to allowed values via collection link' do- let(:href) do- api_v3_paths.path_for(:roles, filters: [{ unit: { operator: '=', values: ['project'] } }])+ context 'for a new record' do+ it_behaves_like 'links to allowed values via collection link' do+ let(:href) do+ api_v3_paths.path_for(:roles)+ end+ end+ end++ context 'for a persisted record without project (global)' do+ let(:assigned_project) { nil }+ let(:new_record) { false }++ it_behaves_like 'links to allowed values via collection link' do+ let(:href) do+ api_v3_paths.path_for(:roles, filters: [{ unit: { operator: '=', values: ['system'] } }])+ end+ end+ end++ context 'for a persisted record with project (global)' do+ let(:assigned_project) { project }+ let(:new_record) { false }++ it_behaves_like 'links to allowed values via collection link' do+ let(:href) do+ api_v3_paths.path_for(:roles, filters: [{ unit: { operator: '=', values: ['project'] } }])+ endendendenddiff --git a/spec/lib/open_project/access_control/permission_spec.rb b/spec/lib/open_project/access_control/permission_spec.rbindex c748d41fbb5..c68e3f5d2a7 100644--- a/spec/lib/open_project/access_control/permission_spec.rb+++ b/spec/lib/open_project/access_control/permission_spec.rb@@ -48,4 +48,28 @@ describe OpenProject::AccessControl::Permission doendendend++ describe '#global?' do+ describe 'setting global permission' do+ before { @permission = OpenProject::AccessControl::Permission.new(:perm, { cont: [:action] }, { global: true }) }++ it { expect(@permission.global?).to be_truthy }+ end++ describe 'setting non global permission' do+ before { @permission = OpenProject::AccessControl::Permission.new :perm, { cont: [:action] }, { global: false } }++ it 'is false' do+ expect(@permission.global?).to be_falsey+ end+ end++ describe 'not specifying -> default' do+ before { @permission = OpenProject::AccessControl::Permission.new :perm, { cont: [:action] }, {} }++ it 'is false' do+ expect(@permission.global?).to be_falsey+ end+ end+ endenddiff --git a/spec/lib/open_project/access_control_spec.rb b/spec/lib/open_project/access_control_spec.rbindex 5cb5383095a..26a732b5e66 100644--- a/spec/lib/open_project/access_control_spec.rb+++ b/spec/lib/open_project/access_control_spec.rb@@ -29,6 +29,39 @@require 'spec_helper'describe OpenProject::AccessControl do++ def stash_access_control_permissions+ @stashed_permissions = OpenProject::AccessControl.permissions.dup+ OpenProject::AccessControl.clear_caches+ OpenProject::AccessControl.permissions.clear+ end++ def restore_access_control_permissions+ OpenProject::AccessControl.instance_variable_set(:@permissions, @stashed_permissions)+ OpenProject::AccessControl.clear_caches+ end++ def setup_global_permissions+ OpenProject::AccessControl.map do |map|+ map.permission :proj0, { dont: :care }, require: :member+ map.permission :global0, { dont: :care }, global: true+ map.permission :proj1, { dont: :care }++ map.project_module :global_module do |mod|+ mod.permission :global1, { dont: :care }, global: true+ end++ map.project_module :project_module do |mod|+ mod.permission :proj2, { dont: :care }+ end++ map.project_module :mixed_module do |mod|+ mod.permission :proj3, { dont: :care }+ mod.permission :global2, { dont: :care }, global: true+ end+ end+ end+describe '.remove_modules_permissions' dolet!(:all_former_permissions) { OpenProject::AccessControl.permissions }let!(:former_repository_permissions) do@@ -143,4 +176,37 @@ describe OpenProject::AccessControl doendendend++ describe '#global_permissions' do+ before do+ stash_access_control_permissions++ setup_global_permissions+ end++ after do+ restore_access_control_permissions+ end++ it { expect(OpenProject::AccessControl.global_permissions.size).to eq(3) }+ it { expect(OpenProject::AccessControl.global_permissions.collect(&:name)).to include(:global0) }+ it { expect(OpenProject::AccessControl.global_permissions.collect(&:name)).to include(:global1) }+ it { expect(OpenProject::AccessControl.global_permissions.collect(&:name)).to include(:global2) }+ end++ describe '#available_project_modules' do+ before do+ stash_access_control_permissions++ setup_global_permissions+ end++ after do+ restore_access_control_permissions+ end++ it { expect(OpenProject::AccessControl.available_project_modules.include?(:global_module)).to be_falsey }+ it { expect(OpenProject::AccessControl.available_project_modules.include?(:global_module)).to be_falsey }+ it { expect(OpenProject::AccessControl.available_project_modules.include?(:mixed_module)).to be_truthy }+ endenddiff --git a/modules/global_roles/spec/models/global_role_spec.rb b/spec/models/global_role_spec.rbsimilarity index 73%rename from modules/global_roles/spec/models/global_role_spec.rbrename to spec/models/global_role_spec.rbindex 569ab8a0cae..ca9016a3609 100644--- a/modules/global_roles/spec/models/global_role_spec.rb+++ b/spec/models/global_role_spec.rb@@ -26,13 +26,11 @@# See docs/COPYRIGHT.rdoc for more details.#++-require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')+require 'spec_helper'describe GlobalRole, type: :model dobefore { GlobalRole.create name: 'globalrole', permissions: ['permissions'] }- it { is_expected.to have_many :principals }- it { is_expected.to have_many :principal_roles }it { is_expected.to validate_presence_of :name }it { is_expected.to validate_uniqueness_of :name }it { is_expected.to validate_length_of(:name).is_at_most(30) }@@ -50,14 +48,6 @@ describe GlobalRole, type: :model dodescribe 'instance methods' dobefore do@role = GlobalRole.new-- if costs_plugin_loaded?- @perm = Object.new- allow(OpenProject::AccessControl).to receive(:permission).and_return @perm- allow(@perm).to receive(:inherited_by).and_return([])- allow(@perm).to receive(:name).and_return(:perm)- allow(@perm).to receive(:inherits).and_return([])- endenddescribe 'WITH no attributes set' do@@ -109,30 +99,5 @@ describe GlobalRole, type: :model doit { expect(@role.to_s).to eql('name') }endend-- describe '#destroy' do- before { @role = GlobalRole.create name: 'global' }-- it { @role.destroy }- end-- describe '#assignable' do- it { expect(@role.assignable).to be_falsey }- end-- describe '#assignable=' do- it { expect { @role.assignable = true }.to raise_error ArgumentError }- it { expect { @role.assignable = false }.not_to raise_error }- end-- describe '#assignable_to?' do- before(:each) do- @role = FactoryBot.build(:global_role)- @user = FactoryBot.build(:user)- end- it 'always true global roles for now' do- expect(@role.assignable_to?(@user)).to be_truthy- end- endendenddiff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rbindex 1a4f54de563..431dd50d369 100644--- a/spec/models/member_spec.rb+++ b/spec/models/member_spec.rb@@ -31,8 +31,38 @@ require 'spec_helper'describe Member, type: :model dolet(:user) { FactoryBot.create(:user) }let(:role) { FactoryBot.create(:role) }+ let(:project) { FactoryBot.create(:project) }let(:second_role) { FactoryBot.create(:role) }let(:member) { FactoryBot.create(:member, user: user, roles: [role]) }+ let(:new_member) { FactoryBot.build(:member, user: user, roles: [role], project: project) }++ describe '#project' do+ context 'with a project' do+ it 'is valid' do+ expect(new_member)+ .to be_valid+ end+ end++ context 'without a project (global)' do+ let(:project) { nil }++ it 'is valid' do+ expect(new_member)+ .to be_valid+ end+ end++ context 'without a project (global) but with a global membership already existing' do+ let(:project) { nil }+ let!(:existing_member) { FactoryBot.create(:member, user: user, roles: [role], project: project) }++ it 'is invalid' do+ expect(new_member)+ .to be_invalid+ end+ end+ enddescribe '#add_role' dobefore dodiff --git a/modules/global_roles/spec/factories/principal_role_factory.rb b/spec/models/queries/members/filters/created_at_filter_spec.rbsimilarity index 79%rename from modules/global_roles/spec/factories/principal_role_factory.rbrename to spec/models/queries/members/filters/created_at_filter_spec.rbindex 86eb37a6a21..ea9723adcde 100644--- a/modules/global_roles/spec/factories/principal_role_factory.rb+++ b/spec/models/queries/members/filters/created_at_filter_spec.rb@@ -1,3 +1,5 @@+#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -26,14 +28,14 @@# See docs/COPYRIGHT.rdoc for more details.#++-FactoryBot.define do- factory :principal_role do |pr|- pr.association :role, :factory => :global_role- pr.association :principal, :factory => :user- end-end+require 'spec_helper'-FactoryBot.define do- factory :empty_principal_role, :class => PrincipalRole do |pr|+describe Queries::Members::Filters::CreatedAtFilter, type: :model do+ it_behaves_like 'basic query filter' do+ let(:class_key) { :created_at }+ let(:type) { :datetime_past }+ let(:model) { Member }+ let(:attribute) { :created_at }+ let(:values) { ['3'] }endenddiff --git a/modules/global_roles/app/models/principal_role.rb b/spec/models/queries/members/filters/updated_at_filter_spec.rbsimilarity index 79%rename from modules/global_roles/app/models/principal_role.rbrename to spec/models/queries/members/filters/updated_at_filter_spec.rbindex 9f9a6c69157..cbddb7db5c6 100644--- a/modules/global_roles/app/models/principal_role.rb+++ b/spec/models/queries/members/filters/updated_at_filter_spec.rb@@ -1,3 +1,5 @@+#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -26,18 +28,14 @@# See docs/COPYRIGHT.rdoc for more details.#++-class PrincipalRole < ApplicationRecord- belongs_to :principal- belongs_to :role- validate :validate_assignable-- def validate_assignable- add_error_can_not_be_assigned unless role.assignable_to?(principal)- end-- private+require 'spec_helper'- def add_error_can_not_be_assigned- errors[:base] << I18n.t(:error_can_not_be_assigned)+describe Queries::Members::Filters::UpdatedAtFilter, type: :model do+ it_behaves_like 'basic query filter' do+ let(:class_key) { :updated_at }+ let(:type) { :datetime_past }+ let(:model) { Member }+ let(:attribute) { :updated_at }+ let(:values) { ['3'] }endenddiff --git a/spec/models/users/allowed_to_spec.rb b/spec/models/users/allowed_to_spec.rbindex f81d5ef748f..0782c8735a3 100644--- a/spec/models/users/allowed_to_spec.rb+++ b/spec/models/users/allowed_to_spec.rb@@ -46,6 +46,13 @@ describe User, 'allowed_to?' doroles: [role2],principal: user)}+ let(:global_permission) { OpenProject::AccessControl.permissions.find { |p| p.global? } }+ let(:global_role) { FactoryBot.build(:global_role, permissions: [global_permission.name]) }+ let(:global_member) do+ FactoryBot.build(:global_member,+ principal: user,+ roles: [global_role])+ endbefore doanonymous_role.save!@@ -403,6 +410,23 @@ describe User, 'allowed_to?' doendend+ context "w/o the user being member in a project+ w/ the user having the global role+ w/ the global role having the necessary permission" do++ before do+ project.save!++ global_role.save!++ global_member.save!+ end++ it 'is false' do+ expect(user.allowed_to?(global_permission.name, project)).to be_falsey+ end+ end+context 'w/ requesting a controller and actionw/ the user being allowed the action' dolet(:permission) { :view_wiki_pages }@@ -535,6 +559,49 @@ describe User, 'allowed_to?' doendend+ context "w/o the user being member in a project+ w/ the user having a global role+ w/ the global role having the necessary permission" do+ before do+ global_role.save!++ global_member.save!+ end++ it 'is true' do+ expect(user.allowed_to?(global_permission.name, nil, global: true)).to be_truthy+ end+ end++ context "w/o the user being member in a project+ w/ the user having a global role+ w/o the global role having the necessary permission" do++ before do+ global_role.permissions = []+ global_role.save!++ global_member.save!+ end++ it 'is false' do+ expect(user.allowed_to?(global_permission.name, nil, global: true)).to be_falsey+ end+ end++ context "w/o the user being member in a project+ w/o the user having the global role+ w/ the global role having the necessary permission" do++ before do+ global_role.save!+ end++ it 'is false' do+ expect(user.allowed_to?(global_permission.name, nil, global: true)).to be_falsey+ end+ end+context 'w/ the user being anonymousw/ anonymous being allowed the action' dobefore dodiff --git a/spec/requests/api/v3/membership_resources_spec.rb b/spec/requests/api/v3/membership_resources_spec.rbindex 3d3fc8bca84..2eb4baacb93 100644--- a/spec/requests/api/v3/membership_resources_spec.rb+++ b/spec/requests/api/v3/membership_resources_spec.rb@@ -29,13 +29,16 @@require 'spec_helper'require 'rack/test'-describe 'API v3 memberhips resource', type: :request, content_type: :json do+describe 'API v3 memberships resource', type: :request, content_type: :json doinclude Rack::Test::Methodsinclude API::V3::Utilities::PathHelperlet(:current_user) doFactoryBot.create(:user)end+ let(:admin) do+ FactoryBot.create(:admin)+ endlet(:own_member) doFactoryBot.create(:member,roles: [FactoryBot.create(:role, permissions: permissions)],@@ -45,6 +48,7 @@ describe 'API v3 memberhips resource', type: :request, content_type: :json dolet(:permissions) { %i[view_members manage_members] }let(:project) { FactoryBot.create(:project) }let(:other_role) { FactoryBot.create(:role) }+ let(:global_role) { FactoryBot.create(:global_role) }let(:other_user) { FactoryBot.create(:user) }let(:other_member) doFactoryBot.create(:member,@@ -56,11 +60,15 @@ describe 'API v3 memberhips resource', type: :request, content_type: :json doFactoryBot.create(:member,roles: [FactoryBot.create(:role)])end+ let(:global_member) do+ FactoryBot.create(:global_member,+ roles: [global_role])+ endsubject(:response) { last_response }describe 'GET api/v3/memberships' do- let(:members) { [own_member, other_member, invisible_member] }+ let(:members) { [own_member, other_member, invisible_member, global_member] }before domembers@@ -98,6 +106,41 @@ describe 'API v3 memberhips resource', type: :request, content_type: :json doendend+ context 'as an admin' do+ let(:current_user) { admin }++ it 'responds 200 OK' do+ expect(subject.status).to eq(200)+ end++ it 'returns a collection of memberships containing only the visible ones' do+ expect(subject.body)+ .to be_json_eql('Collection'.to_json)+ .at_path('_type')++ # the one membership stems from the membership the user has himself+ expect(subject.body)+ .to be_json_eql('4')+ .at_path('total')++ expect(subject.body)+ .to be_json_eql(own_member.id.to_json)+ .at_path('_embedded/elements/0/id')++ expect(subject.body)+ .to be_json_eql(other_member.id.to_json)+ .at_path('_embedded/elements/1/id')++ expect(subject.body)+ .to be_json_eql(invisible_member.id.to_json)+ .at_path('_embedded/elements/2/id')++ expect(subject.body)+ .to be_json_eql(global_member.id.to_json)+ .at_path('_embedded/elements/3/id')+ end+ end+context 'with pageSize, offset and sortBy' dolet(:path) { "#{api_v3_paths.path_for(:memberships, sort_by: [%i(id asc)])}&pageSize=1&offset=2" }@@ -230,6 +273,28 @@ describe 'API v3 memberhips resource', type: :request, content_type: :json doendend+ context 'with the outdated created_on sort by (renamed ot created_at' do+ let(:path) { "#{api_v3_paths.path_for(:memberships, sort_by: [%i(created_on desc)])}&pageSize=1&offset=2" }++ it 'is still supported and returns a slice of the visible memberships' do+ expect(subject.body)+ .to be_json_eql('Collection'.to_json)+ .at_path('_type')++ expect(subject.body)+ .to be_json_eql('2')+ .at_path('total')++ expect(subject.body)+ .to be_json_eql('1')+ .at_path('count')++ expect(subject.body)+ .to be_json_eql(own_member.id.to_json)+ .at_path('_embedded/elements/0/id')+ end+ end+context 'invalid filter' dolet(:members) { [own_member] }@@ -287,6 +352,8 @@ describe 'API v3 memberhips resource', type: :request, content_type: :json doendshared_examples_for 'successful member creation' do+ let(:role) { defined?(expected_role) ? expected_role : other_role }+it 'responds with 201' doexpect(last_response.status).to eq(201)end@@ -301,9 +368,11 @@ describe 'API v3 memberhips resource', type: :request, content_type: :json do.to be_json_eql('Membership'.to_json).at_path('_type')- expect(last_response.body)- .to be_json_eql(api_v3_paths.project(project.id).to_json)- .at_path('_links/project/href')+ if project+ expect(last_response.body)+ .to be_json_eql(api_v3_paths.project(project.id).to_json)+ .at_path('_links/project/href')+ endexpect(last_response.body).to be_json_eql(principal_path.to_json)@@ -314,7 +383,7 @@ describe 'API v3 memberhips resource', type: :request, content_type: :json do.at_path('_links/roles')expect(last_response.body)- .to be_json_eql(api_v3_paths.role(other_role.id).to_json)+ .to be_json_eql(api_v3_paths.role(role.id).to_json).at_path('_links/roles/0/href')endend@@ -346,6 +415,42 @@ describe 'API v3 memberhips resource', type: :request, content_type: :json doendend+ context 'for a global membership' do+ let(:expected_role) { global_role }+ let(:body) do+ {+ project: {+ href: nil+ },+ principal: {+ href: principal_path+ },+ roles: [+ {+ href: api_v3_paths.role(global_role.id)+ }+ ]+ }.to_json+ end+ let(:project) { nil }++ context 'as an admin' do+ let(:current_user) { admin }++ it_behaves_like 'successful member creation'+ end++ context 'as a non admin' do+ it 'responds with 422 and explains the error' do+ expect(last_response.status).to eq(422)++ expect(last_response.body)+ .to be_json_eql("Project can't be blank.".to_json)+ .at_path('message')+ end+ end+ end+context 'if providing an already taken user' dolet(:body) do{@@ -497,6 +602,7 @@ describe 'API v3 memberhips resource', type: :request, content_type: :json doendlet(:members) { [own_member, other_member] }+ let!(:other_member_updated_at) { other_member.updated_at }before domembers@@ -511,11 +617,17 @@ describe 'API v3 memberhips resource', type: :request, content_type: :json doendit 'updates the member' do- expect(other_member.roles.reload)+ other_member.reload++ expect(other_member.roles).to match_array [another_role]++ # Assigning a new role also updates the member+ expect(other_member.updated_at > other_member_updated_at )+ .to be_truthyend- it 'returns the updated version' do+ it 'returns the updated membership' doexpect(last_response.body).to be_json_eql('Membership'.to_json).at_path('_type')diff --git a/spec/requests/api/v3/memberships/create_form_resource_spec.rb b/spec/requests/api/v3/memberships/create_form_resource_spec.rbindex d0997570858..6009361f49a 100644--- a/spec/requests/api/v3/memberships/create_form_resource_spec.rb+++ b/spec/requests/api/v3/memberships/create_form_resource_spec.rb@@ -74,7 +74,7 @@ describe ::API::V3::Memberships::CreateFormAPI, content_type: :json docontext 'with empty parameters' doit 'has 4 validation errors' do- # There are 4 validation errors instead of 3 with two duplicating each other+ # There are 4 validation errors instead of 2 with two duplicating each otherexpect(subject.body).to have_json_size(4).at_path('_embedded/validationErrors')end@@ -82,14 +82,14 @@ describe ::API::V3::Memberships::CreateFormAPI, content_type: :json doexpect(subject.body).to have_json_path('_embedded/validationErrors/principal')end- it 'has a validation error on project' do- expect(subject.body).to have_json_path('_embedded/validationErrors/project')- end-it 'has a validation error on roles' doexpect(subject.body).to have_json_path('_embedded/validationErrors/roles')end+ it 'has a validation error on project' do+ expect(subject.body).to have_json_path('_embedded/validationErrors/project')+ end+it 'has no commit link' doexpect(subject.body).not_to have_json_path('_links/commit')diff --git a/spec/requests/api/v3/project_resource_spec.rb b/spec/requests/api/v3/project_resource_spec.rbindex 2bacea5f97f..113110c9829 100644--- a/spec/requests/api/v3/project_resource_spec.rb+++ b/spec/requests/api/v3/project_resource_spec.rb@@ -303,7 +303,9 @@ describe 'API v3 Project resource', type: :request, content_type: :json dodescribe '#post /projects' dolet(:current_user) doFactoryBot.create(:user).tap do |u|- u.global_roles << global_role+ FactoryBot.create(:global_member,+ principal: u,+ roles: [global_role])endendlet(:global_role) dodiff --git a/spec/requests/api/v3/projects/available_parents_resource_spec.rb b/spec/requests/api/v3/projects/available_parents_resource_spec.rbindex 2b59a28b3a6..d19bef7a7e7 100644--- a/spec/requests/api/v3/projects/available_parents_resource_spec.rb+++ b/spec/requests/api/v3/projects/available_parents_resource_spec.rb@@ -35,7 +35,9 @@ describe 'API v3 Project available parents resource', type: :request, content_tylet!(:current_user) doFactoryBot.create(:user, member_in_project: project, member_with_permissions: permissions).tap do |u|- u.global_roles << FactoryBot.create(:global_role, permissions: global_permissions)+ FactoryBot.create(:global_member,+ principal: u,+ roles: [FactoryBot.create(:global_role, permissions: global_permissions)])endendlet!(:project_with_add_suproject_permission) dodiff --git a/spec/requests/api/v3/projects/create_form_resource_spec.rb b/spec/requests/api/v3/projects/create_form_resource_spec.rbindex 9049888faf7..c09f42fe300 100644--- a/spec/requests/api/v3/projects/create_form_resource_spec.rb+++ b/spec/requests/api/v3/projects/create_form_resource_spec.rb@@ -36,7 +36,9 @@ describe ::API::V3::Projects::CreateFormAPI, content_type: :json dolet(:current_user) doFactoryBot.create(:user).tap do |u|- u.global_roles << global_role+ FactoryBot.create(:global_member,+ principal: u,+ roles: [global_role])endendlet(:global_role) dodiff --git a/spec/seeders/demo_data_seeder_spec.rb b/spec/seeders/demo_data_seeder_spec.rbindex a0c11b92ab2..7a78bb7fbd5 100644--- a/spec/seeders/demo_data_seeder_spec.rb+++ b/spec/seeders/demo_data_seeder_spec.rb@@ -44,6 +44,8 @@ describe 'seeds', :with_clean_fixture doexpect(Query.where.not(hidden: true).count).to eq 7expect(Query.count).to eq 25expect(Projects::Status.count).to eq 2+ expect(Role.where(type: 'Role').count).to eq 5+ expect(GlobalRole.count).to eq 1perform_enqueued_jobsdiff --git a/spec/services/authorization/user_global_roles_query_spec.rb b/spec/services/authorization/user_global_roles_query_spec.rbindex 531c78140d0..4a268f0e7d2 100644--- a/spec/services/authorization/user_global_roles_query_spec.rb+++ b/spec/services/authorization/user_global_roles_query_spec.rb@@ -48,6 +48,16 @@ describe Authorization::UserGlobalRolesQuery doroles: [role2],principal: user)}+ let(:global_permission) { OpenProject::AccessControl.permissions.find { |p| p.global? } }+ let(:global_role) do+ FactoryBot.build(:global_role,+ permissions: [global_permission.name])+ end+ let(:global_member) do+ FactoryBot.build(:global_member,+ principal: user,+ roles: [global_role])+ enddescribe '.query' dobefore do@@ -92,5 +102,26 @@ describe Authorization::UserGlobalRolesQuery doexpect(described_class.query(anonymous)).to match_array [anonymous_role]endend++ context 'w/ the user having a global role' do+ before do+ global_member.save!+ end++ it 'is the global role and non member role' do+ expect(described_class.query(user)).to match_array [global_role, non_member]+ end+ end++ context 'w/ the user having a global role and a member role' do+ before do+ member.save!+ global_member.save!+ end++ it 'is the global role and non member role' do+ expect(described_class.query(user)).to match_array [global_role, role, non_member]+ end+ endendenddiff --git a/spec/services/members/set_attributes_service_spec.rb b/spec/services/members/set_attributes_service_spec.rbindex 56f3a1f7440..7e01f6cdea0 100644--- a/spec/services/members/set_attributes_service_spec.rb+++ b/spec/services/members/set_attributes_service_spec.rb@@ -111,7 +111,10 @@ describe Members::SetAttributesService, type: :model docontext 'with a persisted record' dolet(:member) do- FactoryBot.build_stubbed(:member, roles: [first_role, second_role])+ FactoryBot.build_stubbed(:member, roles: [first_role, second_role]).tap do |m|+ allow(m)+ .to receive(:touch)+ endendit 'adds the new role' dodiff --git a/spec_legacy/fixtures/members.yml b/spec_legacy/fixtures/members.ymlindex 9ed925d3bc4..f16617812f2 100644--- a/spec_legacy/fixtures/members.yml+++ b/spec_legacy/fixtures/members.yml@@ -28,63 +28,73 @@---members_001:- created_on: 2006-07-19 19:35:33 +02:00+ created_at: 2006-07-19 19:35:33 +02:00+ updated_at: 2006-07-19 19:35:33 +02:00project_id: 1id: 1user_id: 2mail_notification: truemembers_002:- created_on: 2006-07-19 19:35:36 +02:00+ created_at: 2006-07-19 19:35:36 +02:00+ updated_at: 2006-07-19 19:35:36 +02:00project_id: 1id: 2user_id: 3mail_notification: truemembers_003:- created_on: 2006-07-19 19:35:36 +02:00+ created_at: 2006-07-19 19:35:36 +02:00+ updated_at: 2006-07-19 19:35:36 +02:00project_id: 2id: 3user_id: 2mail_notification: truemembers_004:id: 4- created_on: 2006-07-19 19:35:36 +02:00+ created_at: 2006-07-19 19:35:36 +02:00+ updated_at: 2006-07-19 19:35:36 +02:00project_id: 1# Locked useruser_id: 5mail_notification: truemembers_005:id: 5- created_on: 2006-07-19 19:35:33 +02:00+ created_at: 2006-07-19 19:35:33 +02:00+ updated_at: 2006-07-19 19:35:33 +02:00project_id: 5user_id: 2mail_notification: truemembers_006:id: 6- created_on: 2006-07-19 19:35:33 +02:00+ created_at: 2006-07-19 19:35:33 +02:00+ updated_at: 2006-07-19 19:35:33 +02:00project_id: 5user_id: 10mail_notification: falsemembers_007:id: 7- created_on: 2006-07-19 19:35:33 +02:00+ created_at: 2006-07-19 19:35:33 +02:00+ updated_at: 2006-07-19 19:35:33 +02:00project_id: 5user_id: 8mail_notification: falsemembers_008:- created_on: 2006-07-19 19:35:33 +02:00+ created_at: 2006-07-19 19:35:33 +02:00+ updated_at: 2006-07-19 19:35:33 +02:00project_id: 5id: 8user_id: 1mail_notification: truemembers_009:id: 9- created_on: 2006-07-19 19:35:33 +02:00+ created_at: 2006-07-19 19:35:33 +02:00+ updated_at: 2006-07-19 19:35:33 +02:00project_id: 2user_id: 11mail_notification: falsemembers_010:id: 10- created_on: 2006-07-19 19:35:33 +02:00+ created_at: 2006-07-19 19:35:33 +02:00+ updated_at: 2006-07-19 19:35:33 +02:00project_id: 2user_id: 8mail_notification: false