111 Commits

Author SHA1 Message Date
Jan Sandbrink 953ab1a6a8 Fix API::Errors::InternalError class
This class got broken during what seems to be a
drive-by style-improvement in fbe1215365. That change:

* made it incompatible with frozen strings as error messages
* broke the intended hiding of messages if they came from the
  wrong class

All of this went by unnoticed, because there were no specs
for the InternalError class.

Specs have now been added and the previous version of the code
mostly restored. Since there were some callers that always created the
exception with known safe error messages, I added a new class just for these
cases, because they were intended to "just show the message". So we can
keep using the original implementation for rescue_from handling.
2026-02-09 11:04:57 +01:00
Marcello Rocha 55ff4d6903 Rework of Storages Registry based approach (#17881)
* Re-creates the Registry and Errors under the Adapters namespace.
* Bring Authentication and Strategies to Adapters
* Make Strategies work with Result and clean up a bit of the code
* Setup SetPermissions Command and tests
* Moves create folder, need to add the input value
* Adds the create folder input
* RenameFile migrated
* Files Query and some Result Objects
* Gets the sync service working with the new commands/query
* UploadLinkQuery ported
* FileInfoQuery ported
* FilePathToIdMap moved
* Cleanup unused files and warnings
* Moves DeleteFolder. Updates tests of OneDriveSyncService
* Add some tests for the the inputs
* Start moving the bare minimum for the NextcloudSync
* Moves nextcloud FilePathToIdMap
* Create and Delete Folder nextcloud commands
* Port Nextcloud FileInfo and RenameFile
* Implements the changes necessary for create folder on the file picker
* Moves the CreateFolderService to the Adapters
* Move Nextcloud SetPermissions
* AuthCheck moved. Missing teests. Slowly moving the API to Adapters
* Adds note to figure out the open queries
* Move the user and group manipulation to adapters
* Moves Nextcloud FilesQuery
* Makes NextcloudSync to run on top of the new Adapter namespace
* Disable Peripherals::Registry
* Update CopyTemplateFolderService
* Makes services green again. Moves the new Nextcloud contract to Adapters
* Moves the new nextcloud contracts and fixes some the now broken tests
* Reintroduces the Internal namespace in OneDrive. Updates the contracts for Strategy to optionally take a storage (OIDC issues)
* Moves User and DownloadLink Queries and supporting code.
* Start to move the API over the new commands/queries
* Migrates the StorgeFilesAPI to the adapters
* FileLinksAPI cleared
* Updates the Storages API specs and implementations
* OpenStorage API done
* Update capabilities query
* Move connection validators and fix some broken tests
* Delete old code, update hidden dependencies.
* Adds missing handling for sso tokens
2025-07-10 09:01:55 +02:00
Eric Schubert a8c0ec5b43 [#58520] Implement fetching tree structure
- implement hashed subtree retrieval in persistence layer
- implement flattening of hashed subtree in applicaiton layer
- added api spec for GET /custom_field_items/:id route
- added self link, parent and children to http response
- added api for single hierarchy item route
- write unit tests for hashed_subtree in HierarchicalItemService
- add parameter validation to api endpoint
2024-11-05 12:58:07 +01:00
Eric Schubert 12f256dbf4 [#58520] add an endpoint to fetch the hierarchy
- https://community.openproject.org/work_packages/58520
- add API specification about the endpoint
2024-11-05 12:58:05 +01:00
Marcello Rocha fbe1215365 Adds the copyright blocks 2024-09-17 11:45:00 +02:00
Marcello Rocha ac08605ef6 Introduces the UploadLinkService 2024-09-17 11:44:59 +02:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Ivan Kuchin 192e21cd9e manual rubocop corrections 2024-05-30 19:54:08 +02:00
Ivan Kuchin fa5d03eae0 rubocop safe autocorrect all except Rails/WhereRange 2024-05-30 19:54:08 +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 8fa8584538 Run rubocop --autocorrect on all files
Only the safe cops have run. rubocop version is 1.59.0.
2024-01-05 15:27:09 +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
dominic-braeunlein 1591665f5d [#51305] Add Enterprise Banner and checks for OneDrive/SharePoint file storage integration (#14314)
* [#51305] Add Enterprise Banner and checks for SharePoint/OneDrive file storage integration

* chore[#51305] Add feature test for Enterprise Banner and checks for SharePoint/OneDrive

* fix[#51305] Fix file link create contract NilClass

* fix[#51305] Add ee to one_drive_create_contract_spec

* chore[#51305] Add uni test create contract

* chore[#51305] Add api tests

* chore[#51305] Add file_links create_contract tests

* [#51305] added description for api spec errors

---------

Co-authored-by: Eric Schubert <e.schubert@openproject.com>
2023-12-05 22:11:19 +03:00
ulferts 976fccb296 allow our models to have non existing attributes read for validation 2023-10-24 11:52:49 +02:00
Eric Schubert 0b4d7b7d0c [#49622] File picker broken on intermediate project folder states
- https://community.openproject.org/work_packages/49622
- added API error `OutboundRequest:Forbidden`
- fixed use case of single file request and file is forbidden
  - added requests spec
- added alerts for different project folder states
2023-08-11 18:20:28 +02:00
Eric Schubert 7ae0474fc5 [#47063] more specific api error for outbound requests 2023-03-23 10:46:36 +01:00
Eric Schubert 87290de406 [#47063] Differenciate nextcloud and open project error responses in API
- https://community.openproject.org/work_packages/47063
2023-03-22 11:25:41 +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 8814088c9d add checks on _embedded/elements when creating file links through api 2022-03-18 10:58:24 +01: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
ulferts 76409d2367 Merge branch 'release/12.0' into dev 2022-03-04 09:05:16 +01:00
Christophe Bliard bc8d423ec2 update copyright information for 2022 2022-03-01 17:05:59 +01:00
Oliver Günther 5ce926208e [41310] Avoid outputting internal statement errors
https://community.openproject.org/wp/41310
2022-03-01 09:54:10 +01:00
Oliver Günther 02d503f951 Allow passing in the model name to not found for easier matching
In case we don't have an exception, but want to show 404 anyway due
to permissions, there is no exception object to use.
Allowing to pass in the model in scope helps with the message output
2021-10-13 11:25:46 +02:00
Oliver Günther 9a3d822b35 [38842] Allow customized not found message
https://community.openproject.org/wp/38842
2021-10-13 08:37:21 +02:00
Oliver Günther ccfa29c728 Move license and copyright docs to root, fix names and references 2021-09-02 21:50:46 +02:00
Markus Kahl 8c8b8bbfa7 create backups via UI (#9136)
* create backups via UI

* Fix import of modal service

* introduced backup token and addressed remaining comments

* allow disabling permissions

* improvements

- only make user wait to use backup token in if really necessary
- notify admins of new backup token
- disable 'include attachments' option in UI if unavailable
- documentation
- misc

* spec fixes

* fixed feature spec

* allow setting capybara host in every case

* removed unused style file

* addressed review feedback, added further feature specs

* polish (code climate)

* Avoid empty attachments

* Don't raise filesize validation for internal exports

Co-authored-by: Oliver Günther <mail@oliverguenther.de>
2021-04-28 08:51:43 +01:00
ulferts 4bf7a26eb1 Capabilities API (#9083)
* Capabilities API

* introduce auxilliary capability model

* capability model and query

* render in sql

* fix pagination

* introduce sql representer

* extract abstract sql representer class

* remove yet unused methods

* abstract sql collection representer

* contract_actions as part of permissions

* filter for capability id - used in GET

* id filter validation

* remove unused representer

* remove unused wp representer

* reuse renaming class

* add spec for access control

* add principal filter to capability

* add context filter

* extract capability sql into scope

* admin gets all capabilities

* require to have one filter set to keep performance bearable

* consider active project modules for capabilities

* limit capability based on principal visiblity and user state

* rework capability to be tableless

* spec not being allowed to see on request level

* add actions to capability representer

* add action api

* extract sql index endpoint

* remove unused class

* prepare sending signaling error - not yet frontend exposed

* extract show endpoint for sql rendered responses

* use UNION for better performance

* include navigation links on collections

* remove string replacements

* extract collection representer into hal sql module

* no capabilities when blocked

* remove commented out code
2021-03-23 21:45:38 +01:00
ulferts 1bdd2ab9ae safe automatic fixes by rubocop (#8994) 2021-02-11 16:02:18 +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 38b783879a use new method to get erroring attributes 2021-01-04 20:36:14 +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
Markus Kahl c1b82bad00 direct uploads to S3 for attachments including IFC models
Co-authored-by: Oliver Günther <mail@oliverguenther.de>
2020-08-07 15:28:09 +01:00
Henriette Dinger bd7f4e4814 Update copyright notice 2020-01-15 11:31:26 +01:00
Oliver Günther 0b182f5915 Don't make error v3 specific through their identifier 2019-11-22 11:39:42 +01:00
Oliver Günther bdf3909fdf Merge remote-tracking branch 'origin/dev' into bim/feature/viewpoints 2019-11-21 22:11:14 +01:00
Oliver Günther 423efa50fe Avoid naming error warnings on codeclimate due to V2_1 2019-11-21 10:18:08 +01:00
ulferts e003ad0af7 turn scope and label unwritable 2019-11-21 09:39:22 +01:00
Oliver Günther 27fadc1b60 Provide NotImplemented error message for bitmaps 2019-11-20 14:02:25 +01:00
Oliver Günther c775dc8031 [29942] Better error messages for permission failures
[ci skip]

https://community.openproject.com/wp/29942
2019-06-04 07:43:27 +02:00
Oliver Günther e94d64f9d2 Ensure all errors accept an optional message from exception
And let the code be defined on the class
2019-05-22 13:27:39 +02:00
Oliver Günther 1b5fc32366 Avoid before blocks and raw params access for IDs
Grape's validation runs after a `before` block so we should avoid using
raw params there and instead using `declared(params)` which returns only
the validated whitelisted params, much like a permitted params hash.
2019-05-22 09:34:17 +02:00
ulferts 1850622f20 Feature/versions api update (#7299)
Feature/versions api update

[ci skip]
2019-05-22 10:29:06 +03:00
Jens Ulferts c1853a5cdd fix expected namespace for groups on assignee and responsible property 2018-08-21 10:05:42 +02:00
Oliver Günther 6ef4211e77 Bump copyright to 2018 (#6171)
[ci skip]
2018-02-12 08:51:12 +01:00
Oliver Günther e7de9169f1 Add internal error with message to Fog uploading failures
[ci skip]
2018-01-11 07:55:18 +01:00
Oliver Günther 7cf11bb689 Update copyright notice 2017-01-10 15:11:43 +01:00