1: <?php
2: /*
3: * SimpleID
4: *
5: * Copyright (C) Kelvin Mo 2021-2025
6: *
7: * This program is free software; you can redistribute it and/or
8: * modify it under the terms of the GNU General Public
9: * License as published by the Free Software Foundation; either
10: * version 2 of the License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program; if not, write to the Free
19: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20: *
21: */
22:
23: namespace SimpleID\Base;
24:
25: use SimpleID\Models\User;
26: use SimpleID\Util\Events\GenericEventTrait;
27:
28: /**
29: * Event where a change has occurred to a user consent.
30: *
31: * The `$eventName` can be one of the following:
32: *
33: * - `consent_revoke`
34: */
35: class ConsentEvent extends AuditEvent implements \GenericEventInterface {
36: use GenericEventTrait;
37:
38: /** @var string */
39: protected $cid;
40:
41: /** @var array<string, mixed> */
42: protected $prefs;
43:
44: /**
45: * @param string $eventName
46: * @param User $user
47: * @param string $cid
48: * @param array<string, mixed> $prefs
49: */
50: public function __construct($eventName, $user, $cid, $prefs) {
51: parent::__construct($user);
52:
53: $this->setEventName($eventName);
54: $this->cid = $cid;
55: $this->prefs = $prefs;
56: }
57:
58: /**
59: * @return string
60: */
61: public function getConsentID() {
62: return $this->cid;
63: }
64:
65: /**
66: * @return array<string, mixed>
67: */
68: public function getUserPrefs() {
69: return $this->prefs;
70: }
71: }
72:
73: ?>