102 Commits

Author SHA1 Message Date
Ivan Kuchin 0838ec3c80 rework readonly_attribute_errors variable in project update contract spec 2026-02-25 20:07:27 +01:00
Ivan Kuchin 1b56aefc35 test permissions for custom comments in update contract 2026-02-25 20:07:12 +01:00
Ivan Kuchin 8f044dc6d2 cleanup permissions part of update contract spec 2026-02-25 20:07:12 +01:00
Ivan Kuchin 2cbbcf8d72 test writable attributes for custom comments in update contract 2026-02-25 20:07:12 +01:00
Ivan Kuchin a14f3caca9 clearly distinguish shared spec for attributes and custom field values 2026-02-25 20:07:11 +01:00
Ivan Kuchin 1a587a4d73 a bit of rubocop corrections 2026-02-25 20:07:11 +01:00
Ivan Kuchin c2b1445731 don't add nesting with shared examples when not needed in update contract spec 2026-02-25 20:07:10 +01:00
Ivan Kuchin 17dd3bbf36 test custom comments in project create contract 2026-02-25 20:07:10 +01:00
Ivan Kuchin 290c573109 small refactor of project attribute specs 2026-02-25 20:07:09 +01:00
Ivan Kuchin 07b58ce037 rename shared example in project create contract 2026-02-25 20:07:09 +01:00
Dombi Attila 92d26c6260 Add back specs that are still valid 2026-02-10 17:57:23 +02:00
Dombi Attila 017591cfb7 Fix specs 2026-02-10 14:48:05 +02:00
Dombi Attila 623bd162b0 Fix CreateArtifact::WorkPackageContract specs
One test case was removed. It is not possible to have an empty work
package type while having a work package status, because the
work package type always has a default value, even if it's unset.
2026-02-10 12:29:00 +02:00
Ivan Kuchin 891da06266 require enterprise feature in projects create contract 2025-11-26 20:12:57 +01:00
Christophe Bliard bd4049142f Fix assignable check in create artifact work package contract
The `:work_package_assigned` permission has `granted_to_admin: false` so
`#allowed_in_project?(:work_package_assigned, project)` will always
return `false` for admins. Not sure why it's designed like this.

The check has been reworked to use the same logic as in
`WorkPackages::BaseContract#assignable_assignees` to prevent any other
potential issues.
2025-11-26 10:02:11 +01:00
Christophe Bliard 0df352215b Remove unneeded permission check for comment edition
Now that the work package is created directly with the right comment
through `journal_notes`, less permissions are needed.
2025-11-25 15:24:52 +01:00
Christophe Bliard 59613e98de Comment and mention the assignee in the artifact work package 2025-11-25 15:02:53 +01:00
Christophe Bliard 8d2ac0835f Merge branch 'dev' into feature/68862-create-work-package-to-submit-project-initiation-request 2025-11-25 11:36:01 +01:00
Christophe Bliard 564c19f545 Assign artifact work package to the designated user
In a project initation request, the created artifact work package is
assigned to the user pointed by a user custom field. The user custom
field to get this user from is given by
`project.project_creation_wizard_assignee_custom_field_id`.
2025-11-24 17:50:25 +01:00
Christophe Bliard b1c6989ca4 Check :add_work_package permission for artifact work package creation 2025-11-24 15:34:35 +01:00
Christophe Bliard 9eb18a7331 Ensure only one error is shown if PIR is disabled
When Project Initiation Request is disabled, no need to display errors about the status being not set (for instance).
2025-11-24 15:34:34 +01:00
Ivan Kuchin 5554fba3c2 use invalid instead of does not exist error when parent is not amongst assignable 2025-11-24 13:51:08 +01:00
Christophe Bliard 650894715e Ensure no missing translations in contract tests with :check_errors_i18n metadata
When `:check_errors_i18n` is added to example metadata,
`expect_contract_invalid` uses `full_messages` to check for missing
translations in tests.

When an error is translated, it needs two translations to exist:
- the attribute, with translation being searched in following paths:
  - activerecord.attributes.[model].[attribute_name]
  - attributes.[attribute_name]
  - activerecord.models.[attribute_name]
- the error, with translation being searched in following paths:
  - activerecord.errors.models.[model_name].attributes.[attribute_name].[error]
  - activerecord.errors.models.[model_name].[error]
  - activerecord.errors.messages.[error]
  - errors.attributes.[attribute_name].[error]
  - errors.messages.[error]

It can't be enabled globally because some keys do not exist in some
tests scenarios.
2025-11-24 10:24:19 +01:00
Christophe Bliard 5e5a01e37f Create artifact work package on project initiation request submission
https://community.openproject.org/wp/68862

A service takes care of creating the artifact work package.
2025-11-24 09:52:00 +01:00
Dombi Attila c4984ade97 [#69034] Change enforcement of project attributes on creation for templates
https://community.openproject.org/work_packages/69034
2025-11-19 20:14:09 +02:00
Dombi Attila 7b1fd5f09a Add program creation form and global permission. 2025-08-22 15:23:16 +03:00
Christophe Bliard bd3aa2a031 Move Project.workspace_type validation from contract to model
This is to prevent being able to save a project with a nil workspace
type. That would lead to an error due to a non-null constraint
violation.
2025-08-22 10:56:57 +02:00
ulferts 5104117b52 move assignable_parents loging into scope 2025-08-21 10:30:02 +03:00
ulferts a78ebc8682 fix spec description 2025-08-21 10:30:00 +03:00
ulferts ae0e4af967 move specs on templated into main spec structure 2025-08-21 10:30:00 +03:00
ulferts 64805d3bba add portfolio creation using existing project creation 2025-08-21 10:29:56 +03:00
Alexander Brandon Coles f304839f1d Merge branch 'dev' into merge-release/16.3-20250815034933 2025-08-15 13:42:46 +01:00
Dombi Attila 879f1f42fc Allow everything if the current user is an admin. 2025-08-14 14:07:09 +03:00
Dombi Attila 59bf8ccfc9 Use where condition on all_available_custom_fields and move it to a private contract method. 2025-08-13 00:44:47 +03:00
Dombi Attila 8c4c2b104d [#66298] It is possible to assign disabled and/or admin only project attributes given only edit permission
https://community.openproject.org/work_packages/66298
2025-08-08 09:00:19 +03:00
ulferts 3475661416 writable workspace_type attribute on project creation 2025-08-04 16:43:45 +02:00
ulferts 28deaaa9d9 use default contract contexts 2025-08-04 16:43:44 +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 82d492a2d7 Update specs 2024-08-07 15:38:27 +03:00
Oliver Günther 12ee9e6b83 Merge remote-tracking branch 'origin/idea/56781-remove-years-from-copyrights' into dev 2024-08-06 10:17:59 +02:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Dombi Attila 07200c5621 Remove access to public projects attributes and rely on the view_project_attributes only. 2024-07-29 16:47:53 +03:00
Dombi Attila 8cdebd6014 Add custom field read and write permission specs to the Projects::CreateContract 2024-07-29 16:47:51 +03:00
Dombi Attila b81c88af22 Add specs for copying projects without view_project_attribute permission 2024-07-29 16:47:47 +03:00
Dombi Attila 1611630ef4 Update the Projects::CreateContract to set writable custom fields based on permissions
When the user has :add_project or :edit_project_attributes set the
project attributes to be writable
2024-07-29 16:47:45 +03:00
Dombi Attila b92a35ef68 Fix disabled specs on Project create contract spec 2024-07-29 16:47:44 +03:00
Dombi Attila 176caffb56 Cover all the cases of writable attributes served to the Schema API 2024-07-29 16:47:35 +03:00
Dombi Attila 2bd3898725 Apply permission restrictions to Project::UpdateContract based on the attributes changed. 2024-07-29 16:47:30 +03:00
Dombi Attila cd3165c51a Fix specs 2024-07-29 16:47:26 +03:00
Eric Schubert b176bc8bd5 [#55193] added separate contract for project settings
- added contract unit test
2024-06-11 13:55:37 +02:00