Merge pull request #18723 from colemanw/crmSearchCleanup
[civicrm-core.git] / Civi / Api4 / Action / Contact / ValidateChecksum.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
6 | |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
11 */
12
13 /**
14 *
15 * @package CRM
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 */
18
19
20 namespace Civi\Api4\Action\Contact;
21
22 use Civi\Api4\Generic\Result;
23
24 /**
25 * Generate a security checksum for anonymous access to CiviCRM.
26 *
27 * @method $this setContactId(int $cid) Set contact ID (required)
28 * @method int getContactId() Get contact ID param
29 * @method $this setChecksum(string $checksum) Set checksum param (required)
30 * @method string getChecksum() Get checksum param
31 */
32 class ValidateChecksum extends \Civi\Api4\Generic\AbstractAction {
33
34 /**
35 * ID of contact
36 *
37 * @var int
38 * @required
39 */
40 protected $contactId;
41
42 /**
43 * Value of checksum
44 *
45 * @var string
46 * @required
47 */
48 protected $checksum;
49
50 /**
51 * @param \Civi\Api4\Generic\Result $result
52 */
53 public function _run(Result $result) {
54 $result[] = [
55 'valid' => \CRM_Contact_BAO_Contact_Utils::validChecksum($this->contactId, $this->checksum),
56 ];
57 }
58
59 }