| @@ -61,219 +61,219 @@ | ||
| 61 | 61 | * @package OC\Core | 
| 62 | 62 | */ | 
| 63 | 63 |  class Application extends App { | 
| 64 | -	public function __construct() { | |
| 65 | -		parent::__construct('core'); | |
| 66 | - | |
| 67 | - $container = $this->getContainer(); | |
| 68 | - | |
| 69 | -		$container->registerService('defaultMailAddress', function () { | |
| 70 | -			return Util::getDefaultEmailAddress('lostpassword-noreply'); | |
| 71 | - }); | |
| 72 | - | |
| 73 | - $server = $container->getServer(); | |
| 74 | - /** @var IEventDispatcher $eventDispatcher */ | |
| 75 | - $eventDispatcher = $server->query(IEventDispatcher::class); | |
| 76 | - | |
| 77 | - $notificationManager = $server->getNotificationManager(); | |
| 78 | - $notificationManager->registerNotifierService(CoreNotifier::class); | |
| 79 | - $notificationManager->registerNotifierService(AuthenticationNotifier::class); | |
| 80 | - | |
| 81 | - $oldEventDispatcher = $server->getEventDispatcher(); | |
| 82 | - | |
| 83 | - $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT, | |
| 84 | -			function (GenericEvent $event) use ($container) { | |
| 85 | - /** @var MissingIndexInformation $subject */ | |
| 86 | - $subject = $event->getSubject(); | |
| 87 | - | |
| 88 | - $schema = new SchemaWrapper($container->query(Connection::class)); | |
| 89 | - | |
| 90 | -				if ($schema->hasTable('share')) { | |
| 91 | -					$table = $schema->getTable('share'); | |
| 92 | - | |
| 93 | -					if (!$table->hasIndex('share_with_index')) { | |
| 94 | - $subject->addHintForMissingSubject($table->getName(), 'share_with_index'); | |
| 95 | - } | |
| 96 | -					if (!$table->hasIndex('parent_index')) { | |
| 97 | - $subject->addHintForMissingSubject($table->getName(), 'parent_index'); | |
| 98 | - } | |
| 99 | -					if (!$table->hasIndex('owner_index')) { | |
| 100 | - $subject->addHintForMissingSubject($table->getName(), 'owner_index'); | |
| 101 | - } | |
| 102 | -					if (!$table->hasIndex('initiator_index')) { | |
| 103 | - $subject->addHintForMissingSubject($table->getName(), 'initiator_index'); | |
| 104 | - } | |
| 105 | - } | |
| 106 | - | |
| 107 | -				if ($schema->hasTable('filecache')) { | |
| 108 | -					$table = $schema->getTable('filecache'); | |
| 109 | - | |
| 110 | -					if (!$table->hasIndex('fs_mtime')) { | |
| 111 | - $subject->addHintForMissingSubject($table->getName(), 'fs_mtime'); | |
| 112 | - } | |
| 113 | - | |
| 114 | -					if (!$table->hasIndex('fs_size')) { | |
| 115 | - $subject->addHintForMissingSubject($table->getName(), 'fs_size'); | |
| 116 | - } | |
| 117 | - } | |
| 118 | - | |
| 119 | -				if ($schema->hasTable('twofactor_providers')) { | |
| 120 | -					$table = $schema->getTable('twofactor_providers'); | |
| 121 | - | |
| 122 | -					if (!$table->hasIndex('twofactor_providers_uid')) { | |
| 123 | - $subject->addHintForMissingSubject($table->getName(), 'twofactor_providers_uid'); | |
| 124 | - } | |
| 125 | - } | |
| 126 | - | |
| 127 | -				if ($schema->hasTable('login_flow_v2')) { | |
| 128 | -					$table = $schema->getTable('login_flow_v2'); | |
| 129 | - | |
| 130 | -					if (!$table->hasIndex('poll_token')) { | |
| 131 | - $subject->addHintForMissingSubject($table->getName(), 'poll_token'); | |
| 132 | - } | |
| 133 | -					if (!$table->hasIndex('login_token')) { | |
| 134 | - $subject->addHintForMissingSubject($table->getName(), 'login_token'); | |
| 135 | - } | |
| 136 | -					if (!$table->hasIndex('timestamp')) { | |
| 137 | - $subject->addHintForMissingSubject($table->getName(), 'timestamp'); | |
| 138 | - } | |
| 139 | - } | |
| 140 | - | |
| 141 | -				if ($schema->hasTable('whats_new')) { | |
| 142 | -					$table = $schema->getTable('whats_new'); | |
| 143 | - | |
| 144 | -					if (!$table->hasIndex('version')) { | |
| 145 | - $subject->addHintForMissingSubject($table->getName(), 'version'); | |
| 146 | - } | |
| 147 | - } | |
| 148 | - | |
| 149 | -				if ($schema->hasTable('cards')) { | |
| 150 | -					$table = $schema->getTable('cards'); | |
| 151 | - | |
| 152 | -					if (!$table->hasIndex('cards_abid')) { | |
| 153 | - $subject->addHintForMissingSubject($table->getName(), 'cards_abid'); | |
| 154 | - } | |
| 155 | - | |
| 156 | -					if (!$table->hasIndex('cards_abiduri')) { | |
| 157 | - $subject->addHintForMissingSubject($table->getName(), 'cards_abiduri'); | |
| 158 | - } | |
| 159 | - } | |
| 160 | - | |
| 161 | -				if ($schema->hasTable('cards_properties')) { | |
| 162 | -					$table = $schema->getTable('cards_properties'); | |
| 163 | - | |
| 164 | -					if (!$table->hasIndex('cards_prop_abid')) { | |
| 165 | - $subject->addHintForMissingSubject($table->getName(), 'cards_prop_abid'); | |
| 166 | - } | |
| 167 | - } | |
| 168 | - | |
| 169 | -				if ($schema->hasTable('calendarobjects_props')) { | |
| 170 | -					$table = $schema->getTable('calendarobjects_props'); | |
| 171 | - | |
| 172 | -					if (!$table->hasIndex('calendarobject_calid_index')) { | |
| 173 | - $subject->addHintForMissingSubject($table->getName(), 'calendarobject_calid_index'); | |
| 174 | - } | |
| 175 | - } | |
| 176 | - | |
| 177 | -				if ($schema->hasTable('schedulingobjects')) { | |
| 178 | -					$table = $schema->getTable('schedulingobjects'); | |
| 179 | -					if (!$table->hasIndex('schedulobj_principuri_index')) { | |
| 180 | - $subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index'); | |
| 181 | - } | |
| 182 | - } | |
| 183 | - | |
| 184 | -				if ($schema->hasTable('properties')) { | |
| 185 | -					$table = $schema->getTable('properties'); | |
| 186 | -					if (!$table->hasIndex('properties_path_index')) { | |
| 187 | - $subject->addHintForMissingSubject($table->getName(), 'properties_path_index'); | |
| 188 | - } | |
| 189 | - } | |
| 190 | - } | |
| 191 | - ); | |
| 192 | - | |
| 193 | - $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_PRIMARY_KEYS_EVENT, | |
| 194 | -			function (GenericEvent $event) use ($container) { | |
| 195 | - /** @var MissingPrimaryKeyInformation $subject */ | |
| 196 | - $subject = $event->getSubject(); | |
| 197 | - | |
| 198 | - $schema = new SchemaWrapper($container->query(Connection::class)); | |
| 199 | - | |
| 200 | -				if ($schema->hasTable('federated_reshares')) { | |
| 201 | -					$table = $schema->getTable('federated_reshares'); | |
| 202 | - | |
| 203 | -					if (!$table->hasPrimaryKey()) { | |
| 204 | - $subject->addHintForMissingSubject($table->getName()); | |
| 205 | - } | |
| 206 | - } | |
| 207 | - | |
| 208 | -				if ($schema->hasTable('systemtag_object_mapping')) { | |
| 209 | -					$table = $schema->getTable('systemtag_object_mapping'); | |
| 210 | - | |
| 211 | -					if (!$table->hasPrimaryKey()) { | |
| 212 | - $subject->addHintForMissingSubject($table->getName()); | |
| 213 | - } | |
| 214 | - } | |
| 215 | - | |
| 216 | -				if ($schema->hasTable('comments_read_markers')) { | |
| 217 | -					$table = $schema->getTable('comments_read_markers'); | |
| 218 | - | |
| 219 | -					if (!$table->hasPrimaryKey()) { | |
| 220 | - $subject->addHintForMissingSubject($table->getName()); | |
| 221 | - } | |
| 222 | - } | |
| 223 | - | |
| 224 | -				if ($schema->hasTable('collres_resources')) { | |
| 225 | -					$table = $schema->getTable('collres_resources'); | |
| 226 | - | |
| 227 | -					if (!$table->hasPrimaryKey()) { | |
| 228 | - $subject->addHintForMissingSubject($table->getName()); | |
| 229 | - } | |
| 230 | - } | |
| 231 | - | |
| 232 | -				if ($schema->hasTable('collres_accesscache')) { | |
| 233 | -					$table = $schema->getTable('collres_accesscache'); | |
| 234 | - | |
| 235 | -					if (!$table->hasPrimaryKey()) { | |
| 236 | - $subject->addHintForMissingSubject($table->getName()); | |
| 237 | - } | |
| 238 | - } | |
| 239 | - | |
| 240 | -				if ($schema->hasTable('filecache_extended')) { | |
| 241 | -					$table = $schema->getTable('filecache_extended'); | |
| 242 | - | |
| 243 | -					if (!$table->hasPrimaryKey()) { | |
| 244 | - $subject->addHintForMissingSubject($table->getName()); | |
| 245 | - } | |
| 246 | - } | |
| 247 | - } | |
| 248 | - ); | |
| 249 | - | |
| 250 | - $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, | |
| 251 | -			function (GenericEvent $event) use ($container) { | |
| 252 | - /** @var MissingColumnInformation $subject */ | |
| 253 | - $subject = $event->getSubject(); | |
| 254 | - | |
| 255 | - $schema = new SchemaWrapper($container->query(Connection::class)); | |
| 256 | - | |
| 257 | -				if ($schema->hasTable('comments')) { | |
| 258 | -					$table = $schema->getTable('comments'); | |
| 259 | - | |
| 260 | -					if (!$table->hasColumn('reference_id')) { | |
| 261 | - $subject->addHintForMissingColumn($table->getName(), 'reference_id'); | |
| 262 | - } | |
| 263 | - } | |
| 264 | - } | |
| 265 | - ); | |
| 266 | - | |
| 267 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeActivityListener::class); | |
| 268 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeNotificationsListener::class); | |
| 269 | - $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeEmailListener::class); | |
| 270 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeActivityListener::class); | |
| 271 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeNotificationsListener::class); | |
| 272 | - $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeEmailListener::class); | |
| 273 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedStoreCleanupListener::class); | |
| 274 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedTokenCleanupListener::class); | |
| 275 | - $eventDispatcher->addServiceListener(BeforeUserDeletedEvent::class, UserDeletedFilesCleanupListener::class); | |
| 276 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedFilesCleanupListener::class); | |
| 277 | - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedWebAuthnCleanupListener::class); | |
| 278 | - } | |
| 64 | +    public function __construct() { | |
| 65 | +        parent::__construct('core'); | |
| 66 | + | |
| 67 | + $container = $this->getContainer(); | |
| 68 | + | |
| 69 | +        $container->registerService('defaultMailAddress', function () { | |
| 70 | +            return Util::getDefaultEmailAddress('lostpassword-noreply'); | |
| 71 | + }); | |
| 72 | + | |
| 73 | + $server = $container->getServer(); | |
| 74 | + /** @var IEventDispatcher $eventDispatcher */ | |
| 75 | + $eventDispatcher = $server->query(IEventDispatcher::class); | |
| 76 | + | |
| 77 | + $notificationManager = $server->getNotificationManager(); | |
| 78 | + $notificationManager->registerNotifierService(CoreNotifier::class); | |
| 79 | + $notificationManager->registerNotifierService(AuthenticationNotifier::class); | |
| 80 | + | |
| 81 | + $oldEventDispatcher = $server->getEventDispatcher(); | |
| 82 | + | |
| 83 | + $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT, | |
| 84 | +            function (GenericEvent $event) use ($container) { | |
| 85 | + /** @var MissingIndexInformation $subject */ | |
| 86 | + $subject = $event->getSubject(); | |
| 87 | + | |
| 88 | + $schema = new SchemaWrapper($container->query(Connection::class)); | |
| 89 | + | |
| 90 | +                if ($schema->hasTable('share')) { | |
| 91 | +                    $table = $schema->getTable('share'); | |
| 92 | + | |
| 93 | +                    if (!$table->hasIndex('share_with_index')) { | |
| 94 | + $subject->addHintForMissingSubject($table->getName(), 'share_with_index'); | |
| 95 | + } | |
| 96 | +                    if (!$table->hasIndex('parent_index')) { | |
| 97 | + $subject->addHintForMissingSubject($table->getName(), 'parent_index'); | |
| 98 | + } | |
| 99 | +                    if (!$table->hasIndex('owner_index')) { | |
| 100 | + $subject->addHintForMissingSubject($table->getName(), 'owner_index'); | |
| 101 | + } | |
| 102 | +                    if (!$table->hasIndex('initiator_index')) { | |
| 103 | + $subject->addHintForMissingSubject($table->getName(), 'initiator_index'); | |
| 104 | + } | |
| 105 | + } | |
| 106 | + | |
| 107 | +                if ($schema->hasTable('filecache')) { | |
| 108 | +                    $table = $schema->getTable('filecache'); | |
| 109 | + | |
| 110 | +                    if (!$table->hasIndex('fs_mtime')) { | |
| 111 | + $subject->addHintForMissingSubject($table->getName(), 'fs_mtime'); | |
| 112 | + } | |
| 113 | + | |
| 114 | +                    if (!$table->hasIndex('fs_size')) { | |
| 115 | + $subject->addHintForMissingSubject($table->getName(), 'fs_size'); | |
| 116 | + } | |
| 117 | + } | |
| 118 | + | |
| 119 | +                if ($schema->hasTable('twofactor_providers')) { | |
| 120 | +                    $table = $schema->getTable('twofactor_providers'); | |
| 121 | + | |
| 122 | +                    if (!$table->hasIndex('twofactor_providers_uid')) { | |
| 123 | + $subject->addHintForMissingSubject($table->getName(), 'twofactor_providers_uid'); | |
| 124 | + } | |
| 125 | + } | |
| 126 | + | |
| 127 | +                if ($schema->hasTable('login_flow_v2')) { | |
| 128 | +                    $table = $schema->getTable('login_flow_v2'); | |
| 129 | + | |
| 130 | +                    if (!$table->hasIndex('poll_token')) { | |
| 131 | + $subject->addHintForMissingSubject($table->getName(), 'poll_token'); | |
| 132 | + } | |
| 133 | +                    if (!$table->hasIndex('login_token')) { | |
| 134 | + $subject->addHintForMissingSubject($table->getName(), 'login_token'); | |
| 135 | + } | |
| 136 | +                    if (!$table->hasIndex('timestamp')) { | |
| 137 | + $subject->addHintForMissingSubject($table->getName(), 'timestamp'); | |
| 138 | + } | |
| 139 | + } | |
| 140 | + | |
| 141 | +                if ($schema->hasTable('whats_new')) { | |
| 142 | +                    $table = $schema->getTable('whats_new'); | |
| 143 | + | |
| 144 | +                    if (!$table->hasIndex('version')) { | |
| 145 | + $subject->addHintForMissingSubject($table->getName(), 'version'); | |
| 146 | + } | |
| 147 | + } | |
| 148 | + | |
| 149 | +                if ($schema->hasTable('cards')) { | |
| 150 | +                    $table = $schema->getTable('cards'); | |
| 151 | + | |
| 152 | +                    if (!$table->hasIndex('cards_abid')) { | |
| 153 | + $subject->addHintForMissingSubject($table->getName(), 'cards_abid'); | |
| 154 | + } | |
| 155 | + | |
| 156 | +                    if (!$table->hasIndex('cards_abiduri')) { | |
| 157 | + $subject->addHintForMissingSubject($table->getName(), 'cards_abiduri'); | |
| 158 | + } | |
| 159 | + } | |
| 160 | + | |
| 161 | +                if ($schema->hasTable('cards_properties')) { | |
| 162 | +                    $table = $schema->getTable('cards_properties'); | |
| 163 | + | |
| 164 | +                    if (!$table->hasIndex('cards_prop_abid')) { | |
| 165 | + $subject->addHintForMissingSubject($table->getName(), 'cards_prop_abid'); | |
| 166 | + } | |
| 167 | + } | |
| 168 | + | |
| 169 | +                if ($schema->hasTable('calendarobjects_props')) { | |
| 170 | +                    $table = $schema->getTable('calendarobjects_props'); | |
| 171 | + | |
| 172 | +                    if (!$table->hasIndex('calendarobject_calid_index')) { | |
| 173 | + $subject->addHintForMissingSubject($table->getName(), 'calendarobject_calid_index'); | |
| 174 | + } | |
| 175 | + } | |
| 176 | + | |
| 177 | +                if ($schema->hasTable('schedulingobjects')) { | |
| 178 | +                    $table = $schema->getTable('schedulingobjects'); | |
| 179 | +                    if (!$table->hasIndex('schedulobj_principuri_index')) { | |
| 180 | + $subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index'); | |
| 181 | + } | |
| 182 | + } | |
| 183 | + | |
| 184 | +                if ($schema->hasTable('properties')) { | |
| 185 | +                    $table = $schema->getTable('properties'); | |
| 186 | +                    if (!$table->hasIndex('properties_path_index')) { | |
| 187 | + $subject->addHintForMissingSubject($table->getName(), 'properties_path_index'); | |
| 188 | + } | |
| 189 | + } | |
| 190 | + } | |
| 191 | + ); | |
| 192 | + | |
| 193 | + $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_PRIMARY_KEYS_EVENT, | |
| 194 | +            function (GenericEvent $event) use ($container) { | |
| 195 | + /** @var MissingPrimaryKeyInformation $subject */ | |
| 196 | + $subject = $event->getSubject(); | |
| 197 | + | |
| 198 | + $schema = new SchemaWrapper($container->query(Connection::class)); | |
| 199 | + | |
| 200 | +                if ($schema->hasTable('federated_reshares')) { | |
| 201 | +                    $table = $schema->getTable('federated_reshares'); | |
| 202 | + | |
| 203 | +                    if (!$table->hasPrimaryKey()) { | |
| 204 | + $subject->addHintForMissingSubject($table->getName()); | |
| 205 | + } | |
| 206 | + } | |
| 207 | + | |
| 208 | +                if ($schema->hasTable('systemtag_object_mapping')) { | |
| 209 | +                    $table = $schema->getTable('systemtag_object_mapping'); | |
| 210 | + | |
| 211 | +                    if (!$table->hasPrimaryKey()) { | |
| 212 | + $subject->addHintForMissingSubject($table->getName()); | |
| 213 | + } | |
| 214 | + } | |
| 215 | + | |
| 216 | +                if ($schema->hasTable('comments_read_markers')) { | |
| 217 | +                    $table = $schema->getTable('comments_read_markers'); | |
| 218 | + | |
| 219 | +                    if (!$table->hasPrimaryKey()) { | |
| 220 | + $subject->addHintForMissingSubject($table->getName()); | |
| 221 | + } | |
| 222 | + } | |
| 223 | + | |
| 224 | +                if ($schema->hasTable('collres_resources')) { | |
| 225 | +                    $table = $schema->getTable('collres_resources'); | |
| 226 | + | |
| 227 | +                    if (!$table->hasPrimaryKey()) { | |
| 228 | + $subject->addHintForMissingSubject($table->getName()); | |
| 229 | + } | |
| 230 | + } | |
| 231 | + | |
| 232 | +                if ($schema->hasTable('collres_accesscache')) { | |
| 233 | +                    $table = $schema->getTable('collres_accesscache'); | |
| 234 | + | |
| 235 | +                    if (!$table->hasPrimaryKey()) { | |
| 236 | + $subject->addHintForMissingSubject($table->getName()); | |
| 237 | + } | |
| 238 | + } | |
| 239 | + | |
| 240 | +                if ($schema->hasTable('filecache_extended')) { | |
| 241 | +                    $table = $schema->getTable('filecache_extended'); | |
| 242 | + | |
| 243 | +                    if (!$table->hasPrimaryKey()) { | |
| 244 | + $subject->addHintForMissingSubject($table->getName()); | |
| 245 | + } | |
| 246 | + } | |
| 247 | + } | |
| 248 | + ); | |
| 249 | + | |
| 250 | + $oldEventDispatcher->addListener(IDBConnection::CHECK_MISSING_COLUMNS_EVENT, | |
| 251 | +            function (GenericEvent $event) use ($container) { | |
| 252 | + /** @var MissingColumnInformation $subject */ | |
| 253 | + $subject = $event->getSubject(); | |
| 254 | + | |
| 255 | + $schema = new SchemaWrapper($container->query(Connection::class)); | |
| 256 | + | |
| 257 | +                if ($schema->hasTable('comments')) { | |
| 258 | +                    $table = $schema->getTable('comments'); | |
| 259 | + | |
| 260 | +                    if (!$table->hasColumn('reference_id')) { | |
| 261 | + $subject->addHintForMissingColumn($table->getName(), 'reference_id'); | |
| 262 | + } | |
| 263 | + } | |
| 264 | + } | |
| 265 | + ); | |
| 266 | + | |
| 267 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeActivityListener::class); | |
| 268 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeNotificationsListener::class); | |
| 269 | + $eventDispatcher->addServiceListener(RemoteWipeStarted::class, RemoteWipeEmailListener::class); | |
| 270 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeActivityListener::class); | |
| 271 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeNotificationsListener::class); | |
| 272 | + $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeEmailListener::class); | |
| 273 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedStoreCleanupListener::class); | |
| 274 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedTokenCleanupListener::class); | |
| 275 | + $eventDispatcher->addServiceListener(BeforeUserDeletedEvent::class, UserDeletedFilesCleanupListener::class); | |
| 276 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedFilesCleanupListener::class); | |
| 277 | + $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedWebAuthnCleanupListener::class); | |
| 278 | + } | |
| 279 | 279 | } | 
| @@ -34,67 +34,67 @@ | ||
| 34 | 34 | * @template-extends QBMapper<PublicKeyCredentialEntity> | 
| 35 | 35 | */ | 
| 36 | 36 |  class PublicKeyCredentialMapper extends QBMapper { | 
| 37 | -	public function __construct(IDBConnection $db) { | |
| 38 | - parent::__construct($db, 'webauthn', PublicKeyCredentialEntity::class); | |
| 39 | - } | |
| 37 | +    public function __construct(IDBConnection $db) { | |
| 38 | + parent::__construct($db, 'webauthn', PublicKeyCredentialEntity::class); | |
| 39 | + } | |
| 40 | 40 | |
| 41 | -	public function findOneByCredentialId(string $publicKeyCredentialId): PublicKeyCredentialEntity { | |
| 42 | - $qb = $this->db->getQueryBuilder(); | |
| 41 | +    public function findOneByCredentialId(string $publicKeyCredentialId): PublicKeyCredentialEntity { | |
| 42 | + $qb = $this->db->getQueryBuilder(); | |
| 43 | 43 | |
| 44 | -		$qb->select('*') | |
| 45 | - ->from($this->getTableName()) | |
| 46 | - ->where( | |
| 47 | -				$qb->expr()->eq('public_key_credential_id', $qb->createNamedParameter(base64_encode($publicKeyCredentialId))) | |
| 48 | - ); | |
| 44 | +        $qb->select('*') | |
| 45 | + ->from($this->getTableName()) | |
| 46 | + ->where( | |
| 47 | +                $qb->expr()->eq('public_key_credential_id', $qb->createNamedParameter(base64_encode($publicKeyCredentialId))) | |
| 48 | + ); | |
| 49 | 49 | |
| 50 | - return $this->findEntity($qb); | |
| 51 | - } | |
| 50 | + return $this->findEntity($qb); | |
| 51 | + } | |
| 52 | 52 | |
| 53 | - /** | |
| 54 | - * @return PublicKeyCredentialEntity[] | |
| 55 | - */ | |
| 56 | -	public function findAllForUid(string $uid): array { | |
| 57 | - $qb = $this->db->getQueryBuilder(); | |
| 53 | + /** | |
| 54 | + * @return PublicKeyCredentialEntity[] | |
| 55 | + */ | |
| 56 | +    public function findAllForUid(string $uid): array { | |
| 57 | + $qb = $this->db->getQueryBuilder(); | |
| 58 | 58 | |
| 59 | -		$qb->select('*') | |
| 60 | - ->from($this->getTableName()) | |
| 61 | - ->where( | |
| 62 | -				$qb->expr()->eq('uid', $qb->createNamedParameter($uid)) | |
| 63 | - ); | |
| 59 | +        $qb->select('*') | |
| 60 | + ->from($this->getTableName()) | |
| 61 | + ->where( | |
| 62 | +                $qb->expr()->eq('uid', $qb->createNamedParameter($uid)) | |
| 63 | + ); | |
| 64 | 64 | |
| 65 | - return $this->findEntities($qb); | |
| 66 | - } | |
| 65 | + return $this->findEntities($qb); | |
| 66 | + } | |
| 67 | 67 | |
| 68 | - /** | |
| 69 | - * @param string $uid | |
| 70 | - * @param int $id | |
| 71 | - * | |
| 72 | - * @return PublicKeyCredentialEntity | |
| 73 | - * @throws DoesNotExistException | |
| 74 | - */ | |
| 75 | -	public function findById(string $uid, int $id): PublicKeyCredentialEntity { | |
| 76 | - $qb = $this->db->getQueryBuilder(); | |
| 68 | + /** | |
| 69 | + * @param string $uid | |
| 70 | + * @param int $id | |
| 71 | + * | |
| 72 | + * @return PublicKeyCredentialEntity | |
| 73 | + * @throws DoesNotExistException | |
| 74 | + */ | |
| 75 | +    public function findById(string $uid, int $id): PublicKeyCredentialEntity { | |
| 76 | + $qb = $this->db->getQueryBuilder(); | |
| 77 | 77 | |
| 78 | -		$qb->select('*') | |
| 79 | - ->from($this->getTableName()) | |
| 80 | - ->where($qb->expr()->andX( | |
| 81 | -				$qb->expr()->eq('id', $qb->createNamedParameter($id)), | |
| 82 | -				$qb->expr()->eq('uid', $qb->createNamedParameter($uid)) | |
| 83 | - )); | |
| 78 | +        $qb->select('*') | |
| 79 | + ->from($this->getTableName()) | |
| 80 | + ->where($qb->expr()->andX( | |
| 81 | +                $qb->expr()->eq('id', $qb->createNamedParameter($id)), | |
| 82 | +                $qb->expr()->eq('uid', $qb->createNamedParameter($uid)) | |
| 83 | + )); | |
| 84 | 84 | |
| 85 | - return $this->findEntity($qb); | |
| 86 | - } | |
| 85 | + return $this->findEntity($qb); | |
| 86 | + } | |
| 87 | 87 | |
| 88 | - /** | |
| 89 | - * @throws \OCP\DB\Exception | |
| 90 | - */ | |
| 91 | -	public function deleteByUid(string $uid) { | |
| 92 | - $qb = $this->db->getQueryBuilder(); | |
| 88 | + /** | |
| 89 | + * @throws \OCP\DB\Exception | |
| 90 | + */ | |
| 91 | +    public function deleteByUid(string $uid) { | |
| 92 | + $qb = $this->db->getQueryBuilder(); | |
| 93 | 93 | |
| 94 | - $qb->delete($this->getTableName()) | |
| 95 | - ->where( | |
| 96 | -				$qb->expr()->eq('uid', $qb->createNamedParameter($uid)) | |
| 97 | - ); | |
| 98 | - $qb->executeStatement(); | |
| 99 | - } | |
| 94 | + $qb->delete($this->getTableName()) | |
| 95 | + ->where( | |
| 96 | +                $qb->expr()->eq('uid', $qb->createNamedParameter($uid)) | |
| 97 | + ); | |
| 98 | + $qb->executeStatement(); | |
| 99 | + } | |
| 100 | 100 | } | 
| @@ -33,18 +33,18 @@ | ||
| 33 | 33 | |
| 34 | 34 |  class UserDeletedWebAuthnCleanupListener implements IEventListener { | 
| 35 | 35 | |
| 36 | - /** @var PublicKeyCredentialMapper */ | |
| 37 | - private $credentialMapper; | |
| 36 | + /** @var PublicKeyCredentialMapper */ | |
| 37 | + private $credentialMapper; | |
| 38 | 38 | |
| 39 | -	public function __construct(PublicKeyCredentialMapper $credentialMapper) { | |
| 40 | - $this->credentialMapper = $credentialMapper; | |
| 41 | - } | |
| 39 | +    public function __construct(PublicKeyCredentialMapper $credentialMapper) { | |
| 40 | + $this->credentialMapper = $credentialMapper; | |
| 41 | + } | |
| 42 | 42 | |
| 43 | -	public function handle(Event $event): void { | |
| 44 | -		if (!($event instanceof UserDeletedEvent)) { | |
| 45 | - return; | |
| 46 | - } | |
| 43 | +    public function handle(Event $event): void { | |
| 44 | +        if (!($event instanceof UserDeletedEvent)) { | |
| 45 | + return; | |
| 46 | + } | |
| 47 | 47 | |
| 48 | - $this->credentialMapper->deleteByUid($event->getUser()->getUID()); | |
| 49 | - } | |
| 48 | + $this->credentialMapper->deleteByUid($event->getUser()->getUID()); | |
| 49 | + } | |
| 50 | 50 | } |