137 Commits

Author SHA1 Message Date
Klaus Zanders f404f7c354 Properly destroy items linked to the user when they are destroyed 2026-04-23 10:38:12 +02:00
Jan Sandbrink f9d8bc6614 Introduce SubclassResponsibility error
This error is intended for cases when a method is
intentionally not implemented, because the module/class defining
it expects a subclass (or class including the module) to implement
the method.

This is intended to distinguish it from other cases, such as:
* feature not implemented yet
* edge case of a method call not yet supported

Notably it avoids the misuse of the Ruby-defined NotImplementedError,
which is only intended for much more specific scenarios:

> Raised when a feature is not implemented on the current platform. For example, methods depending on the fsync or fork system calls may raise this exception [...]

Also see https://docs.ruby-lang.org/en/master/NotImplementedError.html
2026-03-27 08:14:56 +01:00
Klaus Zanders deb5288836 Generalize HasPrincipalDetails to HasDetailsTable cocnern 2026-03-18 09:02:18 +01:00
Klaus Zanders 31a2536f51 Implement has_principal_details concern and use it for the group 2026-03-16 15:42:27 +01:00
Oliver Günther 0f1f0e62cb Reduce visibility of principals to common memberships or view_all_principals permission 2025-10-23 12:59:56 +02:00
Pavel Balashou f5da66ccb7 [#66996] Hide deleted users from everywhere.
https://community.openproject.org/work_packages/66996
2025-08-29 17:05:08 +02: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
Pavel Balashou 601b054e04 [#62107] React on PR comments volume 2.
- Fix some Rubocop complains.
- Does not set user.firstname and user.lastname to stupid values.
  To avoid confusion.
- Add inverse_of option to user_auth_provider_links -- provider association.
- Extract ScimitarSchemaExtension module to a dedicated file.
- Fix users/delete_service_spec.rb
2025-07-03 02:59:23 +02: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 662f6a535b [#62107] Update SCIM Server API yet another time.
- Disable Rails/HttpPositionalArguments completely.
  It is often not relevant and breaks specs when rubocop -a is used.
- Support excludedAttributes for all enpoints in SCIM Server API
- Fix excludedAttributes to handle nested attributes correctly. e.g. name.givenName
- Respond with 403 whne User can't be deleted due to lack of permissions.
- Refactor scim related code by removing duplication where possible.
- Remove BasicAuth from supported auth schemes.
- Add specific specs to test SCIM authentication.
- Extend specs.
2025-07-01 22:43:53 +02:00
Pavel Balashou d187b2aab7 Merge remote-tracking branch 'origin/dev' into feature/62107-add-scim-server-api 2025-07-01 10:02:12 +02:00
Kabiru Mwenja b52debb70d Style/ItBlockParameter: Use it block parameter.RuboCopStyle/ItBlockParameter (#19318) 2025-06-26 13:36:49 +03:00
Pavel Balashou 5fe52f3a64 [#62107] Update a few SCIM related things.
- Enable SCIM Patch.
- Use user_auth_provider_links instead of users.identity_url.
- Extend SCIM ActiveRecord base scopes to join and preload appropriate associations.
- Set a stub for user.firstname and user.lastname if they are not provided by SCIM client.
- Handle user unique constraint vialation according to SCIM spec.
- Move user_auth_provider_links association to principal as group needs it as well.
- Set user.mail dynamically from the list of emails provided by SCIM client.
- Change BaseServices::Create contract to accept model instance as a constructor parameter.
  It gives an option to build associations before model creation.
- extend SCIM server API schema to include externalId.
- Adjust specs.
2025-06-17 11:03:28 +02:00
Pavel Balashou 4d35299d67 [#63912] Try to fix migrations CI run. 2025-06-06 15:01:17 +02:00
ulferts d91de29d7c Merge remote-tracking branch 'origin/dev' into rails-7.2 2025-02-27 17:51:34 +01:00
Klaus Zanders 7b69b14399 Do not allow time tracking for users that are not visible to you 2025-01-31 13:12:07 +01:00
Klaus Zanders 3f20102c7b fix rubocop issues 2024-11-19 13:00:20 +01:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Ivan Kuchin 6612299bbe add User.select_for_name to fetch columns required for formatting user name 2024-05-02 14:30:20 +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
Klaus Zanders 45d49229b5 Add a new query instead of changing the existing one 2023-12-11 14:59:14 +01:00
Klaus Zanders 1493532a20 Fix in_project scope that is used by the members filter 2023-12-11 12:27:57 +01:00
ulferts e22618acd6 Merge remote-tracking branch 'origin/dev' into bug/50677-users-that-are-shared-with-a-wp-cannot-be-added-as-project-members-any-more 2023-12-04 16:03:50 +01:00
ulferts 84995eaf4f rename member "of" scopes 2023-11-20 18:40:42 +01:00
ulferts 9ae40a306f exclude wp members from Principal.memberships
That way, they no longer show up on the administration page of user`s projects
2023-11-06 17:12:05 +01:00
Aaron Contreras cd9badbfcb Promote HavingEntityMembership to the Principal level
Allows querying for entity memberships on groups as well as users.
2023-10-16 09:39:37 -05:00
ulferts 158f3e4e3a remove methods no longer in use - especially pagination 2023-10-02 22:50:43 +02:00
Klaus Zanders 0c7fd939c8 Fixes Performance/MapCompact offenses 2023-09-06 11:06:36 +02:00
Klaus Zanders 217ce65383 Add missing inverse_of relations to Principal class 2023-09-05 13:04:16 +02:00
Christophe Bliard 21a696ef9b Update copyright information for 2023 2022-12-30 15:51:26 +01:00
Oliver Günther 44882643d4 Add on_destroy paper_trail audits (#10876)
* Add on_destroy paper_trail audits

This sets whodunnit through meta override

This ensures we always access the User.current object. It would be a problem if we want to

override whodunnit, but currently this is not the case.

* Add backtrace information for deleted records

* Add cleanup job to remove old audits
2022-06-29 14:02:05 +01:00
Eric Schubert 17ac3781e0 [#41934] added tests for new principal visibility
- fixed some linter issues
2022-04-26 14:53:33 +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
Christophe Bliard 590fa591ae Make rubocop happier 2022-01-31 09:32:35 +01:00
Christophe Bliard 6be1461cca fix indentation 2022-01-31 09:32:34 +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
ulferts 21df5e46b4 Merge branch 'release/11.2' into dev 2021-04-21 08:06:50 +02:00
Oliver Günther 174427fc05 Remove duplicate not_locked scope (#9166)
* Remove duplicate not_locked scope

The enum itself creates scopes but they do not include not_builtion.

So instead, let's create these scopes ourselves

* Change enterprise spec to no longer test for builtin users
2021-04-20 14:06:37 +02:00
ulferts f0f5c17da7 Merge branch 'release/11.2' into dev 2021-03-03 15:19:28 +01:00
ulferts ab6d98383b fix member filter on principals (#9063)
In case of the `!` operator, other memberships interferred. This was because of the left join leading to result sets that where not of interest. The now used not.in does not have that problem
2021-03-03 15:18:49 +01:00
Oliver Günther 37bef43cea Introduce visible scope to principals
When a user has the manage_users permission in any project, they are

eligible to view all users for inviting them to the project.

This however is not reflected in the principals API, where only users

in all visible projects are found.
2021-02-22 21:22:20 +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
ulferts 1bdd2ab9ae safe automatic fixes by rubocop (#8994) 2021-02-11 16:02:18 +01:00
Oliver Günther cdf3cf4c34 [36136] Rework members page to show name and avatars for principals (#8973)
* Rewrite members page to output name column

* Remove white-space nowrap for long login names in administration

* Extend member specs

* Allow query instance to be used in table cell

* Fix memberships specs with changed columns

* Add order for email

* Review feedback

* Allow x to close add member form

* WIP sort firstname/lastname

* Make status sortable

* Extract order_by_name into the order class

* Re-add but deprecate order_by_name

It's still in use in combination with some special scopes

(custom actions for example) that I don't want to remove right now

* Rewrite order_by_name into scope
2021-02-11 09:33:43 +01:00
ulferts cc4ed56e2a use AR`s scope method instead of singleton class method (#8976)
* use AR`s scope method instead of singleton class method

By using the scope method, all of Rails` checks and method definition usually done on a method are now also performed on the extracted scope methods

https://github.com/rails/rails/blob/5f3ff60084ab5d5921ca3499814e4697f8350ee7/activerecord/lib/active_record/scoping/named.rb#L154-L190

* turn scope classes into modules
2021-02-05 10:53:44 +01:00
ulferts 5ea185ef66 Placeholder user project members (#8961)
* remove intermediate placeholder scope

Doing so, placeholder users will begin to show up in the system

* remove scope without value

* extract scope

* use enum for status

* allow placeholder users to become project members

* display placeholder user member on members widget

* remove now superfluous method

The status name can simply be queried via #status now

* replace possible_assignees/responsibles on project

This also leads to placeholder users becoming eligible as assignees and
responsibles.

* fix aggregated scope on bulk edit

* linting

* remove IssueHelper
2021-02-04 09:52:56 +01:00