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
aa6263f0
Commit
aa6263f0
authored
4 years ago
by
Seamus Lee
Browse files
Options
Downloads
Patches
Plain Diff
#1864
Revert changes to ACL test and ACL API class and update to match approved 5.28 fix
parent
3bad60ad
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CRM/ACL/API.php
+5
-3
5 additions, 3 deletions
CRM/ACL/API.php
CRM/Contact/BAO/Query.php
+4
-0
4 additions, 0 deletions
CRM/Contact/BAO/Query.php
tests/phpunit/api/v3/ACLPermissionTest.php
+7
-8
7 additions, 8 deletions
tests/phpunit/api/v3/ACLPermissionTest.php
with
16 additions
and
11 deletions
CRM/ACL/API.php
+
5
−
3
View file @
aa6263f0
...
...
@@ -88,11 +88,13 @@ class CRM_ACL_API {
// the default value which is valid for the final AND
$deleteClause
=
' ( 1 ) '
;
if
(
!
$skipDeleteClause
)
{
if
(
CRM_Core_Permission
::
check
(
'access deleted contacts'
)
and
$onlyDeleted
)
{
$deleteClause
=
'(contact_a.is_deleted)'
;
if
(
CRM_Core_Permission
::
check
(
'access deleted contacts'
))
{
if
(
$onlyDeleted
)
{
$deleteClause
=
'(contact_a.is_deleted)'
;
}
}
else
{
//
CRM-6181
//
Exclude deleted contacts due to permissions
$deleteClause
=
'(contact_a.is_deleted = 0)'
;
}
}
...
...
This diff is collapsed.
Click to expand it.
CRM/Contact/BAO/Query.php
+
4
−
0
View file @
aa6263f0
...
...
@@ -5053,6 +5053,10 @@ civicrm_relationship.start_date > {$today}
$this
->
_skipDeleteClause
);
if
(
!
$onlyDeleted
&&
CRM_Core_Permission
::
check
(
'access deleted contacts'
))
{
$this
->
_permissionWhereClause
=
str_replace
(
' ( 1 ) '
,
'(contact_a.is_deleted = 0)'
,
$this
->
_permissionWhereClause
);
}
// regenerate fromClause since permission might have added tables
if
(
$this
->
_permissionWhereClause
)
{
//fix for row count in qill (in contribute/membership find)
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/api/v3/ACLPermissionTest.php
+
7
−
8
View file @
aa6263f0
...
...
@@ -1045,26 +1045,25 @@ class api_v3_ACLPermissionTest extends CiviUnitTestCase {
$this
->
cleanupCachedPermissions
();
$vals
=
CustomValue
::
get
(
$group
)
->
execute
();
//This is dependent on PR 17379 which is being reverted just for 5.28/5.27, so commenting this out for same.
//$this->assertCount(2, $vals);
$this
->
assertCount
(
2
,
$vals
);
$this
->
allowedContactId
=
$c2
;
$this
->
hookClass
->
setHook
(
'civicrm_aclWhereClause'
,
[
$this
,
'aclWhereOnlyOne'
]);
$this
->
cleanupCachedPermissions
();
$vals
=
CustomValue
::
get
(
$group
)
->
addSelect
(
'*'
,
'contact.first_name'
)
->
execute
();
//
$this->assertCount(1, $vals);
//
$this->assertEquals($c2, $vals[0]['entity_id']);
//
$this->assertEquals('C2', $vals[0]['contact.first_name']);
$this
->
assertCount
(
1
,
$vals
);
$this
->
assertEquals
(
$c2
,
$vals
[
0
][
'entity_id'
]);
$this
->
assertEquals
(
'C2'
,
$vals
[
0
][
'contact.first_name'
]);
$vals
=
Contact
::
get
()
->
addJoin
(
'Custom_'
.
$group
.
' AS cf'
)
->
addSelect
(
'first_name'
,
'cf.'
.
$textField
)
->
addWhere
(
'is_deleted'
,
'='
,
TRUE
)
->
execute
();
//
$this->assertCount(1, $vals);
//
$this->assertEquals('C2', $vals[0]['first_name']);
//
$this->assertEquals('2', $vals[0]['cf.' . $textField]);
$this
->
assertCount
(
1
,
$vals
);
$this
->
assertEquals
(
'C2'
,
$vals
[
0
][
'first_name'
]);
$this
->
assertEquals
(
'2'
,
$vals
[
0
][
'cf.'
.
$textField
]);
}
}
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