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
Apply the standard global role to all the users.
Dombi Attila2592753bb52e
diff --git a/app/services/authorization/user_global_roles_query.rb b/app/services/authorization/user_global_roles_query.rbindex 4fc93822512..8300997fe94 100644--- a/app/services/authorization/user_global_roles_query.rb+++ b/app/services/authorization/user_global_roles_query.rb@@ -35,7 +35,8 @@ class Authorization::UserGlobalRolesQuery < Authorization::UserRolesQueryRole::BUILTIN_ANONYMOUSend- builtin_role_condition = roles_table[:builtin].eq(builtin_role)+ builtin_roles = [builtin_role, Role::BUILTIN_STANDARD_GLOBAL]+ builtin_role_condition = roles_table[:builtin].in(builtin_roles)statement.or(builtin_role_condition)enddiff --git a/spec/services/authorization/user_global_roles_query_spec.rb b/spec/services/authorization/user_global_roles_query_spec.rbindex 2d1b6c04b12..7aced4d9653 100644--- a/spec/services/authorization/user_global_roles_query_spec.rb+++ b/spec/services/authorization/user_global_roles_query_spec.rb@@ -38,6 +38,7 @@ RSpec.describe Authorization::UserGlobalRolesQuery dolet(:role2) { build(:project_role) }let(:anonymous_role) { build(:anonymous_role) }let(:non_member) { build(:non_member) }+ let(:standard_global) { build(:standard_global_role) }let(:member) dobuild(:member, project:,roles: [role],@@ -69,6 +70,7 @@ RSpec.describe Authorization::UserGlobalRolesQuery dobefore donon_member.save!anonymous_role.save!+ standard_global.save!user.save!end@@ -81,8 +83,8 @@ RSpec.describe Authorization::UserGlobalRolesQuery domember.save!end- it "is the member and non member role" do- expect(described_class.query(user)).to contain_exactly(role, non_member)+ it "is the member, non member role, and standard global role" do+ expect(described_class.query(user)).to contain_exactly(role, non_member, standard_global)endend@@ -92,20 +94,20 @@ RSpec.describe Authorization::UserGlobalRolesQuery domember2.save!end- it "is both member and the non member role" do- expect(described_class.query(user)).to contain_exactly(role, role2, non_member)+ it "is both member roles, the non member role, and standard global role" do+ expect(described_class.query(user)).to contain_exactly(role, role2, non_member, standard_global)endendcontext "without the user being a member in a project" do- it "is the non member role" do- expect(described_class.query(user)).to contain_exactly(non_member)+ it "is the non member role and standard global role" do+ expect(described_class.query(user)).to contain_exactly(non_member, standard_global)endendcontext "with the user being anonymous" do- it "is the anonymous role" do- expect(described_class.query(anonymous)).to contain_exactly(anonymous_role)+ it "is the anonymous role and the global role" do+ expect(described_class.query(anonymous)).to contain_exactly(anonymous_role, standard_global)endend@@ -114,8 +116,8 @@ RSpec.describe Authorization::UserGlobalRolesQuery doglobal_member.save!end- it "is the global role and non member role" do- expect(described_class.query(user)).to contain_exactly(global_role, non_member)+ it "is the global role, non member role, and standard global role" do+ expect(described_class.query(user)).to contain_exactly(global_role, non_member, standard_global)endend@@ -125,8 +127,8 @@ RSpec.describe Authorization::UserGlobalRolesQuery doglobal_member.save!end- it "is the global role, member role and non member role" do- expect(described_class.query(user)).to contain_exactly(global_role, role, non_member)+ it "is the global role, member role, non member role, and standard global role" do+ expect(described_class.query(user)).to contain_exactly(global_role, role, non_member, standard_global)endend@@ -137,8 +139,8 @@ RSpec.describe Authorization::UserGlobalRolesQuery dowork_package_member.save!end- it "is the global role, member role and non member role" do- expect(described_class.query(user)).to contain_exactly(global_role, role, non_member)+ it "is the global role, member role, non member role, and standard global role" do+ expect(described_class.query(user)).to contain_exactly(global_role, role, non_member, standard_global)endendend