// This is an individual permission
$granted = CRM_Core_Config::singleton()->userPermissionClass->check($permission, $userId);
// Call the permission_check hook to permit dynamic escalation (CRM-19256)
- CRM_Utils_Hook::permission_check($permission, $granted);
+ CRM_Utils_Hook::permission_check($permission, $granted, $contactId);
if (
!$granted
&& !($tempPerm && $tempPerm->check($permission))
* The name of an atomic permission, ie. 'access deleted contacts'
* @param bool $granted
* Whether this permission is currently granted. The hook can change this value.
+ * @param int $contactId
+ * Contact whose permissions we are checking (if null, assume current user).
*
* @return null
* The return value is ignored
*/
- public static function permission_check($permission, &$granted) {
- return self::singleton()->invoke(array('permission', 'granted'), $permission, $granted,
- self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+ public static function permission_check($permission, &$granted, $contactId) {
+ return self::singleton()->invoke(array('permission', 'granted', 'contactId'), $permission, $granted, $contactId,
+ self::$_nullObject, self::$_nullObject, self::$_nullObject,
'civicrm_permission_check'
);
}