Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
42f0bf16
Commit
42f0bf16
authored
3 years ago
by
colemanw
Browse files
Options
Downloads
Patches
Plain Diff
Move acl delete logic to an event listener
parent
594db85b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/ACL/BAO/ACL.php
+13
-8
13 additions, 8 deletions
CRM/ACL/BAO/ACL.php
Civi/Core/Event/EventScanner.php
+1
-1
1 addition, 1 deletion
Civi/Core/Event/EventScanner.php
with
14 additions
and
9 deletions
CRM/ACL/BAO/ACL.php
+
13
−
8
View file @
42f0bf16
...
...
@@ -18,7 +18,7 @@
/**
* Access Control List
*/
class
CRM_ACL_BAO_ACL
extends
CRM_ACL_DAO_ACL
{
class
CRM_ACL_BAO_ACL
extends
CRM_ACL_DAO_ACL
implements
\Civi\Test\HookInterface
{
/**
* Available operations for pseudoconstant.
...
...
@@ -433,16 +433,21 @@ SELECT g.*
* Delete ACL records.
*
* @param int $aclId
* ID of the ACL record to be deleted.
*
* @deprecated
*/
public
static
function
del
(
$aclId
)
{
// delete all entries from the acl cache
CRM_ACL_BAO_Cache
::
resetCache
();
self
::
deleteRecord
([
'id'
=>
$aclId
]);
}
$acl
=
new
CRM_ACL_DAO_ACL
();
$acl
->
id
=
$aclId
;
$acl
->
delete
();
/**
* Event fired before an action is taken on an ACL record.
* @param \Civi\Core\Event\PreEvent $event
*/
public
static
function
self_hook_civicrm_pre
(
\Civi\Core\Event\PreEvent
$event
)
{
// Reset cache when deleting an ACL record
if
(
$event
->
action
===
'delete'
)
{
CRM_ACL_BAO_Cache
::
resetCache
();
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
Civi/Core/Event/EventScanner.php
+
1
−
1
View file @
42f0bf16
...
...
@@ -53,7 +53,7 @@ class EventScanner {
* @param string|null $self
* If the target $class is focused on a specific entity/form/etc, use the `$self` parameter to specify it.
* This will activate support for `self_{$event}` methods.
* Ex: if '$self' is 'Contact', then 'function self_hook_civicrm_pre()' maps to 'hook_civicrm_pre::Contact'.
* Ex: if '$self' is 'Contact', then 'function self_hook_civicrm_pre()' maps to '
on_
hook_civicrm_pre::Contact'.
* @return array
* List of events/listeners. Format is compatible with 'getSubscribedEvents()'.
* Ex: ['some.event' => [['firstFunc'], ['secondFunc']]
...
...
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