108 Commits

Author SHA1 Message Date
Henriette Darge ad5a86f8e9 Fine tune members widget and remove doubled body class which caused additional spacing 2025-09-26 11:22:51 +02:00
Henriette Darge 7a2fb9aa3e Add primerized members widget 2025-09-24 12:56:06 +02:00
Alexander Brandon Coles d17da65477 Freeze string literals in app/models
rubocop -A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment,Style/RedundantFreeze app/models
2025-07-22 18:26:13 +01:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Klaus Zanders cbb2fefb21 Introduce an OfEntity scope 2024-06-27 09:51:13 +02:00
Klaus Zanders db580141cc Move ProjectQuery model to the main namespace 2024-06-26 16:23:10 +02:00
Klaus Zanders 109ac5e64e Fix project_role? method 2024-06-17 09:31:46 +02:00
Klaus Zanders 74b3b8c934 Allow membership on ProjectQuery 2024-06-17 09:31:35 +02:00
Ivan Kuchin e496c226bb rubocop 2024-03-27 19:56:14 +01:00
Ivan Kuchin cd402bfbf9 add Member#some_roles_deletable? instead of changing deletable? 2024-03-27 19:56:14 +01:00
Ivan Kuchin 7879feacb4 get shared_work_package_ids instead of just count 2024-03-27 19:56:14 +01:00
Ivan Kuchin 62afaa6cd7 delete non inherited roles for members with inherited roles in members delete service 2024-03-27 19:56:14 +01:00
Klaus Zanders e71091dda3 Ignore inherited memberships 2024-01-25 11:07:36 +01:00
Oliver Günther 97d616c62d Hide edit button for work package roles 2024-01-10 14:17:59 +01:00
Oliver Günther 6cc61a51c7 Add shared column for work packages without filter capability 2024-01-10 14:12:29 +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
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 d89cf6eaaa extract into scopes 2023-09-29 15:01:17 +02:00
Klaus Zanders e0d99127f9 Add a method to check if Membership is possible 2023-09-05 13:04:36 +02:00
Klaus Zanders 70afa1658f Re-introduce validation 2023-09-05 13:04:13 +02:00
Klaus Zanders b5aa2d0e7a Add an optional, polymorphic entity to memberships 2023-09-05 13:04:11 +02:00
Kabiru Mwenja 62f04fb39d chore[#49397] Define base query for project storage memberships
https://community.openproject.org/work_packages/49397
2023-08-02 19:50:22 +03: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
Christophe Bliard b6e4dbcbcc prefer db query over pure ruby for #deletable_role? 2022-02-07 10:29:46 +01:00
Christophe Bliard 10ad8179d1 hide deletion button if global role is inherited from group 2022-01-31 09:32:43 +01:00
Christophe Bliard 15f00ffe84 Add 'Global role' tab for groups
Global roles can now be added, update, and removed for a group
2022-01-31 09:32:36 +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 1bdd2ab9ae safe automatic fixes by rubocop (#8994) 2021-02-11 16:02:18 +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
Wieland Lindenthal efbd3e9b41 Placeholder user backend (#8935)
* Add missing copyright note to AnonymousUser [ci skip]

* Addin PlaceholderUser model and its associations

* Ensure PlaceholderUser do not "leak out" uncontrolled

* Extract Associations for User and PlaceholderUser.

- remove obsolete #assigned_issues
- remove obsoete #:responsible_for_issues
- add specs and factory for PlaceholderUser
Adding specs to PlaceholderModel

* Migration: enforce uniqueness of lastname for Group and PlaceholderUser

* Remove obsolete callback `after_add` on groups association.

The association of principals and groups still had a callback
`after_add` that called a method `user_added` on the group.
That method was not defined anymore as it was removed in
commit d93ff52a27.

* Move validation for #groupname to the right spec.

* Cleanup placeholder and group specs

* Remove Setting `workpackage_group_assignment`

* Refactoring: Extract assignable scope from Project to Member

* Refactor: Add Member scope not_locked.

* deprecate hacky scope

* remove wp_group_assignment specific test case

Co-authored-by: ulferts <jens.ulferts@googlemail.com>
2021-01-29 09:59:37 +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 7f34799a33 Chore/reimplement global roles (#8730)
* remove outdated docs/code

* global memberships are just memberships

* rewire global membership creation/update/deletion

* delete no longer required code and patches

* move code to core

* move specs to core

* completely remove global roles in the form of a plugin

* adapt specs

* remove unused methods

* migrate existing data

* adapt membership representer to changed timestamps

* global memberships available via API

* implements created/update_at filters on memberships

* update member on roles being added/removed

* specify default value for created_at

* fix project permission check and validation on members

* adapt membership schema

* adapt usage of sort by on members widget

* support created/updated_on for api sort and filter
2020-12-03 09:47:50 +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
Oliver Günther 53f2d694ff Use AnyFixtures to generate fixtures from factories (#7230)
Uses FactoryBot to keep and maintain specific records in a special transaction that does not get removed after each spec.
They automatically are created whenever first hitting them.
This makes an excellent time saver for items that are commonly used, such as an admin user account
2020-04-09 11:54:26 +02:00
Henriette Dinger bd7f4e4814 Update copyright notice 2020-01-15 11:31:26 +01:00
Oliver Günther 70bc14625d Fix unwatch_from_permission_change when project nil
https://sentry.openproject.com/share/issue/a58124f215d04e139b4a4336e6fa3a16/
2019-11-19 10:40:14 +01:00
ulferts a93ecca5a8 Feature/members api show (#7308)
* basic members collection response

* complete member index end point

* document versions#index

* remove user association from members

There is already a more generic principals association. Having both causes confusion and leads to duplicate loading of models

* linting

* remove disabled test

* add members#show api end point

* add project and principal to member representer

* replace member.user reference with principal

* use principal reference in project members association

* modernize roles api

* complete member representer rendering

* replace remnants of user association

* add member schema api endpoint

* have dedicated available projects end point for versions

* linting

* limit roles to assignable ones in schema

* rename member to membership in api

* remove remnants of user in member

* spec fixes

* use available_projects endpoint in versions board

* add eager loading to memberships#index

* members create form api endpoint

* ensure role exists for default assignment

* extract switch for users/groups to work_packages representer

* document membership create form

* add l10n expected in specs

* strengthen the usage of a delete base service

* use base class for set attributes service

* fix alias in service

* add create endpoint to members api

* document members create endpoint

* linting

* adapt to altered service signature

* use default endpoint for wp#get

* use CF infused representer


[ci skip]
2019-05-29 09:31:56 +03:00
Jens Ulferts ac59ad6a89 introduce group resource stub 2018-04-25 14:36:10 +02:00
Oliver Günther 6ef4211e77 Bump copyright to 2018 (#6171)
[ci skip]
2018-02-12 08:51:12 +01:00
Oliver Günther dae84cffb0 Extract editing member into a separate service
Would have liked to use the contract here to validate the role_ids
before they're being written to attributes, but that doesn't seem to
work.
2017-06-30 11:45:28 +02:00
Oliver Günther b2b499a7fd [25686] Use collection_check_box in membership page
This adds a hidden field for when no checkbox is selected,
however it adds the caveat that non-selected values are transmitted as
empty values, thus we have to filter them again in the backend.
2017-06-29 15:43:18 +02: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
Jens Ulferts 3246747ae0 adapt to newly introduced query 2016-08-25 10:27:33 +02:00
Markus Kahl d2bc4202ad make group deletion fast 2016-04-05 11:37:46 +01:00