Skip to content

Commit 2c8fe5c

Browse files
committed
feat(config): Add UserConfigChangedEvent whenever user config is updated
Signed-off-by: Akhil <akhil@e.email>
1 parent eaae5e1 commit 2c8fe5c

File tree

4 files changed

+102
-0
lines changed

4 files changed

+102
-0
lines changed

lib/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,7 @@
970970
'OCP\\User\\Events\\PasswordUpdatedEvent' => $baseDir . '/lib/public/User/Events/PasswordUpdatedEvent.php',
971971
'OCP\\User\\Events\\PostLoginEvent' => $baseDir . '/lib/public/User/Events/PostLoginEvent.php',
972972
'OCP\\User\\Events\\UserChangedEvent' => $baseDir . '/lib/public/User/Events/UserChangedEvent.php',
973+
'OCP\\User\\Events\\UserConfigChangedEvent' => $baseDir . '/lib/public/User/Events/UserConfigChangedEvent.php',
973974
'OCP\\User\\Events\\UserCreatedEvent' => $baseDir . '/lib/public/User/Events/UserCreatedEvent.php',
974975
'OCP\\User\\Events\\UserDeletedEvent' => $baseDir . '/lib/public/User/Events/UserDeletedEvent.php',
975976
'OCP\\User\\Events\\UserFirstTimeLoggedInEvent' => $baseDir . '/lib/public/User/Events/UserFirstTimeLoggedInEvent.php',

lib/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
10111011
'OCP\\User\\Events\\PasswordUpdatedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/PasswordUpdatedEvent.php',
10121012
'OCP\\User\\Events\\PostLoginEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/PostLoginEvent.php',
10131013
'OCP\\User\\Events\\UserChangedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserChangedEvent.php',
1014+
'OCP\\User\\Events\\UserConfigChangedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserConfigChangedEvent.php',
10141015
'OCP\\User\\Events\\UserCreatedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserCreatedEvent.php',
10151016
'OCP\\User\\Events\\UserDeletedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserDeletedEvent.php',
10161017
'OCP\\User\\Events\\UserFirstTimeLoggedInEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserFirstTimeLoggedInEvent.php',

lib/private/AllConfig.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
use OCP\IConfig;
1616
use OCP\IDBConnection;
1717
use OCP\PreConditionNotMetException;
18+
use OCP\EventDispatcher\IEventDispatcher;
19+
use OCP\User\Events\UserConfigChangedEvent;
1820

1921
/**
2022
* Class to combine all the configuration options ownCloud offers
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* @copyright Copyright (c) 2023 Murena SAS <akhil.potukuchi.ext@murena.com>
7+
*
8+
* @author Murena SAS <akhil.potukuchi.ext@murena.com>
9+
*
10+
* @license GNU AGPL version 3 or any later version
11+
*
12+
* This program is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU Affero General Public License as
14+
* published by the Free Software Foundation, either version 3 of the
15+
* License, or (at your option) any later version.
16+
*
17+
* This program is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU Affero General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU Affero General Public License
23+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24+
*
25+
*/
26+
27+
namespace OCP\User\Events;
28+
29+
use OCP\EventDispatcher\Event;
30+
31+
/**
32+
* @since 31.0.0
33+
*/
34+
35+
class UserConfigChangedEvent extends Event {
36+
private string $userId;
37+
private string $appId;
38+
private string $key;
39+
private mixed $value;
40+
private mixed $oldValue;
41+
42+
/**
43+
* @since 31.0.0
44+
*/
45+
46+
public function __construct(string $userId,
47+
string $appId,
48+
string $key,
49+
mixed $value,
50+
mixed $oldValue = null) {
51+
parent::__construct();
52+
$this->userId = $userId;
53+
$this->appId = $appId;
54+
$this->key = $key;
55+
$this->value = $value;
56+
$this->oldValue = $oldValue;
57+
}
58+
59+
/**
60+
* @return string
61+
* @since 31.0.0
62+
*/
63+
public function getUserId(): string {
64+
return $this->userId;
65+
}
66+
67+
/**
68+
* @return string
69+
* @since 31.0.0
70+
*/
71+
public function getAppId(): string {
72+
return $this->appId;
73+
}
74+
75+
/**
76+
* @return string
77+
* @since 31.0.0
78+
*/
79+
public function getKey(): string {
80+
return $this->key;
81+
}
82+
83+
/**
84+
* @return mixed
85+
* @since 31.0.0
86+
*/
87+
public function getValue() {
88+
return $this->value;
89+
}
90+
91+
/**
92+
* @return mixed
93+
* @since 31.0.0
94+
*/
95+
public function getOldValue() {
96+
return $this->oldValue;
97+
}
98+
}

0 commit comments

Comments
 (0)