3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 class CRM_OAuth_BAO_OAuthSysToken
extends CRM_OAuth_DAO_OAuthSysToken
{
19 private static $returnFields = ['id', 'client_id', 'expires'];
22 * Create a new OAuthSysToken based on array-data
24 * @param array $params key-value pairs
25 * @return CRM_OAuth_DAO_OAuthSysToken|NULL
27 * public static function create($params) {
28 * $className = 'CRM_OAuth_DAO_OAuthSysToken';
29 * $entityName = 'OAuthSysToken';
30 * $hook = empty($params['id']) ? 'create' : 'edit';
32 * CRM_Utils_Hook::pre($hook, $entityName, CRM_Utils_Array::value('id', $params), $params);
33 * $instance = new $className();
34 * $instance->copyValues($params);
36 * CRM_Utils_Hook::post($hook, $entityName, $instance->id, $instance);
42 * Redact the content of a token.
44 * This is useful for processes which must internally use the entire token
45 * record -- but then report on their progress to a permissioned party.
47 * @param array $tokenRecord
50 public static function redact($tokenRecord) {
51 if (!\CRM_Core_Permission
::check('manage OAuth client secrets')) {
52 return \CRM_Utils_Array
::subset($tokenRecord, self
::$returnFields);