This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
[SDPAP-7716] Added managed file element type and related settings. #82
Open
MdNadimHossain
wants to merge
17
commits into
develop
Choose a base branch
from
feature/SDPAP-7716-add-file-upload-field
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.
Open
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ef0bee2
[SDPAP-7716] Added managed file element type and related settings.
MdNadimHossain 85f5461
[SDPAP-7716] Updated lint fix.
MdNadimHossain 2fcdda5
Updated hook.
MdNadimHossain e495a8a
[SDPAP-7717] Form submission with attachments (#85)
edyuenyw 246f4ae
Merge branch 'develop' into feature/SDPAP-7716-add-file-upload-field
MdNadimHossain a1d9b22
Merged develop changes.
MdNadimHossain 9b30400
[SDPAP-7716] Added more changes.
MdNadimHossain 9e4c3fe
Updated the patch.
MdNadimHossain 986d1c4
Added lint fix.
MdNadimHossain 6e32017
[SDPAP-7716] Added file delete restrictions trhough json api.
MdNadimHossain ea1423b
[SDPAP-7716] Updated the custom validation.
MdNadimHossain 45b9a6c
[SDPAP-7716] Updated the custom validation.
MdNadimHossain 41123c9
[SDPAP-7716] lint issues fixed.
MdNadimHossain 96c2e2c
[SDPAP-7716] lint issues fixed.
MdNadimHossain f82dee0
[SDPAP-7716] Reverting routing event subscribing changes.
MdNadimHossain ccddacf
[SDPAP-7716] Updated the cusom validation to allow upto 10 attachments.
MdNadimHossain 39d3481
[SDPAP-7716] Updated the cusom validation message.
MdNadimHossain 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
17 changes: 17 additions & 0 deletions
17
config/optional/rest.resource.webform_rest_file_upload.yml
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- serialization | ||
- user | ||
- webform_rest | ||
id: webform_rest_file_upload | ||
plugin_id: webform_rest_file_upload | ||
granularity: resource | ||
configuration: | ||
methods: | ||
- POST | ||
formats: | ||
- json | ||
authentication: | ||
- cookie |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Drupal\tide_webform\Routing; | ||
|
||
use Drupal\Core\Routing\RouteSubscriberBase; | ||
use Symfony\Component\Routing\RouteCollection; | ||
|
||
/** | ||
* Class JsonapiLimitingRouteSubscriber. | ||
* | ||
* Remove all DELETE routes from jsonapi resources to protect content. | ||
* | ||
* Remove POST and PATCH routes from jsonapi resources except for those | ||
* we want end users to create and update via the decoupled API. | ||
*/ | ||
class JsonapiLimitingRouteSubscriber extends RouteSubscriberBase { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function alterRoutes(RouteCollection $collection) { | ||
$mutable_types = $this->mutableResourceTypes(); | ||
foreach ($collection as $name => $route) { | ||
$defaults = $route->getDefaults(); | ||
if (!empty($defaults['_is_jsonapi']) && !empty($defaults['resource_type'])) { | ||
$methods = $route->getMethods(); | ||
if (in_array('DELETE', $methods)) { | ||
// We never want to delete data, only unpublish. | ||
$collection->remove($name); | ||
} | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Get mutable resource types, exposed to user changes via API. | ||
* | ||
* @return array | ||
* List of mutable jsonapi resource types as keys. | ||
*/ | ||
public function mutableResourceTypes(): array { | ||
return [ | ||
'file--file' => TRUE, | ||
]; | ||
} | ||
|
||
} |
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
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.
added this service to block deleting files using json api