72 Commits

Author SHA1 Message Date
Oliver Günther 8fafc2593b Fix visibility scope of groups in members filters
https://community.openproject.org/work_packages/74000
2026-04-17 11:34:36 +02:00
Oliver Günther d675f09e8e Allow selection of existing user IDs only when user is visible
https://community.openproject.org/work_packages/73369
2026-03-31 12:49:15 +02:00
Klaus Zanders 82c6e34dcc Fix members specs and remove redundant specs 2026-02-09 15:07:56 +01:00
Klaus Zanders 574402caa3 Remove shallow routing for members 2026-02-09 15:07:53 +01:00
Oliver Günther 8195341402 Disable RSpec/ChangeByZero to fix spec
The and chaining doesn't work with no change assumptions
2025-10-23 12:59:57 +02:00
Oliver Günther f342732b25 Invite users by email 2025-10-23 12:59:56 +02: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
Jan Sandbrink 0b87e7543f Freeze string literals in specs
Rolling out frozen string literals further by freezing all
string literals in core specs.
2025-05-05 09:29:55 +02:00
Dombi Attila df130e6523 Restrict searching email fields of autocompleters when the current user lacks :view_user_email permission. 2024-10-08 12:42:35 +03:00
Dombi Attila 744b3e1aa7 Return user email in user representer based on the :view_user_email permission 2024-10-08 12:42:35 +03:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Ivan Kuchin 0b87ed9b6a remove newlines from context descriptions 2024-07-29 19:27:17 +02:00
Eric Guo 9a7040ea84 Possilbe having email like 12775518238@qq.com 2024-05-14 21:19:42 +08:00
Ivan Kuchin e496c226bb rubocop 2024-03-27 19:56:14 +01:00
Ivan Kuchin a2983aea5d rework interface for managing members 2024-03-27 19:56:14 +01:00
Ivan Kuchin 0e98edf709 correct rubocop fix of should in example descriptions 2024-03-27 19:56:14 +01:00
Pavel Balashou 0054a8673a Fix tests. 2024-02-13 22:07:39 +01:00
Markus Kahl aadac0a4ff test mail deliveries instead of mocking job 2024-02-06 14:13:55 +00:00
Markus Kahl 3cec76fb95 amend members controller spec with user invitation case 2024-02-06 11:47:49 +00: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 2b2abf864a introduce ProjectRole model 2023-10-09 14:34:20 +02:00
Christophe Bliard 4c2a9d0aa8 Enable RSpec zero monkey patching mode
The plan for RSpec 4.0 is to disable monkey patching.

See https://github.com/rspec/rspec-core/blob/main/features/configuration/zero_monkey_patching_mode.feature for details.
2023-05-31 19:22:29 +02:00
Christophe Bliard c43fccf246 lint: autocorrect Style/HashSyntax
command is

    rubocop -A --only Style/HashSyntax app lib lib_static modules spec
2023-03-07 15:07:44 +01:00
Christophe Bliard aa23106c11 lint: autocorrect RSpec/FactoryBot/ConsistentParenthesesStyle
command is

    rubocop -A --only RSpec/FactoryBot/ConsistentParenthesesStyle modules spec
2023-03-07 15:04:32 +01:00
Christophe Bliard 85b3258a29 Autocorrect with some rubocop cops
RSpec/Rails/InferredSpecType and Style/RedundantConstantBase

rubocop --autocorrect-all --only RSpec/Rails/InferredSpecType,Style/RedundantConstantBase spec modules/*/spec
2023-01-13 14:28:59 +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 bc8d423ec2 update copyright information for 2022 2022-03-01 17:05:59 +01:00
Oliver Günther f08bea3467 Remove FactoryBot.* prefix where applicable 2022-01-25 08:19:06 +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 1bdd2ab9ae safe automatic fixes by rubocop (#8994) 2021-02-11 16:02:18 +01:00
Oliver Günther 2cde433326 Remove usages of AnyFixture (#8987)
AnyFixture will create once instance of a factory for reuse in a number of specs.
This will work fine until we require a clean slate for a specific example.

As we have numerous tests that test like the database is empty,
we get a number of disadvantages:

  - After an example with `with_clean_fixture` metadata, the fixture will only be regenerated
    after the next example that uses it. This means the order of execution will change
    the number of objects in the DB.

  - The more `with_clean_fixture` we have, the smaller the performance advantage of AnyFixture will
    result in.

  - You cannot use an AnyFixture in a spec that needs a clean slate. This should be obvious but was overlooked
    by myself.
2021-02-10 08:59:15 +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
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
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
Oliver Günther 183ad1480e Replace deprecated controller success? with succesful? 2018-12-03 10:31:58 +01:00
Oliver Günther 059770f533 FactoryGirl => FactoryBot
Removes the deprecation
2018-05-07 22:38:20 +02:00
Oliver Günther 6ef4211e77 Bump copyright to 2018 (#6171)
[ci skip]
2018-02-12 08:51:12 +01:00
ulferts daa1a4d4b7 fixes filtering members by group (#5800)
additionally fixes:
* with "all" selected, all members are shown, not only those being
active, invited or registered
* with "locked" selected, locked users are now displayed.
* the Project#members_principals associations lacked the `references`
method which lead to the users table being undefined in the resulting
query.

In order to achive the bug fixes, the member filtering is now based on
the query engine also used for users, queries, work_packages, ... As a
lot of the members filters are very similar to user filters (in fact, a lot of the
members filter work on the users model), those filters are shared via
modules.

[ci skip]
2017-07-31 18:13:51 +02:00
ulferts c0b709530c Fix/replace deprecations (#5533)
* replace alias_method_chain

* remove deprecation silencing

* bump controller-testing

* introduce permitted params for settings

* replace various deprecations in controllers

* remove deprecation silencing for legacy_specs

* remove `puts` from spec

* replace deprecated access to errors

* remove unnecessary AR::Parameters usage in spec

* specify error to expect

* replace deprecations

* replace deprecated action calls in legacy function specs

* replace deprecations in functional controller tests

* replace deprecations in controllers/controller_specs

* remove params parser which does not seem to be in effect

It is registered for the content type :exclude which makes no sense as it should deal with :json. The desired behaviour of the api dealing with parsing errors is working with or without the code.

* replace deprecations in unit specs

* replace alias_method_chain

[ci skip]
2017-07-19 21:17:37 +02:00
Oliver Günther 7cf11bb689 Update copyright notice 2017-01-10 15:11:43 +01:00
Oliver Günther 92aebdcec4 Fix params deprecation
Fixes in spec/controllers:

```
DEPRECATION WARNING: ActionController::TestCase HTTP request methods will accept only
keyword arguments in future Rails versions.
```
2016-10-17 11:56:44 +02:00
Jens Ulferts ea36f19be2 replace ineffective permission assignments 2016-09-08 11:42:02 +02:00
Stefan Botzenhart 1c01b5801e Use login_as helper method throughout all specs 2015-10-02 16:50:57 +02:00
Alex Coles 06274b97ea Remove reundant include in MembersController spec
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2015-09-14 21:25:40 +02:00
Alex Coles 8f0b398a42 Merge branch 'dev' into feature/rails4.2
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2015-09-14 21:23:02 +02:00
Markus Kahl dbc343555b fixed members_controller spec
adapted spec to new non-js behaviour
2015-09-14 13:52:28 +01:00
Alex Coles 87720d19ec Fix broken #assert_select_rjs in Controller specs
Add workaround for nested assertions, broken since Rails Dom Testing
switch to Nokogiri.

Signed-off-by: Alex Coles <alex@alexbcoles.com>
2015-09-13 14:45:49 +02:00
Alex Coles ce93701029 Fix syntax (w/Rubocop) in specs
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2015-06-30 12:08:28 +02:00