@@ -30,24 +30,24 @@ |
||
30 | 30 | use OCA\User_LDAP\User_Proxy; |
31 | 31 | |
32 | 32 | abstract class UUIDFix extends QueuedJob { |
33 | - /** @var AbstractMapping */ |
|
34 | - protected $mapper; |
|
33 | + /** @var AbstractMapping */ |
|
34 | + protected $mapper; |
|
35 | 35 | |
36 | - /** @var Proxy */ |
|
37 | - protected $proxy; |
|
36 | + /** @var Proxy */ |
|
37 | + protected $proxy; |
|
38 | 38 | |
39 | - public function run($argument) { |
|
40 | - $isUser = $this->proxy instanceof User_Proxy; |
|
41 | - foreach ($argument['records'] as $record) { |
|
42 | - $access = $this->proxy->getLDAPAccess($record['name']); |
|
43 | - $uuid = $access->getUUID($record['dn'], $isUser); |
|
44 | - if ($uuid === false) { |
|
45 | - // record not found, no prob, continue with the next |
|
46 | - continue; |
|
47 | - } |
|
48 | - if ($uuid !== $record['uuid']) { |
|
49 | - $this->mapper->setUUIDbyDN($uuid, $record['dn']); |
|
50 | - } |
|
51 | - } |
|
52 | - } |
|
39 | + public function run($argument) { |
|
40 | + $isUser = $this->proxy instanceof User_Proxy; |
|
41 | + foreach ($argument['records'] as $record) { |
|
42 | + $access = $this->proxy->getLDAPAccess($record['name']); |
|
43 | + $uuid = $access->getUUID($record['dn'], $isUser); |
|
44 | + if ($uuid === false) { |
|
45 | + // record not found, no prob, continue with the next |
|
46 | + continue; |
|
47 | + } |
|
48 | + if ($uuid !== $record['uuid']) { |
|
49 | + $this->mapper->setUUIDbyDN($uuid, $record['dn']); |
|
50 | + } |
|
51 | + } |
|
52 | + } |
|
53 | 53 | } |
@@ -30,8 +30,8 @@ |
||
30 | 30 | use OCA\User_LDAP\Mapping\UserMapping; |
31 | 31 | |
32 | 32 | class UUIDFixUser extends UUIDFix { |
33 | - public function __construct(UserMapping $mapper, User_Proxy $proxy) { |
|
34 | - $this->mapper = $mapper; |
|
35 | - $this->proxy = $proxy; |
|
36 | - } |
|
33 | + public function __construct(UserMapping $mapper, User_Proxy $proxy) { |
|
34 | + $this->mapper = $mapper; |
|
35 | + $this->proxy = $proxy; |
|
36 | + } |
|
37 | 37 | } |
@@ -33,82 +33,82 @@ |
||
33 | 33 | * @package OCA\User_LDAP |
34 | 34 | */ |
35 | 35 | class DeletedUsersIndex { |
36 | - /** |
|
37 | - * @var \OCP\IConfig $config |
|
38 | - */ |
|
39 | - protected $config; |
|
36 | + /** |
|
37 | + * @var \OCP\IConfig $config |
|
38 | + */ |
|
39 | + protected $config; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @var \OCA\User_LDAP\Mapping\UserMapping $mapping |
|
43 | - */ |
|
44 | - protected $mapping; |
|
41 | + /** |
|
42 | + * @var \OCA\User_LDAP\Mapping\UserMapping $mapping |
|
43 | + */ |
|
44 | + protected $mapping; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @var array $deletedUsers |
|
48 | - */ |
|
49 | - protected $deletedUsers; |
|
50 | - /** @var IManager */ |
|
51 | - private $shareManager; |
|
46 | + /** |
|
47 | + * @var array $deletedUsers |
|
48 | + */ |
|
49 | + protected $deletedUsers; |
|
50 | + /** @var IManager */ |
|
51 | + private $shareManager; |
|
52 | 52 | |
53 | - public function __construct(\OCP\IConfig $config, UserMapping $mapping, IManager $shareManager) { |
|
54 | - $this->config = $config; |
|
55 | - $this->mapping = $mapping; |
|
56 | - $this->shareManager = $shareManager; |
|
57 | - } |
|
53 | + public function __construct(\OCP\IConfig $config, UserMapping $mapping, IManager $shareManager) { |
|
54 | + $this->config = $config; |
|
55 | + $this->mapping = $mapping; |
|
56 | + $this->shareManager = $shareManager; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * reads LDAP users marked as deleted from the database |
|
61 | - * @return \OCA\User_LDAP\User\OfflineUser[] |
|
62 | - */ |
|
63 | - private function fetchDeletedUsers() { |
|
64 | - $deletedUsers = $this->config->getUsersForUserValue( |
|
65 | - 'user_ldap', 'isDeleted', '1'); |
|
59 | + /** |
|
60 | + * reads LDAP users marked as deleted from the database |
|
61 | + * @return \OCA\User_LDAP\User\OfflineUser[] |
|
62 | + */ |
|
63 | + private function fetchDeletedUsers() { |
|
64 | + $deletedUsers = $this->config->getUsersForUserValue( |
|
65 | + 'user_ldap', 'isDeleted', '1'); |
|
66 | 66 | |
67 | - $userObjects = []; |
|
68 | - foreach ($deletedUsers as $user) { |
|
69 | - $userObjects[] = new OfflineUser($user, $this->config, $this->mapping, $this->shareManager); |
|
70 | - } |
|
71 | - $this->deletedUsers = $userObjects; |
|
67 | + $userObjects = []; |
|
68 | + foreach ($deletedUsers as $user) { |
|
69 | + $userObjects[] = new OfflineUser($user, $this->config, $this->mapping, $this->shareManager); |
|
70 | + } |
|
71 | + $this->deletedUsers = $userObjects; |
|
72 | 72 | |
73 | - return $this->deletedUsers; |
|
74 | - } |
|
73 | + return $this->deletedUsers; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * returns all LDAP users that are marked as deleted |
|
78 | - * @return \OCA\User_LDAP\User\OfflineUser[] |
|
79 | - */ |
|
80 | - public function getUsers() { |
|
81 | - if (is_array($this->deletedUsers)) { |
|
82 | - return $this->deletedUsers; |
|
83 | - } |
|
84 | - return $this->fetchDeletedUsers(); |
|
85 | - } |
|
76 | + /** |
|
77 | + * returns all LDAP users that are marked as deleted |
|
78 | + * @return \OCA\User_LDAP\User\OfflineUser[] |
|
79 | + */ |
|
80 | + public function getUsers() { |
|
81 | + if (is_array($this->deletedUsers)) { |
|
82 | + return $this->deletedUsers; |
|
83 | + } |
|
84 | + return $this->fetchDeletedUsers(); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * whether at least one user was detected as deleted |
|
89 | - * @return bool |
|
90 | - */ |
|
91 | - public function hasUsers() { |
|
92 | - if (!is_array($this->deletedUsers)) { |
|
93 | - $this->fetchDeletedUsers(); |
|
94 | - } |
|
95 | - return is_array($this->deletedUsers) && (count($this->deletedUsers) > 0); |
|
96 | - } |
|
87 | + /** |
|
88 | + * whether at least one user was detected as deleted |
|
89 | + * @return bool |
|
90 | + */ |
|
91 | + public function hasUsers() { |
|
92 | + if (!is_array($this->deletedUsers)) { |
|
93 | + $this->fetchDeletedUsers(); |
|
94 | + } |
|
95 | + return is_array($this->deletedUsers) && (count($this->deletedUsers) > 0); |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * marks a user as deleted |
|
100 | - * |
|
101 | - * @param string $ocName |
|
102 | - * @throws \OCP\PreConditionNotMetException |
|
103 | - */ |
|
104 | - public function markUser($ocName) { |
|
105 | - $curValue = $this->config->getUserValue($ocName, 'user_ldap', 'isDeleted', '0'); |
|
106 | - if ($curValue === '1') { |
|
107 | - // the user is already marked, do not write to DB again |
|
108 | - return; |
|
109 | - } |
|
110 | - $this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1'); |
|
111 | - $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string)time()); |
|
112 | - $this->deletedUsers = null; |
|
113 | - } |
|
98 | + /** |
|
99 | + * marks a user as deleted |
|
100 | + * |
|
101 | + * @param string $ocName |
|
102 | + * @throws \OCP\PreConditionNotMetException |
|
103 | + */ |
|
104 | + public function markUser($ocName) { |
|
105 | + $curValue = $this->config->getUserValue($ocName, 'user_ldap', 'isDeleted', '0'); |
|
106 | + if ($curValue === '1') { |
|
107 | + // the user is already marked, do not write to DB again |
|
108 | + return; |
|
109 | + } |
|
110 | + $this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1'); |
|
111 | + $this->config->setUserValue($ocName, 'user_ldap', 'foundDeleted', (string)time()); |
|
112 | + $this->deletedUsers = null; |
|
113 | + } |
|
114 | 114 | } |
@@ -32,18 +32,18 @@ |
||
32 | 32 | * @since 9.1.0 |
33 | 33 | */ |
34 | 34 | interface INotifyStorage { |
35 | - public const NOTIFY_ADDED = 1; |
|
36 | - public const NOTIFY_REMOVED = 2; |
|
37 | - public const NOTIFY_MODIFIED = 3; |
|
38 | - public const NOTIFY_RENAMED = 4; |
|
35 | + public const NOTIFY_ADDED = 1; |
|
36 | + public const NOTIFY_REMOVED = 2; |
|
37 | + public const NOTIFY_MODIFIED = 3; |
|
38 | + public const NOTIFY_RENAMED = 4; |
|
39 | 39 | |
40 | - /** |
|
41 | - * Start the notification handler for this storage |
|
42 | - * |
|
43 | - * @param $path |
|
44 | - * @return INotifyHandler |
|
45 | - * |
|
46 | - * @since 12.0.0 |
|
47 | - */ |
|
48 | - public function notify($path); |
|
40 | + /** |
|
41 | + * Start the notification handler for this storage |
|
42 | + * |
|
43 | + * @param $path |
|
44 | + * @return INotifyHandler |
|
45 | + * |
|
46 | + * @since 12.0.0 |
|
47 | + */ |
|
48 | + public function notify($path); |
|
49 | 49 | } |
@@ -34,21 +34,21 @@ |
||
34 | 34 | * @deprecated 18.0.0 use events and the \OCP\EventDispatcher\IEventDispatcher service |
35 | 35 | */ |
36 | 36 | interface Emitter { |
37 | - /** |
|
38 | - * @param string $scope |
|
39 | - * @param string $method |
|
40 | - * @param callable $callback |
|
41 | - * @return void |
|
42 | - * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::addListener |
|
43 | - */ |
|
44 | - public function listen($scope, $method, callable $callback); |
|
37 | + /** |
|
38 | + * @param string $scope |
|
39 | + * @param string $method |
|
40 | + * @param callable $callback |
|
41 | + * @return void |
|
42 | + * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::addListener |
|
43 | + */ |
|
44 | + public function listen($scope, $method, callable $callback); |
|
45 | 45 | |
46 | - /** |
|
47 | - * @param string $scope optional |
|
48 | - * @param string $method optional |
|
49 | - * @param callable $callback optional |
|
50 | - * @return void |
|
51 | - * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::removeListener |
|
52 | - */ |
|
53 | - public function removeListener($scope = null, $method = null, callable $callback = null); |
|
46 | + /** |
|
47 | + * @param string $scope optional |
|
48 | + * @param string $method optional |
|
49 | + * @param callable $callback optional |
|
50 | + * @return void |
|
51 | + * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::removeListener |
|
52 | + */ |
|
53 | + public function removeListener($scope = null, $method = null, callable $callback = null); |
|
54 | 54 | } |
@@ -29,15 +29,15 @@ |
||
29 | 29 | * @deprecated 18.0.0 use events and the \OCP\EventDispatcher\IEventDispatcher service |
30 | 30 | */ |
31 | 31 | class PublicEmitter extends BasicEmitter { |
32 | - /** |
|
33 | - * @param string $scope |
|
34 | - * @param string $method |
|
35 | - * @param array $arguments optional |
|
36 | - * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped |
|
37 | - * |
|
38 | - * @suppress PhanAccessMethodProtected |
|
39 | - */ |
|
40 | - public function emit($scope, $method, array $arguments = []) { |
|
41 | - parent::emit($scope, $method, $arguments); |
|
42 | - } |
|
32 | + /** |
|
33 | + * @param string $scope |
|
34 | + * @param string $method |
|
35 | + * @param array $arguments optional |
|
36 | + * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped |
|
37 | + * |
|
38 | + * @suppress PhanAccessMethodProtected |
|
39 | + */ |
|
40 | + public function emit($scope, $method, array $arguments = []) { |
|
41 | + parent::emit($scope, $method, $arguments); |
|
42 | + } |
|
43 | 43 | } |
@@ -37,21 +37,21 @@ |
||
37 | 37 | */ |
38 | 38 | class GroupBackendRegistered extends Event { |
39 | 39 | |
40 | - /** @var GroupPluginManager */ |
|
41 | - private $pluginManager; |
|
42 | - /** @var IGroupLDAP */ |
|
43 | - private $backend; |
|
44 | - |
|
45 | - public function __construct(IGroupLDAP $backend, GroupPluginManager $pluginManager) { |
|
46 | - $this->pluginManager = $pluginManager; |
|
47 | - $this->backend = $backend; |
|
48 | - } |
|
49 | - |
|
50 | - public function getBackend(): IGroupLDAP { |
|
51 | - return $this->backend; |
|
52 | - } |
|
53 | - |
|
54 | - public function getPluginManager(): GroupPluginManager { |
|
55 | - return $this->pluginManager; |
|
56 | - } |
|
40 | + /** @var GroupPluginManager */ |
|
41 | + private $pluginManager; |
|
42 | + /** @var IGroupLDAP */ |
|
43 | + private $backend; |
|
44 | + |
|
45 | + public function __construct(IGroupLDAP $backend, GroupPluginManager $pluginManager) { |
|
46 | + $this->pluginManager = $pluginManager; |
|
47 | + $this->backend = $backend; |
|
48 | + } |
|
49 | + |
|
50 | + public function getBackend(): IGroupLDAP { |
|
51 | + return $this->backend; |
|
52 | + } |
|
53 | + |
|
54 | + public function getPluginManager(): GroupPluginManager { |
|
55 | + return $this->pluginManager; |
|
56 | + } |
|
57 | 57 | } |
@@ -37,21 +37,21 @@ |
||
37 | 37 | */ |
38 | 38 | class UserBackendRegistered extends Event { |
39 | 39 | |
40 | - /** @var IUserLDAP */ |
|
41 | - private $backend; |
|
42 | - /** @var UserPluginManager */ |
|
43 | - private $pluginManager; |
|
44 | - |
|
45 | - public function __construct(IUserLDAP $backend, UserPluginManager $pluginManager) { |
|
46 | - $this->backend = $backend; |
|
47 | - $this->pluginManager = $pluginManager; |
|
48 | - } |
|
49 | - |
|
50 | - public function getBackend(): IUserLDAP { |
|
51 | - return $this->backend; |
|
52 | - } |
|
53 | - |
|
54 | - public function getPluginManager(): UserPluginManager { |
|
55 | - return $this->pluginManager; |
|
56 | - } |
|
40 | + /** @var IUserLDAP */ |
|
41 | + private $backend; |
|
42 | + /** @var UserPluginManager */ |
|
43 | + private $pluginManager; |
|
44 | + |
|
45 | + public function __construct(IUserLDAP $backend, UserPluginManager $pluginManager) { |
|
46 | + $this->backend = $backend; |
|
47 | + $this->pluginManager = $pluginManager; |
|
48 | + } |
|
49 | + |
|
50 | + public function getBackend(): IUserLDAP { |
|
51 | + return $this->backend; |
|
52 | + } |
|
53 | + |
|
54 | + public function getPluginManager(): UserPluginManager { |
|
55 | + return $this->pluginManager; |
|
56 | + } |
|
57 | 57 | } |
@@ -41,31 +41,31 @@ |
||
41 | 41 | use Symfony\Component\EventDispatcher\GenericEvent; |
42 | 42 | |
43 | 43 | class Application extends App implements IBootstrap { |
44 | - public const APP_ID = 'lookup_server_connector'; |
|
44 | + public const APP_ID = 'lookup_server_connector'; |
|
45 | 45 | |
46 | - public function __construct() { |
|
47 | - parent::__construct(self::APP_ID); |
|
48 | - } |
|
46 | + public function __construct() { |
|
47 | + parent::__construct(self::APP_ID); |
|
48 | + } |
|
49 | 49 | |
50 | - public function register(IRegistrationContext $context): void { |
|
51 | - } |
|
50 | + public function register(IRegistrationContext $context): void { |
|
51 | + } |
|
52 | 52 | |
53 | - public function boot(IBootContext $context): void { |
|
54 | - $context->injectFn(Closure::fromCallable([$this, 'registerEventListeners'])); |
|
55 | - } |
|
53 | + public function boot(IBootContext $context): void { |
|
54 | + $context->injectFn(Closure::fromCallable([$this, 'registerEventListeners'])); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @todo move the OCP events and then move the registration to `register` |
|
59 | - */ |
|
60 | - private function registerEventListeners(EventDispatcher $dispatcher, |
|
61 | - IAppContainer $appContainer): void { |
|
62 | - $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($appContainer) { |
|
63 | - /** @var IUser $user */ |
|
64 | - $user = $event->getSubject(); |
|
57 | + /** |
|
58 | + * @todo move the OCP events and then move the registration to `register` |
|
59 | + */ |
|
60 | + private function registerEventListeners(EventDispatcher $dispatcher, |
|
61 | + IAppContainer $appContainer): void { |
|
62 | + $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($appContainer) { |
|
63 | + /** @var IUser $user */ |
|
64 | + $user = $event->getSubject(); |
|
65 | 65 | |
66 | - /** @var UpdateLookupServer $updateLookupServer */ |
|
67 | - $updateLookupServer = $appContainer->get(UpdateLookupServer::class); |
|
68 | - $updateLookupServer->userUpdated($user); |
|
69 | - }); |
|
70 | - } |
|
66 | + /** @var UpdateLookupServer $updateLookupServer */ |
|
67 | + $updateLookupServer = $appContainer->get(UpdateLookupServer::class); |
|
68 | + $updateLookupServer->userUpdated($user); |
|
69 | + }); |
|
70 | + } |
|
71 | 71 | } |