-
Notifications
You must be signed in to change notification settings - Fork 4
CFM-496_REST_API_v2_DELETE_CO_Group_returns_400 #360
Open
Ioannis
wants to merge
2
commits into
COmanage:develop
Choose a base branch
from
Ioannis:CFM-496_REST_API_v2_DELETE_CO_Group_returns_400
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+31
−16
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -252,6 +252,13 @@ public function delete($id) { | |
| try { | ||
| $obj = $table->findById($id)->firstOrFail(); | ||
|
|
||
| // Align with REST API: do not allow delete of read-only records | ||
| if (method_exists($obj, "isReadOnly") && $obj->isReadOnly()) { | ||
| $this->Flash->error(__d('error', 'edit.readonly')); | ||
| // Redirect to view, as we do for read-only edits | ||
| return $this->redirect(['action' => 'view', $obj->id]); | ||
| } | ||
|
|
||
|
Comment on lines
+255
to
+261
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does one trigger the delete of a read only record? The UI shouldn't offer that option in the first place. |
||
| // By default, a delete is a soft delete. The exceptions is when | ||
| // deleting a CO (AR-CO-1). In v4, we permitted a controller level | ||
| // flag to be set, but the only controller this really applies to | ||
|
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not immediately obvious to me that a privileged API user should see error messages, especially on a multitenant instance where they may be trying to manipulate a record that isn't within their own CO.