85 Commits

Author SHA1 Message Date
Klaus Zanders 35f2942e26 Prevent different OU types to be added to each other 2026-04-16 18:20:54 +02:00
Oliver Günther 219e1048e0 Destroy synced groups when group is destroyed 2026-03-20 09:17:50 +01:00
Klaus Zanders deb5288836 Generalize HasPrincipalDetails to HasDetailsTable cocnern 2026-03-18 09:02:18 +01:00
Klaus Zanders 9dd52bf358 Add nested group display in the UI 2026-03-17 10:26:38 +01:00
Klaus Zanders 4c61f81fd0 Fix has_principal_details for the first usage of the class 2026-03-16 17:16:26 +01:00
Klaus Zanders 79048de61f Add a where_detail scope helper to easily do where on the details table 2026-03-16 15:42:31 +01:00
Klaus Zanders ae71c27c97 Implement hierarchy for groups and prevent circular dependencies 2026-03-16 15:42:29 +01:00
Klaus Zanders e12a11c559 Skip using the *Detail class and implicitly define it 2026-03-16 15:42:28 +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 d47f065777 Move containing_user into a scope and add spec 2025-10-23 12:59:58 +02:00
Oliver Günther 3473394130 Restrict visibility on groups scope 2025-10-23 12:59:57 +02:00
Jan Sandbrink 48ee98b6ef Add UI to inspect OIDC group links
This is to add some transparency on the fact that users
can automatically be assigned to such a group and how that
would work.
2025-07-25 16:16:25 +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 4e6f018f3e [#62107] Update SCIM Server API.
- Use ServiceAccount associated with ScimClient for making user changes
- Remove scoping by scim_client.auth_provider_id
  So, SCIM Client has access to any not_builtin User.
- Associate user with AuthProvider configured in ScimModel
  instead of choosing the first one.
2025-06-26 18:45:52 +02:00
Pavel Balashou bfe8f32e16 [#62107] Update SCIM server API.
- Implement excludedAttributes for GET requests.
- Handled uniqueness violations for group creatation.
- Make sure PATCH works with adding/replacing/removing group members.
- Pick one user email from a list: primary => work => first alphabetical.
- Mark group as inactive before DeleteJob is scheduled.
2025-06-24 11:05:58 +02: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 326b781c0b [#62107] Fix SCIM PUT. Disable SCIM PATCH.
ServiceProviderConfig enpoint will communiczte that PATCH is not supported.
PATCH is optional according to the specificaiton.
Main reason for disabling it:
it requires special treatment of adding/removing group members,
because in OpenProject it should be done through service(Groups::UpdateSerivce which
uses Groups::AddUsersService underneath), not model association.
2025-06-05 13:16:45 +02:00
Pavel Balashou 22efc29371 [#62107] React to the PR comments. 2025-06-05 13:16: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
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
Oliver Günther cbc05b0848 Merge remote-tracking branch 'origin/release/12.4' into dev 2023-01-04 20:50:41 +01:00
ulferts cbc7b9f124 optimize creating memberships for groups
Before, all the projects the group might have been in before the new
membership got created were considered by the SQL which potentially
results in a lot of records to be processed (the results were correct).
Now, only the project the new membership is created for is considered in
the SQL as that is the only project in which the group's users could
rightfully become members now.
2023-01-04 10:50:11 +01:00
Christophe Bliard 21a696ef9b Update copyright information for 2023 2022-12-30 15:51:26 +01:00
Christophe Bliard 48a4f1b6ad lint with rubocop --autocorrect (safe cops only) 2022-06-02 10:40:10 +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 ccfa29c728 Move license and copyright docs to root, fix names and references 2021-09-02 21:50:46 +02:00
ulferts 9fa5599392 Feature/member notifications (#8958)
* spec with correctly scoped links

* move db check into own file - fix deprecation

* basic spec for member creation service

* use constants for all notifications

* send an OP notification after member has been created

* send an OP notification after member has been updated

* mails on group member added

Depending on whether the membership existed before or not, an updated or
a created notification is send. This is done asynchronously.

* move all mail sender background jobs into namespace

* wip

* wip

* correct handling group member notifications

* add setting enable/disable mail sending on member alterations

* use services in members controller

* move Notifiable to OpenProject

* remove member after save hooks

* cleanup/testing/linting

* render member mails in receiver locale

* remove add_member! method

* use mailer layout for all mailers

* Update app/services/groups/cleanup_inherited_roles_service.rb

Co-authored-by: Oliver Günther <mail@oliverguenther.de>

* use around callback to avoid prepending

* handle nil params

Co-authored-by: Oliver Günther <mail@oliverguenther.de>
2021-04-20 13:45:42 +02:00
ulferts b8ca382d34 Group API (#9034)
* include group members into resource

* GET /api/v3/groups endpoint

* POST /api/v3/groups

* PATCH /api/v3/groups/:id

* DELETE /api/v3/groups/:id
2021-02-23 09:59:49 +01:00
Oliver Günther f4dfd6c6c6 [36238] Extract and fix user references in other objects (#9007)
* Move replacing invalid references into separate job for principals

* Write migration to remove existing invalid custom values and responsible

* Fix other specs

* Fix other specs

* rewrite replacing user in records

* consolidate principal deletion

* include placeholder users in spec

Co-authored-by: ulferts <jens.ulferts@googlemail.com>
2021-02-16 08:46:53 +01:00
ulferts 1bdd2ab9ae safe automatic fixes by rubocop (#8994) 2021-02-11 16:02:18 +01:00
ulferts a5d35a5cf8 Merge branch 'release/11.1' into dev 2021-02-01 09:49:17 +01:00
Oliver Günther e4c9506e56 [36081] Increase max lengths of user/group names (#8948)
* Unset DB limits for user attributes

* Validate groups in synchronized groups

* Extend limitations and fix specs
2021-02-01 09:27:39 +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 a112999dcc fix ruby 2.7 deprecations (#8867) 2020-12-07 08:22:34 +01:00
Oliver Günther 80e747e0c6 Fix test by calling service with system user
Adds this to the factory to avoid using the system user all over the
place
2020-05-05 13:10:09 +02:00
Oliver Günther 9b91112c36 Throw error in Group#add_members! if call failed
This shadowed the permission check in the test
2020-05-05 13:10:08 +02:00
Oliver Günther e4dcc6c5ea Avoid usage of users << pattern in group
This will no longer trigger the addition
2020-05-05 13:10:07 +02:00
Oliver Günther d93ff52a27 Handle add_users with a separate service with CTE 2020-05-05 13:10:07 +02:00
Henriette Dinger bd7f4e4814 Update copyright notice 2020-01-15 11:31:26 +01:00
Oliver Günther 6ef4211e77 Bump copyright to 2018 (#6171)
[ci skip]
2018-02-12 08:51:12 +01:00
Oliver Günther 7cf11bb689 Update copyright notice 2017-01-10 15:11:43 +01:00
Jens Ulferts 8c364aff89 optimize watcher pruning on group modifications
Less db queries when
  * removing a member from a group
  * removing a group from a project
  * removing a group

Mostly this is done by
  * adding eager load statements where neessary
  * pruning watchers only once

Please note, that the last is only possible via hack which consists of
passing a flag which prevents calling prune when we already know that
the pruning will take place later on anyway.
2016-11-22 09:43:36 +01:00
Markus Kahl d2bc4202ad make group deletion fast 2016-04-05 11:37:46 +01:00
Mohamed Wael Khobalatte 972b04d86e Refactor to allow for strong params
We no longer need attr_accessible.
2015-10-23 14:33:55 +02:00