Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
eca
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
eca
Commits
010bf30f
Commit
010bf30f
authored
2 years ago
by
Jürgen Haas
Committed by
Jürgen Haas
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3303087
by jurgenhaas, mxh: Misleading debug message from the load entity plugin
parent
6a21040f
No related branches found
No related tags found
1 merge request
!226
Issue #3280069: eca_base: Provide an action for translating text
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/content/src/Plugin/Action/LoadEntity.php
+11
-0
11 additions, 0 deletions
modules/content/src/Plugin/Action/LoadEntity.php
src/Entity/Objects/EcaAction.php
+8
-2
8 additions, 2 deletions
src/Entity/Objects/EcaAction.php
with
19 additions
and
2 deletions
modules/content/src/Plugin/Action/LoadEntity.php
+
11
−
0
View file @
010bf30f
...
...
@@ -3,6 +3,7 @@
namespace
Drupal\eca_content\Plugin\Action
;
use
Drupal\Core\Access\AccessResult
;
use
Drupal\Core\Access\AccessResultReasonInterface
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Session\AccountInterface
;
...
...
@@ -52,8 +53,18 @@ class LoadEntity extends ConfigurableActionBase {
*/
public
function
access
(
$object
,
?AccountInterface
$account
=
NULL
,
$return_as_object
=
FALSE
)
{
$access_result
=
AccessResult
::
forbidden
();
$reason
=
NULL
;
if
(
$entity
=
$this
->
doLoadEntity
(
$object
))
{
$access_result
=
$entity
->
access
(
'view'
,
$account
,
TRUE
);
if
(
!
$access_result
->
isAllowed
())
{
$reason
=
'No permission to view the entity.'
;
}
}
else
{
$reason
=
'No entity available.'
;
}
if
(
$reason
!==
NULL
&&
$access_result
instanceof
AccessResultReasonInterface
)
{
$access_result
->
setReason
(
$reason
);
}
return
$return_as_object
?
$access_result
:
$access_result
->
isAllowed
();
}
...
...
This diff is collapsed.
Click to expand it.
src/Entity/Objects/EcaAction.php
+
8
−
2
View file @
010bf30f
...
...
@@ -3,6 +3,7 @@
namespace
Drupal\eca\Entity\Objects
;
use
Drupal\Component\Plugin\ConfigurableInterface
;
use
Drupal\Core\Access\AccessResultReasonInterface
;
use
Drupal\eca\Plugin\Action\ActionInterface
;
use
Drupal\eca\Entity\Eca
;
use
Drupal\Core\Action\ActionInterface
as
CoreActionInterface
;
...
...
@@ -92,12 +93,17 @@ class EcaAction extends EcaObject implements ObjectWithPluginInterface {
$this
->
eventDispatcher
()
->
dispatch
(
$before_event
,
EcaEvents
::
BEFORE_ACTION_EXECUTION
);
try
{
$access_granted
=
$this
->
plugin
->
access
(
$object
);
/** @var \Drupal\Core\Access\AccessResultReasonInterface $access_result */
$access_result
=
$this
->
plugin
->
access
(
$object
,
NULL
,
TRUE
);
$access_granted
=
$access_result
->
isAllowed
();
if
(
$access_granted
)
{
$this
->
plugin
->
execute
(
$object
);
}
else
{
$this
->
logger
()
->
warning
(
'Access denied to %actionlabel (%actionid) from ECA %ecalabel (%ecaid) for event %event.'
,
$context
);
$context
[
'%reason'
]
=
$access_result
instanceof
AccessResultReasonInterface
?
$access_result
->
getReason
()
:
'unknown'
;
$this
->
logger
()
->
warning
(
'Access denied to %actionlabel (%actionid) from ECA %ecalabel (%ecaid) for event %event: %reason'
,
$context
);
}
}
catch
(
\Exception
$ex
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment