-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 2.5.0
- Loading branch information
Showing
4 changed files
with
79 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
use Civi\API\Event\AuthorizeEvent; | ||
|
||
class CRM_eWAYRecurring_APIWrapper { | ||
|
||
/** | ||
* React to authorization requests to allow overriding permissions on API calls | ||
*/ | ||
public static function authorize(AuthorizeEvent $event) { | ||
$callback = [ self::class, 'authorize_' . $event->getEntityName() ]; | ||
|
||
if (is_callable($callback)) { | ||
call_user_func($callback, $event); | ||
} | ||
} | ||
|
||
|
||
protected static function authorize_PaymentToken(AuthorizeEvent $event) { | ||
$requiredPermission = ($event->getActionName() == 'get') ? 'view payment tokens' : 'edit payment tokens'; | ||
|
||
if ( | ||
CRM_Core_Permission::check('access CiviContribute', $event->getUserID()) | ||
|| CRM_Core_Permission::check($requiredPermission, $event->getUserID()) | ||
) { | ||
$event->authorize(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters