63 Commits

Author SHA1 Message Date
OpenProject Actions CI 0778811719 Merge branch 'release/17.4' into dev 2026-05-06 12:47:03 +00:00
Oliver Günther c660802146 Merge remote-tracking branch 'origin/release/17.3' into release/17.4 2026-05-06 09:19:25 +02:00
Klaus Zanders a9a6898153 Remove inline disables for DynamicFindBy 2026-04-27 09:22:18 +02:00
Oliver Günther 6877e29351 Validate current user password confirmation when changing passwords through API
https://community.openproject.org/work_packages/74335
2026-04-23 14:19:50 +02:00
Oliver Günther f41c5e6f80 Validate user limit when trying to activate user 2026-04-17 09:04:59 +02:00
Pavel Balashou 10299f9943 Fix some jira import bugs. Add finalization modal.
- Modify jira_open_project_references unique constrant
  It must include jira_id, because multiple jira configuration can refer same op entities.
- Add finalization modal
- Add finalization job
  The job activates all imported users. Checks that user_limit has not been exceeded with specific contact.
  Destroys jira_* objects.
- Destroy jira object on revert as well.
- Use EmptyContract when creating Attachements, WorkPackages, Members
- Import only users fetched in the current jira_import. It was a bug.
2026-03-09 16:10:17 +01:00
Jan Sandbrink 485e09c357 Disable inputs in edit forms more consistently
The decision on which fields are writable has been moved into
the user's contract. Previously the fields in the My Account form were only
disabled in the frontend, but when changing the browser form, the user could
still update values. Now the contract has been updated to check the
authentication method as well, denying changes to the own name and email address.

Similarly when the contract prevents edits, this is also reflected in the admin
UI for users. It's not pretty, because there seems to be no formatting for disabled
text boxes in our old forms, but it still gives faster feedback than the
old forms, where you had to submit to see that a change to your own login
was rejected.

In the My Accounts form, this change leads to the curious case, where
an admin CAN change their own name in the My Account view, because admins
could do it in other forms as well. It's surprising, but consistent.

Additionally the behaviour has been harmonized across LDAP and other auth providers.
Editing the email address is now also forbidden in all cases for the user themselves.
2026-02-18 16:25:47 +01:00
Klaus Zanders 51159af334 Do not allow admins to delete themselves when they are the last admin 2026-02-13 15:17:39 +01:00
Klaus Zanders e7c32a96f0 Email address can only be edited by global admins 2025-11-26 11:27:03 +01:00
Pavel Balashou 1323927095 [#65068] Add deleted status to user.
https://community.openproject.org/work_packages/65068
2025-08-27 09:53:37 +02:00
Alexander Brandon Coles 0091ee164d Freeze string literals in app/contracts
rubocop -A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment,Style/RedundantFreeze app/contracts
2025-07-18 17:51:41 +01:00
Pavel Balashou 19d7642334 [#62107] Reacto on PR comments.
Co-Authored-by: Jan Sandbrink <j.sandbrink@openproject.com>
2025-07-02 15:30:24 +02:00
Pavel Balashou 7031218224 Merge branch 'dev' into feature/62107-add-scim-server-api 2025-06-13 10:25:45 +02:00
Pavel Balashou af05f29bbf [#62107] Add SCIM server API
https://community.openproject.org/work_packages/62107
2025-06-05 13:16:44 +02:00
Pavel Balashou 83794a7466 [#63912] React on PR comments.
Important changes:
1. Use ignored_columns to try to avoid downtime.
2. Add unique constraint for auth_provider_id+external_id.

Co-authored-by: Jan Sandbrink <453584+username@users.noreply.github.com>
2025-06-05 13:03:13 +02:00
Pavel Balashou 2db9ef305c [#63912] Support multiple authentication provider user links
https://community.openproject.org/work_packages/63912
2025-06-03 10:13:00 +02:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
ulferts 3b2121f733 Revert "Merge remote-tracking branch 'origin/release/13.4' into dev"
This reverts commit 40b2bbeb09, reversing
changes made to b4c6cb17cc.
2024-03-21 11:31:17 +01:00
Ivan Kuchin 7787e457a3 Revert "Merge branch 'dev' into release/13.4"
This reverts commit a901541269, reversing
changes made to e573ca00b7.
2024-03-20 20:19:08 +01:00
Ivan Kuchin 9e4934cd0a change quotes using rubocop --only Style/StringLiterals,Style/QuotedSymbols -a 2024-03-20 18:05:22 +01:00
Christophe Bliard c795874f7f Update copyright year for 2024
command used: `rg -l 'Copyright \(C\) 2012-202\d the OpenProject' | xargs -n 100 sed -i -r 's/Copyright \(C\) 2012-202. the OpenProject/Copyright (C) 2012-2024 the OpenProject/'`
2024-01-02 16:23:54 +01:00
Dombi Attila 051b4f6a56 Update Users::UpdateContract#at_least_one_admin_is_active to catch locked admins only 2023-11-01 15:21:41 +02:00
Dombi Attila 061c43d519 [#50208] Skip AdminSeeder when email already exists, skip admin validation when flags did not change.
https://community.openproject.org/work_packages/50208
2023-11-01 15:04:44 +02:00
Dombi Attila fbb2844069 [#50208] Disabling the default admin user is possible via a system user (#14057)
* [#50208] When disabling the default `admin` user, after an update two `admin` users exists in the database.

https://community.openproject.org/work_packages/50208

* fix specs
2023-11-01 08:29:36 +01:00
Klaus Zanders 2d5f5f3a26 Replace allowed_to_globally? -> allowed_globally? for global permission checks 2023-10-23 15:05:37 +02:00
Christophe Bliard 8910145549 Hide user edit form tab if not allowed to edit their attributes
Only admins can edit another admin attributes
2023-09-25 16:37:10 +02:00
Christophe Bliard 74fe9e5e07 Ensure admins cannot be edited by anybody but active admins 2023-09-25 15:25:50 +02:00
Christophe Bliard 75fd784ac1 Forbid any update on admin unless user is admin themselves
This means a user with manage_user global permission can no longer update admin attributes.
2023-09-25 11:32:11 +02:00
Oliver Günther e32d2d0058 Remove AuthSource base namespace, model 2023-07-27 08:16:43 +02:00
Klaus Zanders 8d4f798f63 Fix more specs 2023-07-20 08:59:18 +02:00
Klaus Zanders 29790b00ce Fix specs and checks for roles 2023-07-20 08:59:16 +02:00
Klaus Zanders 3d5f4e1b29 Start using create_user permission in appropriate places 2023-07-20 08:59:15 +02:00
Christophe Bliard 21a696ef9b Update copyright information for 2023 2022-12-30 15:51:26 +01:00
Dombi Attila 1691077d44 [Fix] Create rake task to fix missing notification settings (#11362)
* Create rake task to fix missing notification settings

* fixup! Create rake task to fix missing notification settings

* Test whether users being created without settings
2022-12-08 08:08:06 +01:00
Dombi Attila 92a7f1ffda Rename :writeable to :writable 2022-06-20 13:30:33 +02:00
Oliver Günther 02a80edccd Allow setting the status on User create/update contracts 2022-04-05 08:30:35 +02:00
Christophe Bliard a33524ef6d remove ruby magic comment for utf-8
ruby interprets source encoding as utf-8 since 2.0.0, making magic comment redundant and useless
2022-03-10 19:36:58 +01:00
Christophe Bliard bc8d423ec2 update copyright information for 2022 2022-03-01 17:05:59 +01:00
Oliver Günther a842422482 Add validation to contract 2022-01-10 08:25:26 +01:00
Oliver Günther ccfa29c728 Move license and copyright docs to root, fix names and references 2021-09-02 21:50:46 +02:00
Oliver Günther 065dfbddc4 [36467] Add API users form and schema endpoints (#9090)
* Add Users form endpoints

* Avoid cache_if as it caches properties for new_record? as well

* Add specs

* Add missing custom_field_values method

* Fix missing firstname lastname api conversions

* Disable cached_representer on user payload

* Add patch to allow using our custom setter in case of nil values

https://github.com/trailblazer/representable/issues/234

* Add test for changing status

* Fix expectation with changed attribute mapping

* Disable rendering name property for users

The name property is not accessible directly for users

* Fix attribute names for first and lastname for writable

* Ensure password is marked writable even though its not an attribute

* Avoid explicitly setting to_ar_name conversion

* Reuse AssignableCustomFieldValues concern

* Fix structure of users.apib to be flat

* Extend requests with custom fields

* Output name, but dont mark as writable attribute

* Fix id indentation

* Rename schema email property

* Fix param for user update form

* Fix schema docs
2021-03-23 15:42:16 +01:00
Wieland Lindenthal c4c2149d98 Fix: 36299 -- Allow to modify login when global permission :manage_users present (#9026)
* Refactoring: Create shared examples for user contracts

* Users::UpdateContract spec added

* Add spec for updating the login of a user

* Add spec for permitted params when global permission to :manage_user

* Remove spec for :login updates for user UpdateContractSpec

The writability of the login attribute is not part of the contract
(yet).

* Use user contract for checking writability of user attributes

* Fixing user contract specs.

* use persisted user in spec

Co-authored-by: ulferts <jens.ulferts@googlemail.com>
2021-03-02 11:54:36 +01:00
Wieland Lindenthal ffa5ac84a8 Allow deletion of placeholder users when permission of :manage_placeholder_user give (#9018)
* Refactoring: Rename permission :add_user and :add_placholder_user

to :manage_user and :manage_placeholder_user

* Add deletion to :manage_placeholder_user permission label

* WIP: Check :manage_placeholder_user permission before deletion

Specs still missing

* In controller rely on authorize_global for deleting placeholder users

* Add deletion_info for placeholder users

* Extend specs

* Set placeholder users to locked when deleting

* Review feedback

Co-authored-by: Oliver Günther <mail@oliverguenther.de>
2021-02-17 10:22:14 +01:00
Wieland Lindenthal a18954b2c9 Placeholder user services and administration (#8944)
* Adding placeholder user contracts

* Adding create, update, and delete services for placeholder users

* WIP: Adding Placeholder User contract specs [ci skip]

* Extract contract validation into common helper

* Add common validation in BaseContract + common example for admin checks

* Introduce common ModelContract shared context for validations

* WIP: PlaceholderUser controller, i18n, and routes [ci skip]

* Placeholder users index page and query

- moved all group related scopes from User to Principal to make them also available in PlaceholderUser.

* end

* Create PlaceholderUser

* Feature spec for editing a placeholder user

* Manage PlaceholderUser memberships

The managment of memberships is pretty similar for User and PlaceholderUser. This commit extacts the similarities and uses them for both.

* General partial and show view for PlaceholderUser

* Delete obosolete partial

* Allow RequireAdminGuard to be used as a module function

* Fix I18n for confirmation text

* Smaller code improvements

* Fix: Syntax for accessing status enums was wrong.

* Use UpdateService for updating a placeholder user

* Add spec for PlaceholderUsersController

* First code improvements after code review.

- more improvements to come.

* Further code improvements after review

... still more to come

* Correct namespace of delete service

* Fix: Make placeholder user contract validate

* Remove :type attribute from base contract of User and PlaceholerUser

...and add it to the CreateContracts.
Also add type validations.

Further extract shared examples for placeholder user attribute
validation

* Refactor: Extract membership hook calls to helper

* Fix redirect paths for membership controllers

* Specs already present in shared exampels.

* Fix duplicates routes for users and placeholder users

* Fix user path

* Add attribute name and lastname

We don't need a writeable check as both are equally writable

* Replace more references to tab_edit_user_path

* Skip specs for PlaceholderUsers::DeletionService

We will tackle that service in a separate PR.

* Fix module usage of RequireAdminGuard

* Fix group filter for placeholder users

* Fix invalid reference to expect_valid

* Fix: Fix tabbed edit path for placeholder users

* Fix status filtering on users

* Linting

* Improve generalisation of individual principal filter cell

- Check for presence of groups and statuses in order
  to toggle visibility of their UI element.
- Remove groups from placeholder user controller and
  cell initialization and options

* Fix selector on groups assign

* Remove using_shared_fixtures

Co-authored-by: Oliver Günther <mail@oliverguenther.de>
2021-02-12 17:18:55 +01:00
Oliver Günther 109ade62da Allow editing auth_source as a global user (#8954) 2021-02-10 17:55:24 +01:00
Oliver Günther 3c9be3bdbe [35507] Allow global permission to add and edit users (#8937)
* Add global permission for add_user

* Rename fieldset for global roles to "Global"

* Add permission to admin actions

* Add index action to add_user permission

* Redirect to first admin item if only one

* Hide status action for non admins

* Break down user form into partials for easier rendering

* Disable some user form tabs for non-admins

* Make users API and services conformant with endpoints

* Fix references to DeleteService#deletion_allowed?

* Authorize add_user on show as well

* Only show invite user toolbar item with permission

* Fix Delete Service spec

* Fix the way user prefs are handled in service

* Ensure session_id is treated as string

This causes a cast error otherwise as it passes rack session locally

* Fix service call on onboarding controller

* Fix service call on users controller

* Add delete spec for global user

* Hide login attribute again when adding a new user

* Render auth source correctly in simple form

* Fix creating invited users through service

The invitation requires the mail attribute to be present.

Previously, there was a manual error added to the mail.

As the errors are now determined by the contract + model, we now

end up with all missing properties as errors.

* Properly constraint attributes for non-admins

* Add specs for global user

* Start working on how to update password from UsersController

that code is a mess...

* Change permitted_params spec to include non-admin params

* Fix create user service spec

* Remove mail_notification param from users controller

It's not part of the contract/params passed to user

* Remove todos

* Extend docs

* Correct the way backlogs patches into the user settings

* Remove superfluous UpdateUserService

* Rewrite duplicated update service examples into common shared example

* Remove duplicate password writable check

* Base Users::DeleteContract on base delete contract

* Move checks for active users into the UserAllowedService

* Restore password writable check as it is not an attribute

* Fix menus for global user

* Allow global users to add custom fields

* Allow global user add permission to reinvite user

* Fix changed var name in update service spec

* Ensure also invited or registered users can be authroized

This ensure that e.g., invited users can also be set as watchers

* fix typo

Co-authored-by: ulferts <jens.ulferts@googlemail.com>
2021-02-01 10:45:13 +01:00
ulferts 6140f4c7e9 update copyright to 2021 (#8925)
Updates the copyright to 2021 for all files that have a copyright. Files in our source code without the copyright header still do not receive one automatically. Additionally, backlisted files are also excluded.

Previously the copyright of chiliproject which references redmine stated a copyright of redmine up to and including 2017 which is not true for the code we have in here. Because of that I changed that to 2013
2021-01-13 17:47:45 +01:00
ulferts 8175dc4acd add language to user api (#8812)
It is documented and as such, it should be part of the api
2020-10-28 08:24:02 +01:00
ulferts e2961fba14 replaces reform & custom error handling
Replaces reform by a simple layer of Disposable +
ActiveModel::Validations for contracts.

Additionally removes the custom error handling where OpenProject added
symbols to keep the ability to identify faulty attributes while having
non standard format (deviates from `%{attribute} %{message}`).

Changes to active record now allow us to define the format of a message
on i18n level, e.g. `%{message}`. Therefore the patching can be removed.

Reform plans to remove support for ActiveModel::Validations in version
4.0 at the latest but even today, support for it is hapazard. As we do
not need the full stack of Reform anyway, we can solely rely on
Disposable.
2020-08-25 12:58:37 +02:00
Henriette Dinger bd7f4e4814 Update copyright notice 2020-01-15 11:31:26 +01:00