Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dataprocessor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Extensions
dataprocessor
Commits
b5e45ccc
Commit
b5e45ccc
authored
1 year ago
by
jaapjansma
Browse files
Options
Downloads
Patches
Plain Diff
Fixed issue with permission to view contact. Also works now without a user record.
parent
27c408d9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Civi/DataProcessor/FilterHandler/PermissionToViewContactFilter.php
+24
-3
24 additions, 3 deletions
...Processor/FilterHandler/PermissionToViewContactFilter.php
with
24 additions
and
3 deletions
Civi/DataProcessor/FilterHandler/PermissionToViewContactFilter.php
+
24
−
3
View file @
b5e45ccc
...
...
@@ -8,6 +8,11 @@ namespace Civi\DataProcessor\FilterHandler;
use
Civi\DataProcessor\DataFlow\SqlDataFlow
;
use
Civi\DataProcessor\Exception\InvalidConfigurationException
;
use
CRM_ACL_API
;
use
CRM_ACL_BAO_ACL
;
use
CRM_Core_BAO_UFMatch
;
use
CRM_Core_Permission
;
use
CRM_Core_Session
;
use
CRM_Dataprocessor_ExtensionUtil
as
E
;
class
PermissionToViewContactFilter
extends
AbstractFieldFilterHandler
{
...
...
@@ -56,10 +61,26 @@ class PermissionToViewContactFilter extends AbstractFieldFilterHandler {
}
}
protected
function
getAclWhereClause
(
$contactI
d
=
null
)
{
protected
function
getAclWhereClause
(
$contactI
D
=
null
)
{
$tables
=
array
();
$whereTables
=
array
();
$where
=
\CRM_ACL_API
::
whereClause
(
\CRM_ACL_API
::
VIEW
,
$tables
,
$whereTables
,
$contactId
,
FALSE
,
TRUE
,
FALSE
);
if
(
!
$contactID
)
{
$contactID
=
CRM_Core_Session
::
getLoggedInContactID
();
}
$contactID
=
(
int
)
$contactID
;
$userId
=
CRM_Core_BAO_UFMatch
::
getUFId
(
$contactID
);
// first see if the contact has edit / view all permission
if
(
$userId
&&
(
CRM_Core_Permission
::
check
(
'edit all contacts'
,
$userId
)
||
CRM_Core_Permission
::
check
(
'view all contacts'
,
$userId
)))
{
return
' ( 1 ) '
;
}
$whereClause
=
CRM_ACL_BAO_ACL
::
whereClause
(
CRM_ACL_API
::
VIEW
,
$tables
,
$whereTables
,
$contactID
);
$where
=
implode
(
' AND '
,
[
$whereClause
]);
// Add permission on self if we really hate our server or have hardly any contacts.
if
(
$userId
&&
(
CRM_Core_Permission
::
check
(
'edit my contact'
,
$userId
)
||
CRM_Core_Permission
::
check
(
'view my contact'
,
$userId
)))
{
$where
=
"(contact_a.id =
$contactID
OR (
$where
))"
;
}
return
$where
;
}
...
...
@@ -115,7 +136,7 @@ class PermissionToViewContactFilter extends AbstractFieldFilterHandler {
* @return array
*/
public
function
processConfiguration
(
$submittedValues
):
array
{
list
(
$datasource
,
$field
)
=
explode
(
'::'
,
$submittedValues
[
'contact_id_field'
],
2
);
[
$datasource
,
$field
]
=
explode
(
'::'
,
$submittedValues
[
'contact_id_field'
],
2
);
$configuration
[
'field'
]
=
$field
;
$configuration
[
'datasource'
]
=
$datasource
;
return
$configuration
;
...
...
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