Skip to content

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

Also allow rendering user details for create_user action and remove TODO

Klaus Zandersc1a42bef4f0e
diff --git a/lib/api/v3/users/user_representer.rb b/lib/api/v3/users/user_representer.rb
index dab1227ae64..56cf94c8a5a 100644
--- a/lib/api/v3/users/user_representer.rb
+++ b/lib/api/v3/users/user_representer.rb
@@ -228,7 +228,11 @@ module API
end
def current_user_can_manage?
- current_user && (current_user.allowed_to_globally?(:manage_user) || current_user_is_self?)
+ current_user && (
+ current_user.allowed_to_globally?(:manage_user) ||
+ current_user.allowed_to_globally?(:create_user) ||
+ current_user_is_self?
+ )
end
private
diff --git a/spec/features/users/invite_user_modal/invite_user_modal_spec.rb b/spec/features/users/invite_user_modal/invite_user_modal_spec.rb
index 724eae4a090..7f61b5a7599 100644
--- a/spec/features/users/invite_user_modal/invite_user_modal_spec.rb
+++ b/spec/features/users/invite_user_modal/invite_user_modal_spec.rb
@@ -167,7 +167,7 @@ RSpec.describe 'Invite user modal', js: true, with_cuprite: true do
context 'when the current user has permissions to create a user' do
let(:permissions) { %i[view_work_packages edit_work_packages manage_members work_package_assigned] }
- let(:global_permissions) { %i[create_user manage_user] } # TODO: Figure out why create_user is not enough here
+ let(:global_permissions) { %i[create_user] }
it_behaves_like 'invites the principal to the project' do
let(:added_principal) { User.find_by!(mail: principal.mail) }