@@ -58,492 +58,492 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | interface IServerContainer extends IContainer { |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * The calendar manager will act as a broker between consumers for calendar information and |
|
| 63 | - * providers which actual deliver the calendar information. |
|
| 64 | - * |
|
| 65 | - * @return \OCP\Calendar\IManager |
|
| 66 | - * @since 13.0.0 |
|
| 67 | - */ |
|
| 68 | - public function getCalendarManager(); |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * The contacts manager will act as a broker between consumers for contacts information and |
|
| 72 | - * providers which actual deliver the contact information. |
|
| 73 | - * |
|
| 74 | - * @return \OCP\Contacts\IManager |
|
| 75 | - * @since 6.0.0 |
|
| 76 | - */ |
|
| 77 | - public function getContactsManager(); |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * The current request object holding all information about the request currently being processed |
|
| 81 | - * is returned from this method. |
|
| 82 | - * In case the current execution was not initiated by a web request null is returned |
|
| 83 | - * |
|
| 84 | - * @return \OCP\IRequest |
|
| 85 | - * @since 6.0.0 |
|
| 86 | - */ |
|
| 87 | - public function getRequest(); |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * Returns the preview manager which can create preview images for a given file |
|
| 91 | - * |
|
| 92 | - * @return \OCP\IPreview |
|
| 93 | - * @since 6.0.0 |
|
| 94 | - */ |
|
| 95 | - public function getPreviewManager(); |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Returns the tag manager which can get and set tags for different object types |
|
| 99 | - * |
|
| 100 | - * @see \OCP\ITagManager::load() |
|
| 101 | - * @return \OCP\ITagManager |
|
| 102 | - * @since 6.0.0 |
|
| 103 | - */ |
|
| 104 | - public function getTagManager(); |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Returns the root folder of ownCloud's data directory |
|
| 108 | - * |
|
| 109 | - * @return \OCP\Files\IRootFolder |
|
| 110 | - * @since 6.0.0 - between 6.0.0 and 8.0.0 this returned \OCP\Files\Folder |
|
| 111 | - */ |
|
| 112 | - public function getRootFolder(); |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * Returns a view to ownCloud's files folder |
|
| 116 | - * |
|
| 117 | - * @param string $userId user ID |
|
| 118 | - * @return \OCP\Files\Folder |
|
| 119 | - * @since 6.0.0 - parameter $userId was added in 8.0.0 |
|
| 120 | - * @see getUserFolder in \OCP\Files\IRootFolder |
|
| 121 | - */ |
|
| 122 | - public function getUserFolder($userId = null); |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * Returns an app-specific view in ownClouds data directory |
|
| 126 | - * |
|
| 127 | - * @return \OCP\Files\Folder |
|
| 128 | - * @since 6.0.0 |
|
| 129 | - * @deprecated 9.2.0 use IAppData |
|
| 130 | - */ |
|
| 131 | - public function getAppFolder(); |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * Returns a user manager |
|
| 135 | - * |
|
| 136 | - * @return \OCP\IUserManager |
|
| 137 | - * @since 8.0.0 |
|
| 138 | - */ |
|
| 139 | - public function getUserManager(); |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * Returns a group manager |
|
| 143 | - * |
|
| 144 | - * @return \OCP\IGroupManager |
|
| 145 | - * @since 8.0.0 |
|
| 146 | - */ |
|
| 147 | - public function getGroupManager(); |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * Returns the user session |
|
| 151 | - * |
|
| 152 | - * @return \OCP\IUserSession |
|
| 153 | - * @since 6.0.0 |
|
| 154 | - */ |
|
| 155 | - public function getUserSession(); |
|
| 156 | - |
|
| 157 | - /** |
|
| 158 | - * Returns the navigation manager |
|
| 159 | - * |
|
| 160 | - * @return \OCP\INavigationManager |
|
| 161 | - * @since 6.0.0 |
|
| 162 | - */ |
|
| 163 | - public function getNavigationManager(); |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * Returns the config manager |
|
| 167 | - * |
|
| 168 | - * @return \OCP\IConfig |
|
| 169 | - * @since 6.0.0 |
|
| 170 | - */ |
|
| 171 | - public function getConfig(); |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * Returns a Crypto instance |
|
| 175 | - * |
|
| 176 | - * @return \OCP\Security\ICrypto |
|
| 177 | - * @since 8.0.0 |
|
| 178 | - */ |
|
| 179 | - public function getCrypto(); |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * Returns a Hasher instance |
|
| 183 | - * |
|
| 184 | - * @return \OCP\Security\IHasher |
|
| 185 | - * @since 8.0.0 |
|
| 186 | - */ |
|
| 187 | - public function getHasher(); |
|
| 188 | - |
|
| 189 | - /** |
|
| 190 | - * Returns a SecureRandom instance |
|
| 191 | - * |
|
| 192 | - * @return \OCP\Security\ISecureRandom |
|
| 193 | - * @since 8.1.0 |
|
| 194 | - */ |
|
| 195 | - public function getSecureRandom(); |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * Returns a CredentialsManager instance |
|
| 199 | - * |
|
| 200 | - * @return \OCP\Security\ICredentialsManager |
|
| 201 | - * @since 9.0.0 |
|
| 202 | - */ |
|
| 203 | - public function getCredentialsManager(); |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * Returns the app config manager |
|
| 207 | - * |
|
| 208 | - * @return \OCP\IAppConfig |
|
| 209 | - * @since 7.0.0 |
|
| 210 | - */ |
|
| 211 | - public function getAppConfig(); |
|
| 212 | - |
|
| 213 | - /** |
|
| 214 | - * @return \OCP\L10N\IFactory |
|
| 215 | - * @since 8.2.0 |
|
| 216 | - */ |
|
| 217 | - public function getL10NFactory(); |
|
| 218 | - |
|
| 219 | - /** |
|
| 220 | - * get an L10N instance |
|
| 221 | - * @param string $app appid |
|
| 222 | - * @param string $lang |
|
| 223 | - * @return \OCP\IL10N |
|
| 224 | - * @since 6.0.0 - parameter $lang was added in 8.0.0 |
|
| 225 | - */ |
|
| 226 | - public function getL10N($app, $lang = null); |
|
| 227 | - |
|
| 228 | - /** |
|
| 229 | - * @return \OC\Encryption\Manager |
|
| 230 | - * @since 8.1.0 |
|
| 231 | - */ |
|
| 232 | - public function getEncryptionManager(); |
|
| 233 | - |
|
| 234 | - /** |
|
| 235 | - * @return \OC\Encryption\File |
|
| 236 | - * @since 8.1.0 |
|
| 237 | - */ |
|
| 238 | - public function getEncryptionFilesHelper(); |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * @return \OCP\Encryption\Keys\IStorage |
|
| 242 | - * @since 8.1.0 |
|
| 243 | - */ |
|
| 244 | - public function getEncryptionKeyStorage(); |
|
| 245 | - |
|
| 246 | - /** |
|
| 247 | - * Returns the URL generator |
|
| 248 | - * |
|
| 249 | - * @return \OCP\IURLGenerator |
|
| 250 | - * @since 6.0.0 |
|
| 251 | - */ |
|
| 252 | - public function getURLGenerator(); |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * Returns an ICache instance |
|
| 256 | - * |
|
| 257 | - * @return \OCP\ICache |
|
| 258 | - * @since 6.0.0 |
|
| 259 | - */ |
|
| 260 | - public function getCache(); |
|
| 261 | - |
|
| 262 | - /** |
|
| 263 | - * Returns an \OCP\CacheFactory instance |
|
| 264 | - * |
|
| 265 | - * @return \OCP\ICacheFactory |
|
| 266 | - * @since 7.0.0 |
|
| 267 | - */ |
|
| 268 | - public function getMemCacheFactory(); |
|
| 269 | - |
|
| 270 | - /** |
|
| 271 | - * Returns the current session |
|
| 272 | - * |
|
| 273 | - * @return \OCP\ISession |
|
| 274 | - * @since 6.0.0 |
|
| 275 | - */ |
|
| 276 | - public function getSession(); |
|
| 277 | - |
|
| 278 | - /** |
|
| 279 | - * Returns the activity manager |
|
| 280 | - * |
|
| 281 | - * @return \OCP\Activity\IManager |
|
| 282 | - * @since 6.0.0 |
|
| 283 | - */ |
|
| 284 | - public function getActivityManager(); |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * Returns the current session |
|
| 288 | - * |
|
| 289 | - * @return \OCP\IDBConnection |
|
| 290 | - * @since 6.0.0 |
|
| 291 | - */ |
|
| 292 | - public function getDatabaseConnection(); |
|
| 293 | - |
|
| 294 | - /** |
|
| 295 | - * Returns an avatar manager, used for avatar functionality |
|
| 296 | - * |
|
| 297 | - * @return \OCP\IAvatarManager |
|
| 298 | - * @since 6.0.0 |
|
| 299 | - */ |
|
| 300 | - public function getAvatarManager(); |
|
| 301 | - |
|
| 302 | - /** |
|
| 303 | - * Returns an job list for controlling background jobs |
|
| 304 | - * |
|
| 305 | - * @return \OCP\BackgroundJob\IJobList |
|
| 306 | - * @since 7.0.0 |
|
| 307 | - */ |
|
| 308 | - public function getJobList(); |
|
| 309 | - |
|
| 310 | - /** |
|
| 311 | - * Returns a logger instance |
|
| 312 | - * |
|
| 313 | - * @return \OCP\ILogger |
|
| 314 | - * @since 8.0.0 |
|
| 315 | - */ |
|
| 316 | - public function getLogger(); |
|
| 317 | - |
|
| 318 | - /** |
|
| 319 | - * returns a log factory instance |
|
| 320 | - * |
|
| 321 | - * @return ILogFactory |
|
| 322 | - * @since 14.0.0 |
|
| 323 | - */ |
|
| 324 | - public function getLogFactory(); |
|
| 325 | - |
|
| 326 | - /** |
|
| 327 | - * Returns a router for generating and matching urls |
|
| 328 | - * |
|
| 329 | - * @return \OCP\Route\IRouter |
|
| 330 | - * @since 7.0.0 |
|
| 331 | - */ |
|
| 332 | - public function getRouter(); |
|
| 333 | - |
|
| 334 | - /** |
|
| 335 | - * Returns a search instance |
|
| 336 | - * |
|
| 337 | - * @return \OCP\ISearch |
|
| 338 | - * @since 7.0.0 |
|
| 339 | - */ |
|
| 340 | - public function getSearch(); |
|
| 341 | - |
|
| 342 | - /** |
|
| 343 | - * Get the certificate manager for the user |
|
| 344 | - * |
|
| 345 | - * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager |
|
| 346 | - * @return \OCP\ICertificateManager | null if $userId is null and no user is logged in |
|
| 347 | - * @since 8.0.0 |
|
| 348 | - */ |
|
| 349 | - public function getCertificateManager($userId = null); |
|
| 350 | - |
|
| 351 | - /** |
|
| 352 | - * Create a new event source |
|
| 353 | - * |
|
| 354 | - * @return \OCP\IEventSource |
|
| 355 | - * @since 8.0.0 |
|
| 356 | - */ |
|
| 357 | - public function createEventSource(); |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * Returns an instance of the HTTP client service |
|
| 361 | - * |
|
| 362 | - * @return \OCP\Http\Client\IClientService |
|
| 363 | - * @since 8.1.0 |
|
| 364 | - */ |
|
| 365 | - public function getHTTPClientService(); |
|
| 366 | - |
|
| 367 | - /** |
|
| 368 | - * Get the active event logger |
|
| 369 | - * |
|
| 370 | - * @return \OCP\Diagnostics\IEventLogger |
|
| 371 | - * @since 8.0.0 |
|
| 372 | - */ |
|
| 373 | - public function getEventLogger(); |
|
| 374 | - |
|
| 375 | - /** |
|
| 376 | - * Get the active query logger |
|
| 377 | - * |
|
| 378 | - * The returned logger only logs data when debug mode is enabled |
|
| 379 | - * |
|
| 380 | - * @return \OCP\Diagnostics\IQueryLogger |
|
| 381 | - * @since 8.0.0 |
|
| 382 | - */ |
|
| 383 | - public function getQueryLogger(); |
|
| 384 | - |
|
| 385 | - /** |
|
| 386 | - * Get the manager for temporary files and folders |
|
| 387 | - * |
|
| 388 | - * @return \OCP\ITempManager |
|
| 389 | - * @since 8.0.0 |
|
| 390 | - */ |
|
| 391 | - public function getTempManager(); |
|
| 392 | - |
|
| 393 | - /** |
|
| 394 | - * Get the app manager |
|
| 395 | - * |
|
| 396 | - * @return \OCP\App\IAppManager |
|
| 397 | - * @since 8.0.0 |
|
| 398 | - */ |
|
| 399 | - public function getAppManager(); |
|
| 400 | - |
|
| 401 | - /** |
|
| 402 | - * Get the webroot |
|
| 403 | - * |
|
| 404 | - * @return string |
|
| 405 | - * @since 8.0.0 |
|
| 406 | - */ |
|
| 407 | - public function getWebRoot(); |
|
| 408 | - |
|
| 409 | - /** |
|
| 410 | - * @return \OCP\Files\Config\IMountProviderCollection |
|
| 411 | - * @since 8.0.0 |
|
| 412 | - */ |
|
| 413 | - public function getMountProviderCollection(); |
|
| 414 | - |
|
| 415 | - /** |
|
| 416 | - * Get the IniWrapper |
|
| 417 | - * |
|
| 418 | - * @return \bantu\IniGetWrapper\IniGetWrapper |
|
| 419 | - * @since 8.0.0 |
|
| 420 | - */ |
|
| 421 | - public function getIniWrapper(); |
|
| 422 | - /** |
|
| 423 | - * @return \OCP\Command\IBus |
|
| 424 | - * @since 8.1.0 |
|
| 425 | - */ |
|
| 426 | - public function getCommandBus(); |
|
| 427 | - |
|
| 428 | - /** |
|
| 429 | - * Creates a new mailer |
|
| 430 | - * |
|
| 431 | - * @return \OCP\Mail\IMailer |
|
| 432 | - * @since 8.1.0 |
|
| 433 | - */ |
|
| 434 | - public function getMailer(); |
|
| 435 | - |
|
| 436 | - /** |
|
| 437 | - * Get the locking provider |
|
| 438 | - * |
|
| 439 | - * @return \OCP\Lock\ILockingProvider |
|
| 440 | - * @since 8.1.0 |
|
| 441 | - */ |
|
| 442 | - public function getLockingProvider(); |
|
| 443 | - |
|
| 444 | - /** |
|
| 445 | - * @return \OCP\Files\Mount\IMountManager |
|
| 446 | - * @since 8.2.0 |
|
| 447 | - */ |
|
| 448 | - public function getMountManager(); |
|
| 449 | - |
|
| 450 | - /** |
|
| 451 | - * Get the MimeTypeDetector |
|
| 452 | - * |
|
| 453 | - * @return \OCP\Files\IMimeTypeDetector |
|
| 454 | - * @since 8.2.0 |
|
| 455 | - */ |
|
| 456 | - public function getMimeTypeDetector(); |
|
| 457 | - |
|
| 458 | - /** |
|
| 459 | - * Get the MimeTypeLoader |
|
| 460 | - * |
|
| 461 | - * @return \OCP\Files\IMimeTypeLoader |
|
| 462 | - * @since 8.2.0 |
|
| 463 | - */ |
|
| 464 | - public function getMimeTypeLoader(); |
|
| 465 | - |
|
| 466 | - /** |
|
| 467 | - * Get the EventDispatcher |
|
| 468 | - * |
|
| 469 | - * @return EventDispatcherInterface |
|
| 470 | - * @since 8.2.0 |
|
| 471 | - */ |
|
| 472 | - public function getEventDispatcher(); |
|
| 473 | - |
|
| 474 | - /** |
|
| 475 | - * Get the Notification Manager |
|
| 476 | - * |
|
| 477 | - * @return \OCP\Notification\IManager |
|
| 478 | - * @since 9.0.0 |
|
| 479 | - */ |
|
| 480 | - public function getNotificationManager(); |
|
| 481 | - |
|
| 482 | - /** |
|
| 483 | - * @return \OCP\Comments\ICommentsManager |
|
| 484 | - * @since 9.0.0 |
|
| 485 | - */ |
|
| 486 | - public function getCommentsManager(); |
|
| 487 | - |
|
| 488 | - /** |
|
| 489 | - * Returns the system-tag manager |
|
| 490 | - * |
|
| 491 | - * @return \OCP\SystemTag\ISystemTagManager |
|
| 492 | - * |
|
| 493 | - * @since 9.0.0 |
|
| 494 | - */ |
|
| 495 | - public function getSystemTagManager(); |
|
| 496 | - |
|
| 497 | - /** |
|
| 498 | - * Returns the system-tag object mapper |
|
| 499 | - * |
|
| 500 | - * @return \OCP\SystemTag\ISystemTagObjectMapper |
|
| 501 | - * |
|
| 502 | - * @since 9.0.0 |
|
| 503 | - */ |
|
| 504 | - public function getSystemTagObjectMapper(); |
|
| 505 | - |
|
| 506 | - /** |
|
| 507 | - * Returns the share manager |
|
| 508 | - * |
|
| 509 | - * @return \OCP\Share\IManager |
|
| 510 | - * @since 9.0.0 |
|
| 511 | - */ |
|
| 512 | - public function getShareManager(); |
|
| 513 | - |
|
| 514 | - /** |
|
| 515 | - * @return IContentSecurityPolicyManager |
|
| 516 | - * @since 9.0.0 |
|
| 517 | - */ |
|
| 518 | - public function getContentSecurityPolicyManager(); |
|
| 519 | - |
|
| 520 | - /** |
|
| 521 | - * @return \OCP\IDateTimeZone |
|
| 522 | - * @since 8.0.0 |
|
| 523 | - */ |
|
| 524 | - public function getDateTimeZone(); |
|
| 525 | - |
|
| 526 | - /** |
|
| 527 | - * @return \OCP\IDateTimeFormatter |
|
| 528 | - * @since 8.0.0 |
|
| 529 | - */ |
|
| 530 | - public function getDateTimeFormatter(); |
|
| 531 | - |
|
| 532 | - /** |
|
| 533 | - * @return \OCP\Federation\ICloudIdManager |
|
| 534 | - * @since 12.0.0 |
|
| 535 | - */ |
|
| 536 | - public function getCloudIdManager(); |
|
| 537 | - |
|
| 538 | - /** |
|
| 539 | - * @return \OCP\Remote\Api\IApiFactory |
|
| 540 | - * @since 13.0.0 |
|
| 541 | - */ |
|
| 542 | - public function getRemoteApiFactory(); |
|
| 543 | - |
|
| 544 | - /** |
|
| 545 | - * @return \OCP\Remote\IInstanceFactory |
|
| 546 | - * @since 13.0.0 |
|
| 547 | - */ |
|
| 548 | - public function getRemoteInstanceFactory(); |
|
| 61 | + /** |
|
| 62 | + * The calendar manager will act as a broker between consumers for calendar information and |
|
| 63 | + * providers which actual deliver the calendar information. |
|
| 64 | + * |
|
| 65 | + * @return \OCP\Calendar\IManager |
|
| 66 | + * @since 13.0.0 |
|
| 67 | + */ |
|
| 68 | + public function getCalendarManager(); |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * The contacts manager will act as a broker between consumers for contacts information and |
|
| 72 | + * providers which actual deliver the contact information. |
|
| 73 | + * |
|
| 74 | + * @return \OCP\Contacts\IManager |
|
| 75 | + * @since 6.0.0 |
|
| 76 | + */ |
|
| 77 | + public function getContactsManager(); |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * The current request object holding all information about the request currently being processed |
|
| 81 | + * is returned from this method. |
|
| 82 | + * In case the current execution was not initiated by a web request null is returned |
|
| 83 | + * |
|
| 84 | + * @return \OCP\IRequest |
|
| 85 | + * @since 6.0.0 |
|
| 86 | + */ |
|
| 87 | + public function getRequest(); |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * Returns the preview manager which can create preview images for a given file |
|
| 91 | + * |
|
| 92 | + * @return \OCP\IPreview |
|
| 93 | + * @since 6.0.0 |
|
| 94 | + */ |
|
| 95 | + public function getPreviewManager(); |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Returns the tag manager which can get and set tags for different object types |
|
| 99 | + * |
|
| 100 | + * @see \OCP\ITagManager::load() |
|
| 101 | + * @return \OCP\ITagManager |
|
| 102 | + * @since 6.0.0 |
|
| 103 | + */ |
|
| 104 | + public function getTagManager(); |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Returns the root folder of ownCloud's data directory |
|
| 108 | + * |
|
| 109 | + * @return \OCP\Files\IRootFolder |
|
| 110 | + * @since 6.0.0 - between 6.0.0 and 8.0.0 this returned \OCP\Files\Folder |
|
| 111 | + */ |
|
| 112 | + public function getRootFolder(); |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * Returns a view to ownCloud's files folder |
|
| 116 | + * |
|
| 117 | + * @param string $userId user ID |
|
| 118 | + * @return \OCP\Files\Folder |
|
| 119 | + * @since 6.0.0 - parameter $userId was added in 8.0.0 |
|
| 120 | + * @see getUserFolder in \OCP\Files\IRootFolder |
|
| 121 | + */ |
|
| 122 | + public function getUserFolder($userId = null); |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * Returns an app-specific view in ownClouds data directory |
|
| 126 | + * |
|
| 127 | + * @return \OCP\Files\Folder |
|
| 128 | + * @since 6.0.0 |
|
| 129 | + * @deprecated 9.2.0 use IAppData |
|
| 130 | + */ |
|
| 131 | + public function getAppFolder(); |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * Returns a user manager |
|
| 135 | + * |
|
| 136 | + * @return \OCP\IUserManager |
|
| 137 | + * @since 8.0.0 |
|
| 138 | + */ |
|
| 139 | + public function getUserManager(); |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * Returns a group manager |
|
| 143 | + * |
|
| 144 | + * @return \OCP\IGroupManager |
|
| 145 | + * @since 8.0.0 |
|
| 146 | + */ |
|
| 147 | + public function getGroupManager(); |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * Returns the user session |
|
| 151 | + * |
|
| 152 | + * @return \OCP\IUserSession |
|
| 153 | + * @since 6.0.0 |
|
| 154 | + */ |
|
| 155 | + public function getUserSession(); |
|
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * Returns the navigation manager |
|
| 159 | + * |
|
| 160 | + * @return \OCP\INavigationManager |
|
| 161 | + * @since 6.0.0 |
|
| 162 | + */ |
|
| 163 | + public function getNavigationManager(); |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * Returns the config manager |
|
| 167 | + * |
|
| 168 | + * @return \OCP\IConfig |
|
| 169 | + * @since 6.0.0 |
|
| 170 | + */ |
|
| 171 | + public function getConfig(); |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * Returns a Crypto instance |
|
| 175 | + * |
|
| 176 | + * @return \OCP\Security\ICrypto |
|
| 177 | + * @since 8.0.0 |
|
| 178 | + */ |
|
| 179 | + public function getCrypto(); |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * Returns a Hasher instance |
|
| 183 | + * |
|
| 184 | + * @return \OCP\Security\IHasher |
|
| 185 | + * @since 8.0.0 |
|
| 186 | + */ |
|
| 187 | + public function getHasher(); |
|
| 188 | + |
|
| 189 | + /** |
|
| 190 | + * Returns a SecureRandom instance |
|
| 191 | + * |
|
| 192 | + * @return \OCP\Security\ISecureRandom |
|
| 193 | + * @since 8.1.0 |
|
| 194 | + */ |
|
| 195 | + public function getSecureRandom(); |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * Returns a CredentialsManager instance |
|
| 199 | + * |
|
| 200 | + * @return \OCP\Security\ICredentialsManager |
|
| 201 | + * @since 9.0.0 |
|
| 202 | + */ |
|
| 203 | + public function getCredentialsManager(); |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * Returns the app config manager |
|
| 207 | + * |
|
| 208 | + * @return \OCP\IAppConfig |
|
| 209 | + * @since 7.0.0 |
|
| 210 | + */ |
|
| 211 | + public function getAppConfig(); |
|
| 212 | + |
|
| 213 | + /** |
|
| 214 | + * @return \OCP\L10N\IFactory |
|
| 215 | + * @since 8.2.0 |
|
| 216 | + */ |
|
| 217 | + public function getL10NFactory(); |
|
| 218 | + |
|
| 219 | + /** |
|
| 220 | + * get an L10N instance |
|
| 221 | + * @param string $app appid |
|
| 222 | + * @param string $lang |
|
| 223 | + * @return \OCP\IL10N |
|
| 224 | + * @since 6.0.0 - parameter $lang was added in 8.0.0 |
|
| 225 | + */ |
|
| 226 | + public function getL10N($app, $lang = null); |
|
| 227 | + |
|
| 228 | + /** |
|
| 229 | + * @return \OC\Encryption\Manager |
|
| 230 | + * @since 8.1.0 |
|
| 231 | + */ |
|
| 232 | + public function getEncryptionManager(); |
|
| 233 | + |
|
| 234 | + /** |
|
| 235 | + * @return \OC\Encryption\File |
|
| 236 | + * @since 8.1.0 |
|
| 237 | + */ |
|
| 238 | + public function getEncryptionFilesHelper(); |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * @return \OCP\Encryption\Keys\IStorage |
|
| 242 | + * @since 8.1.0 |
|
| 243 | + */ |
|
| 244 | + public function getEncryptionKeyStorage(); |
|
| 245 | + |
|
| 246 | + /** |
|
| 247 | + * Returns the URL generator |
|
| 248 | + * |
|
| 249 | + * @return \OCP\IURLGenerator |
|
| 250 | + * @since 6.0.0 |
|
| 251 | + */ |
|
| 252 | + public function getURLGenerator(); |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * Returns an ICache instance |
|
| 256 | + * |
|
| 257 | + * @return \OCP\ICache |
|
| 258 | + * @since 6.0.0 |
|
| 259 | + */ |
|
| 260 | + public function getCache(); |
|
| 261 | + |
|
| 262 | + /** |
|
| 263 | + * Returns an \OCP\CacheFactory instance |
|
| 264 | + * |
|
| 265 | + * @return \OCP\ICacheFactory |
|
| 266 | + * @since 7.0.0 |
|
| 267 | + */ |
|
| 268 | + public function getMemCacheFactory(); |
|
| 269 | + |
|
| 270 | + /** |
|
| 271 | + * Returns the current session |
|
| 272 | + * |
|
| 273 | + * @return \OCP\ISession |
|
| 274 | + * @since 6.0.0 |
|
| 275 | + */ |
|
| 276 | + public function getSession(); |
|
| 277 | + |
|
| 278 | + /** |
|
| 279 | + * Returns the activity manager |
|
| 280 | + * |
|
| 281 | + * @return \OCP\Activity\IManager |
|
| 282 | + * @since 6.0.0 |
|
| 283 | + */ |
|
| 284 | + public function getActivityManager(); |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * Returns the current session |
|
| 288 | + * |
|
| 289 | + * @return \OCP\IDBConnection |
|
| 290 | + * @since 6.0.0 |
|
| 291 | + */ |
|
| 292 | + public function getDatabaseConnection(); |
|
| 293 | + |
|
| 294 | + /** |
|
| 295 | + * Returns an avatar manager, used for avatar functionality |
|
| 296 | + * |
|
| 297 | + * @return \OCP\IAvatarManager |
|
| 298 | + * @since 6.0.0 |
|
| 299 | + */ |
|
| 300 | + public function getAvatarManager(); |
|
| 301 | + |
|
| 302 | + /** |
|
| 303 | + * Returns an job list for controlling background jobs |
|
| 304 | + * |
|
| 305 | + * @return \OCP\BackgroundJob\IJobList |
|
| 306 | + * @since 7.0.0 |
|
| 307 | + */ |
|
| 308 | + public function getJobList(); |
|
| 309 | + |
|
| 310 | + /** |
|
| 311 | + * Returns a logger instance |
|
| 312 | + * |
|
| 313 | + * @return \OCP\ILogger |
|
| 314 | + * @since 8.0.0 |
|
| 315 | + */ |
|
| 316 | + public function getLogger(); |
|
| 317 | + |
|
| 318 | + /** |
|
| 319 | + * returns a log factory instance |
|
| 320 | + * |
|
| 321 | + * @return ILogFactory |
|
| 322 | + * @since 14.0.0 |
|
| 323 | + */ |
|
| 324 | + public function getLogFactory(); |
|
| 325 | + |
|
| 326 | + /** |
|
| 327 | + * Returns a router for generating and matching urls |
|
| 328 | + * |
|
| 329 | + * @return \OCP\Route\IRouter |
|
| 330 | + * @since 7.0.0 |
|
| 331 | + */ |
|
| 332 | + public function getRouter(); |
|
| 333 | + |
|
| 334 | + /** |
|
| 335 | + * Returns a search instance |
|
| 336 | + * |
|
| 337 | + * @return \OCP\ISearch |
|
| 338 | + * @since 7.0.0 |
|
| 339 | + */ |
|
| 340 | + public function getSearch(); |
|
| 341 | + |
|
| 342 | + /** |
|
| 343 | + * Get the certificate manager for the user |
|
| 344 | + * |
|
| 345 | + * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager |
|
| 346 | + * @return \OCP\ICertificateManager | null if $userId is null and no user is logged in |
|
| 347 | + * @since 8.0.0 |
|
| 348 | + */ |
|
| 349 | + public function getCertificateManager($userId = null); |
|
| 350 | + |
|
| 351 | + /** |
|
| 352 | + * Create a new event source |
|
| 353 | + * |
|
| 354 | + * @return \OCP\IEventSource |
|
| 355 | + * @since 8.0.0 |
|
| 356 | + */ |
|
| 357 | + public function createEventSource(); |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * Returns an instance of the HTTP client service |
|
| 361 | + * |
|
| 362 | + * @return \OCP\Http\Client\IClientService |
|
| 363 | + * @since 8.1.0 |
|
| 364 | + */ |
|
| 365 | + public function getHTTPClientService(); |
|
| 366 | + |
|
| 367 | + /** |
|
| 368 | + * Get the active event logger |
|
| 369 | + * |
|
| 370 | + * @return \OCP\Diagnostics\IEventLogger |
|
| 371 | + * @since 8.0.0 |
|
| 372 | + */ |
|
| 373 | + public function getEventLogger(); |
|
| 374 | + |
|
| 375 | + /** |
|
| 376 | + * Get the active query logger |
|
| 377 | + * |
|
| 378 | + * The returned logger only logs data when debug mode is enabled |
|
| 379 | + * |
|
| 380 | + * @return \OCP\Diagnostics\IQueryLogger |
|
| 381 | + * @since 8.0.0 |
|
| 382 | + */ |
|
| 383 | + public function getQueryLogger(); |
|
| 384 | + |
|
| 385 | + /** |
|
| 386 | + * Get the manager for temporary files and folders |
|
| 387 | + * |
|
| 388 | + * @return \OCP\ITempManager |
|
| 389 | + * @since 8.0.0 |
|
| 390 | + */ |
|
| 391 | + public function getTempManager(); |
|
| 392 | + |
|
| 393 | + /** |
|
| 394 | + * Get the app manager |
|
| 395 | + * |
|
| 396 | + * @return \OCP\App\IAppManager |
|
| 397 | + * @since 8.0.0 |
|
| 398 | + */ |
|
| 399 | + public function getAppManager(); |
|
| 400 | + |
|
| 401 | + /** |
|
| 402 | + * Get the webroot |
|
| 403 | + * |
|
| 404 | + * @return string |
|
| 405 | + * @since 8.0.0 |
|
| 406 | + */ |
|
| 407 | + public function getWebRoot(); |
|
| 408 | + |
|
| 409 | + /** |
|
| 410 | + * @return \OCP\Files\Config\IMountProviderCollection |
|
| 411 | + * @since 8.0.0 |
|
| 412 | + */ |
|
| 413 | + public function getMountProviderCollection(); |
|
| 414 | + |
|
| 415 | + /** |
|
| 416 | + * Get the IniWrapper |
|
| 417 | + * |
|
| 418 | + * @return \bantu\IniGetWrapper\IniGetWrapper |
|
| 419 | + * @since 8.0.0 |
|
| 420 | + */ |
|
| 421 | + public function getIniWrapper(); |
|
| 422 | + /** |
|
| 423 | + * @return \OCP\Command\IBus |
|
| 424 | + * @since 8.1.0 |
|
| 425 | + */ |
|
| 426 | + public function getCommandBus(); |
|
| 427 | + |
|
| 428 | + /** |
|
| 429 | + * Creates a new mailer |
|
| 430 | + * |
|
| 431 | + * @return \OCP\Mail\IMailer |
|
| 432 | + * @since 8.1.0 |
|
| 433 | + */ |
|
| 434 | + public function getMailer(); |
|
| 435 | + |
|
| 436 | + /** |
|
| 437 | + * Get the locking provider |
|
| 438 | + * |
|
| 439 | + * @return \OCP\Lock\ILockingProvider |
|
| 440 | + * @since 8.1.0 |
|
| 441 | + */ |
|
| 442 | + public function getLockingProvider(); |
|
| 443 | + |
|
| 444 | + /** |
|
| 445 | + * @return \OCP\Files\Mount\IMountManager |
|
| 446 | + * @since 8.2.0 |
|
| 447 | + */ |
|
| 448 | + public function getMountManager(); |
|
| 449 | + |
|
| 450 | + /** |
|
| 451 | + * Get the MimeTypeDetector |
|
| 452 | + * |
|
| 453 | + * @return \OCP\Files\IMimeTypeDetector |
|
| 454 | + * @since 8.2.0 |
|
| 455 | + */ |
|
| 456 | + public function getMimeTypeDetector(); |
|
| 457 | + |
|
| 458 | + /** |
|
| 459 | + * Get the MimeTypeLoader |
|
| 460 | + * |
|
| 461 | + * @return \OCP\Files\IMimeTypeLoader |
|
| 462 | + * @since 8.2.0 |
|
| 463 | + */ |
|
| 464 | + public function getMimeTypeLoader(); |
|
| 465 | + |
|
| 466 | + /** |
|
| 467 | + * Get the EventDispatcher |
|
| 468 | + * |
|
| 469 | + * @return EventDispatcherInterface |
|
| 470 | + * @since 8.2.0 |
|
| 471 | + */ |
|
| 472 | + public function getEventDispatcher(); |
|
| 473 | + |
|
| 474 | + /** |
|
| 475 | + * Get the Notification Manager |
|
| 476 | + * |
|
| 477 | + * @return \OCP\Notification\IManager |
|
| 478 | + * @since 9.0.0 |
|
| 479 | + */ |
|
| 480 | + public function getNotificationManager(); |
|
| 481 | + |
|
| 482 | + /** |
|
| 483 | + * @return \OCP\Comments\ICommentsManager |
|
| 484 | + * @since 9.0.0 |
|
| 485 | + */ |
|
| 486 | + public function getCommentsManager(); |
|
| 487 | + |
|
| 488 | + /** |
|
| 489 | + * Returns the system-tag manager |
|
| 490 | + * |
|
| 491 | + * @return \OCP\SystemTag\ISystemTagManager |
|
| 492 | + * |
|
| 493 | + * @since 9.0.0 |
|
| 494 | + */ |
|
| 495 | + public function getSystemTagManager(); |
|
| 496 | + |
|
| 497 | + /** |
|
| 498 | + * Returns the system-tag object mapper |
|
| 499 | + * |
|
| 500 | + * @return \OCP\SystemTag\ISystemTagObjectMapper |
|
| 501 | + * |
|
| 502 | + * @since 9.0.0 |
|
| 503 | + */ |
|
| 504 | + public function getSystemTagObjectMapper(); |
|
| 505 | + |
|
| 506 | + /** |
|
| 507 | + * Returns the share manager |
|
| 508 | + * |
|
| 509 | + * @return \OCP\Share\IManager |
|
| 510 | + * @since 9.0.0 |
|
| 511 | + */ |
|
| 512 | + public function getShareManager(); |
|
| 513 | + |
|
| 514 | + /** |
|
| 515 | + * @return IContentSecurityPolicyManager |
|
| 516 | + * @since 9.0.0 |
|
| 517 | + */ |
|
| 518 | + public function getContentSecurityPolicyManager(); |
|
| 519 | + |
|
| 520 | + /** |
|
| 521 | + * @return \OCP\IDateTimeZone |
|
| 522 | + * @since 8.0.0 |
|
| 523 | + */ |
|
| 524 | + public function getDateTimeZone(); |
|
| 525 | + |
|
| 526 | + /** |
|
| 527 | + * @return \OCP\IDateTimeFormatter |
|
| 528 | + * @since 8.0.0 |
|
| 529 | + */ |
|
| 530 | + public function getDateTimeFormatter(); |
|
| 531 | + |
|
| 532 | + /** |
|
| 533 | + * @return \OCP\Federation\ICloudIdManager |
|
| 534 | + * @since 12.0.0 |
|
| 535 | + */ |
|
| 536 | + public function getCloudIdManager(); |
|
| 537 | + |
|
| 538 | + /** |
|
| 539 | + * @return \OCP\Remote\Api\IApiFactory |
|
| 540 | + * @since 13.0.0 |
|
| 541 | + */ |
|
| 542 | + public function getRemoteApiFactory(); |
|
| 543 | + |
|
| 544 | + /** |
|
| 545 | + * @return \OCP\Remote\IInstanceFactory |
|
| 546 | + * @since 13.0.0 |
|
| 547 | + */ |
|
| 548 | + public function getRemoteInstanceFactory(); |
|
| 549 | 549 | } |
@@ -53,203 +53,203 @@ |
||
| 53 | 53 | |
| 54 | 54 | class Application extends App { |
| 55 | 55 | |
| 56 | - /** @var ILogger */ |
|
| 57 | - protected $logger; |
|
| 58 | - |
|
| 59 | - public function __construct() { |
|
| 60 | - parent::__construct('admin_audit'); |
|
| 61 | - $this->initLogger(); |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - public function initLogger() { |
|
| 65 | - $c = $this->getContainer()->getServer(); |
|
| 66 | - |
|
| 67 | - $logFile = $c->getConfig()->getAppValue('admin_audit', 'logfile', null); |
|
| 68 | - if($logFile === null) { |
|
| 69 | - $this->logger = $c->getLogger(); |
|
| 70 | - return; |
|
| 71 | - } |
|
| 72 | - $this->logger = $c->getLogFactory()->getCustomLogger($logFile); |
|
| 73 | - |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - public function register() { |
|
| 77 | - $this->registerHooks(); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Register hooks in order to log them |
|
| 82 | - */ |
|
| 83 | - protected function registerHooks() { |
|
| 84 | - $this->userManagementHooks(); |
|
| 85 | - $this->groupHooks(); |
|
| 86 | - $this->authHooks(); |
|
| 87 | - |
|
| 88 | - $this->consoleHooks(); |
|
| 89 | - $this->appHooks(); |
|
| 90 | - |
|
| 91 | - $this->sharingHooks(); |
|
| 92 | - |
|
| 93 | - $this->fileHooks(); |
|
| 94 | - $this->trashbinHooks(); |
|
| 95 | - $this->versionsHooks(); |
|
| 96 | - |
|
| 97 | - $this->securityHooks(); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - protected function userManagementHooks() { |
|
| 101 | - $userActions = new UserManagement($this->logger); |
|
| 102 | - |
|
| 103 | - Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
| 104 | - Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
| 105 | - Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
| 106 | - |
|
| 107 | - /** @var IUserSession|Session $userSession */ |
|
| 108 | - $userSession = $this->getContainer()->getServer()->getUserSession(); |
|
| 109 | - $userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']); |
|
| 110 | - $userSession->listen('\OC\User', 'assignedUserId', [$userActions, 'assign']); |
|
| 111 | - $userSession->listen('\OC\User', 'postUnassignedUserId', [$userActions, 'unassign']); |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - protected function groupHooks() { |
|
| 115 | - $groupActions = new GroupManagement($this->logger); |
|
| 116 | - |
|
| 117 | - /** @var IGroupManager|Manager $groupManager */ |
|
| 118 | - $groupManager = $this->getContainer()->getServer()->getGroupManager(); |
|
| 119 | - $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
| 120 | - $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
| 121 | - $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
| 122 | - $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - protected function sharingHooks() { |
|
| 126 | - $shareActions = new Sharing($this->logger); |
|
| 127 | - |
|
| 128 | - Util::connectHook(Share::class, 'post_shared', $shareActions, 'shared'); |
|
| 129 | - Util::connectHook(Share::class, 'post_unshare', $shareActions, 'unshare'); |
|
| 130 | - Util::connectHook(Share::class, 'post_update_permissions', $shareActions, 'updatePermissions'); |
|
| 131 | - Util::connectHook(Share::class, 'post_update_password', $shareActions, 'updatePassword'); |
|
| 132 | - Util::connectHook(Share::class, 'post_set_expiration_date', $shareActions, 'updateExpirationDate'); |
|
| 133 | - Util::connectHook(Share::class, 'share_link_access', $shareActions, 'shareAccessed'); |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - protected function authHooks() { |
|
| 137 | - $authActions = new Auth($this->logger); |
|
| 138 | - |
|
| 139 | - Util::connectHook('OC_User', 'pre_login', $authActions, 'loginAttempt'); |
|
| 140 | - Util::connectHook('OC_User', 'post_login', $authActions, 'loginSuccessful'); |
|
| 141 | - Util::connectHook('OC_User', 'logout', $authActions, 'logout'); |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - protected function appHooks() { |
|
| 145 | - |
|
| 146 | - $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 147 | - $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function(ManagerEvent $event) { |
|
| 148 | - $appActions = new AppManagement($this->logger); |
|
| 149 | - $appActions->enableApp($event->getAppID()); |
|
| 150 | - }); |
|
| 151 | - $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, function(ManagerEvent $event) { |
|
| 152 | - $appActions = new AppManagement($this->logger); |
|
| 153 | - $appActions->enableAppForGroups($event->getAppID(), $event->getGroups()); |
|
| 154 | - }); |
|
| 155 | - $eventDispatcher->addListener(ManagerEvent::EVENT_APP_DISABLE, function(ManagerEvent $event) { |
|
| 156 | - $appActions = new AppManagement($this->logger); |
|
| 157 | - $appActions->disableApp($event->getAppID()); |
|
| 158 | - }); |
|
| 159 | - |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - protected function consoleHooks() { |
|
| 163 | - $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 164 | - $eventDispatcher->addListener(ConsoleEvent::EVENT_RUN, function(ConsoleEvent $event) { |
|
| 165 | - $appActions = new Console($this->logger); |
|
| 166 | - $appActions->runCommand($event->getArguments()); |
|
| 167 | - }); |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - protected function fileHooks() { |
|
| 171 | - $fileActions = new Files($this->logger); |
|
| 172 | - $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 173 | - $eventDispatcher->addListener( |
|
| 174 | - IPreview::EVENT, |
|
| 175 | - function(GenericEvent $event) use ($fileActions) { |
|
| 176 | - /** @var File $file */ |
|
| 177 | - $file = $event->getSubject(); |
|
| 178 | - $fileActions->preview([ |
|
| 179 | - 'path' => substr($file->getInternalPath(), 5), |
|
| 180 | - 'width' => $event->getArguments()['width'], |
|
| 181 | - 'height' => $event->getArguments()['height'], |
|
| 182 | - 'crop' => $event->getArguments()['crop'], |
|
| 183 | - 'mode' => $event->getArguments()['mode'] |
|
| 184 | - ]); |
|
| 185 | - } |
|
| 186 | - ); |
|
| 187 | - |
|
| 188 | - Util::connectHook( |
|
| 189 | - Filesystem::CLASSNAME, |
|
| 190 | - Filesystem::signal_post_rename, |
|
| 191 | - $fileActions, |
|
| 192 | - 'rename' |
|
| 193 | - ); |
|
| 194 | - Util::connectHook( |
|
| 195 | - Filesystem::CLASSNAME, |
|
| 196 | - Filesystem::signal_post_create, |
|
| 197 | - $fileActions, |
|
| 198 | - 'create' |
|
| 199 | - ); |
|
| 200 | - Util::connectHook( |
|
| 201 | - Filesystem::CLASSNAME, |
|
| 202 | - Filesystem::signal_post_copy, |
|
| 203 | - $fileActions, |
|
| 204 | - 'copy' |
|
| 205 | - ); |
|
| 206 | - Util::connectHook( |
|
| 207 | - Filesystem::CLASSNAME, |
|
| 208 | - Filesystem::signal_post_write, |
|
| 209 | - $fileActions, |
|
| 210 | - 'write' |
|
| 211 | - ); |
|
| 212 | - Util::connectHook( |
|
| 213 | - Filesystem::CLASSNAME, |
|
| 214 | - Filesystem::signal_post_update, |
|
| 215 | - $fileActions, |
|
| 216 | - 'update' |
|
| 217 | - ); |
|
| 218 | - Util::connectHook( |
|
| 219 | - Filesystem::CLASSNAME, |
|
| 220 | - Filesystem::signal_read, |
|
| 221 | - $fileActions, |
|
| 222 | - 'read' |
|
| 223 | - ); |
|
| 224 | - Util::connectHook( |
|
| 225 | - Filesystem::CLASSNAME, |
|
| 226 | - Filesystem::signal_delete, |
|
| 227 | - $fileActions, |
|
| 228 | - 'delete' |
|
| 229 | - ); |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - protected function versionsHooks() { |
|
| 233 | - $versionsActions = new Versions($this->logger); |
|
| 234 | - Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); |
|
| 235 | - Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - protected function trashbinHooks() { |
|
| 239 | - $trashActions = new Trashbin($this->logger); |
|
| 240 | - Util::connectHook('\OCP\Trashbin', 'preDelete', $trashActions, 'delete'); |
|
| 241 | - Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', $trashActions, 'restore'); |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - protected function securityHooks() { |
|
| 245 | - $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 246 | - $eventDispatcher->addListener(IProvider::EVENT_SUCCESS, function(GenericEvent $event) { |
|
| 247 | - $security = new Security($this->logger); |
|
| 248 | - $security->twofactorSuccess($event->getSubject(), $event->getArguments()); |
|
| 249 | - }); |
|
| 250 | - $eventDispatcher->addListener(IProvider::EVENT_FAILED, function(GenericEvent $event) { |
|
| 251 | - $security = new Security($this->logger); |
|
| 252 | - $security->twofactorFailed($event->getSubject(), $event->getArguments()); |
|
| 253 | - }); |
|
| 254 | - } |
|
| 56 | + /** @var ILogger */ |
|
| 57 | + protected $logger; |
|
| 58 | + |
|
| 59 | + public function __construct() { |
|
| 60 | + parent::__construct('admin_audit'); |
|
| 61 | + $this->initLogger(); |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + public function initLogger() { |
|
| 65 | + $c = $this->getContainer()->getServer(); |
|
| 66 | + |
|
| 67 | + $logFile = $c->getConfig()->getAppValue('admin_audit', 'logfile', null); |
|
| 68 | + if($logFile === null) { |
|
| 69 | + $this->logger = $c->getLogger(); |
|
| 70 | + return; |
|
| 71 | + } |
|
| 72 | + $this->logger = $c->getLogFactory()->getCustomLogger($logFile); |
|
| 73 | + |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + public function register() { |
|
| 77 | + $this->registerHooks(); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Register hooks in order to log them |
|
| 82 | + */ |
|
| 83 | + protected function registerHooks() { |
|
| 84 | + $this->userManagementHooks(); |
|
| 85 | + $this->groupHooks(); |
|
| 86 | + $this->authHooks(); |
|
| 87 | + |
|
| 88 | + $this->consoleHooks(); |
|
| 89 | + $this->appHooks(); |
|
| 90 | + |
|
| 91 | + $this->sharingHooks(); |
|
| 92 | + |
|
| 93 | + $this->fileHooks(); |
|
| 94 | + $this->trashbinHooks(); |
|
| 95 | + $this->versionsHooks(); |
|
| 96 | + |
|
| 97 | + $this->securityHooks(); |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + protected function userManagementHooks() { |
|
| 101 | + $userActions = new UserManagement($this->logger); |
|
| 102 | + |
|
| 103 | + Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
| 104 | + Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
| 105 | + Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
| 106 | + |
|
| 107 | + /** @var IUserSession|Session $userSession */ |
|
| 108 | + $userSession = $this->getContainer()->getServer()->getUserSession(); |
|
| 109 | + $userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']); |
|
| 110 | + $userSession->listen('\OC\User', 'assignedUserId', [$userActions, 'assign']); |
|
| 111 | + $userSession->listen('\OC\User', 'postUnassignedUserId', [$userActions, 'unassign']); |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + protected function groupHooks() { |
|
| 115 | + $groupActions = new GroupManagement($this->logger); |
|
| 116 | + |
|
| 117 | + /** @var IGroupManager|Manager $groupManager */ |
|
| 118 | + $groupManager = $this->getContainer()->getServer()->getGroupManager(); |
|
| 119 | + $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
| 120 | + $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
| 121 | + $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
| 122 | + $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + protected function sharingHooks() { |
|
| 126 | + $shareActions = new Sharing($this->logger); |
|
| 127 | + |
|
| 128 | + Util::connectHook(Share::class, 'post_shared', $shareActions, 'shared'); |
|
| 129 | + Util::connectHook(Share::class, 'post_unshare', $shareActions, 'unshare'); |
|
| 130 | + Util::connectHook(Share::class, 'post_update_permissions', $shareActions, 'updatePermissions'); |
|
| 131 | + Util::connectHook(Share::class, 'post_update_password', $shareActions, 'updatePassword'); |
|
| 132 | + Util::connectHook(Share::class, 'post_set_expiration_date', $shareActions, 'updateExpirationDate'); |
|
| 133 | + Util::connectHook(Share::class, 'share_link_access', $shareActions, 'shareAccessed'); |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + protected function authHooks() { |
|
| 137 | + $authActions = new Auth($this->logger); |
|
| 138 | + |
|
| 139 | + Util::connectHook('OC_User', 'pre_login', $authActions, 'loginAttempt'); |
|
| 140 | + Util::connectHook('OC_User', 'post_login', $authActions, 'loginSuccessful'); |
|
| 141 | + Util::connectHook('OC_User', 'logout', $authActions, 'logout'); |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + protected function appHooks() { |
|
| 145 | + |
|
| 146 | + $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 147 | + $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function(ManagerEvent $event) { |
|
| 148 | + $appActions = new AppManagement($this->logger); |
|
| 149 | + $appActions->enableApp($event->getAppID()); |
|
| 150 | + }); |
|
| 151 | + $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, function(ManagerEvent $event) { |
|
| 152 | + $appActions = new AppManagement($this->logger); |
|
| 153 | + $appActions->enableAppForGroups($event->getAppID(), $event->getGroups()); |
|
| 154 | + }); |
|
| 155 | + $eventDispatcher->addListener(ManagerEvent::EVENT_APP_DISABLE, function(ManagerEvent $event) { |
|
| 156 | + $appActions = new AppManagement($this->logger); |
|
| 157 | + $appActions->disableApp($event->getAppID()); |
|
| 158 | + }); |
|
| 159 | + |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + protected function consoleHooks() { |
|
| 163 | + $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 164 | + $eventDispatcher->addListener(ConsoleEvent::EVENT_RUN, function(ConsoleEvent $event) { |
|
| 165 | + $appActions = new Console($this->logger); |
|
| 166 | + $appActions->runCommand($event->getArguments()); |
|
| 167 | + }); |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + protected function fileHooks() { |
|
| 171 | + $fileActions = new Files($this->logger); |
|
| 172 | + $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 173 | + $eventDispatcher->addListener( |
|
| 174 | + IPreview::EVENT, |
|
| 175 | + function(GenericEvent $event) use ($fileActions) { |
|
| 176 | + /** @var File $file */ |
|
| 177 | + $file = $event->getSubject(); |
|
| 178 | + $fileActions->preview([ |
|
| 179 | + 'path' => substr($file->getInternalPath(), 5), |
|
| 180 | + 'width' => $event->getArguments()['width'], |
|
| 181 | + 'height' => $event->getArguments()['height'], |
|
| 182 | + 'crop' => $event->getArguments()['crop'], |
|
| 183 | + 'mode' => $event->getArguments()['mode'] |
|
| 184 | + ]); |
|
| 185 | + } |
|
| 186 | + ); |
|
| 187 | + |
|
| 188 | + Util::connectHook( |
|
| 189 | + Filesystem::CLASSNAME, |
|
| 190 | + Filesystem::signal_post_rename, |
|
| 191 | + $fileActions, |
|
| 192 | + 'rename' |
|
| 193 | + ); |
|
| 194 | + Util::connectHook( |
|
| 195 | + Filesystem::CLASSNAME, |
|
| 196 | + Filesystem::signal_post_create, |
|
| 197 | + $fileActions, |
|
| 198 | + 'create' |
|
| 199 | + ); |
|
| 200 | + Util::connectHook( |
|
| 201 | + Filesystem::CLASSNAME, |
|
| 202 | + Filesystem::signal_post_copy, |
|
| 203 | + $fileActions, |
|
| 204 | + 'copy' |
|
| 205 | + ); |
|
| 206 | + Util::connectHook( |
|
| 207 | + Filesystem::CLASSNAME, |
|
| 208 | + Filesystem::signal_post_write, |
|
| 209 | + $fileActions, |
|
| 210 | + 'write' |
|
| 211 | + ); |
|
| 212 | + Util::connectHook( |
|
| 213 | + Filesystem::CLASSNAME, |
|
| 214 | + Filesystem::signal_post_update, |
|
| 215 | + $fileActions, |
|
| 216 | + 'update' |
|
| 217 | + ); |
|
| 218 | + Util::connectHook( |
|
| 219 | + Filesystem::CLASSNAME, |
|
| 220 | + Filesystem::signal_read, |
|
| 221 | + $fileActions, |
|
| 222 | + 'read' |
|
| 223 | + ); |
|
| 224 | + Util::connectHook( |
|
| 225 | + Filesystem::CLASSNAME, |
|
| 226 | + Filesystem::signal_delete, |
|
| 227 | + $fileActions, |
|
| 228 | + 'delete' |
|
| 229 | + ); |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + protected function versionsHooks() { |
|
| 233 | + $versionsActions = new Versions($this->logger); |
|
| 234 | + Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); |
|
| 235 | + Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + protected function trashbinHooks() { |
|
| 239 | + $trashActions = new Trashbin($this->logger); |
|
| 240 | + Util::connectHook('\OCP\Trashbin', 'preDelete', $trashActions, 'delete'); |
|
| 241 | + Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', $trashActions, 'restore'); |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + protected function securityHooks() { |
|
| 245 | + $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 246 | + $eventDispatcher->addListener(IProvider::EVENT_SUCCESS, function(GenericEvent $event) { |
|
| 247 | + $security = new Security($this->logger); |
|
| 248 | + $security->twofactorSuccess($event->getSubject(), $event->getArguments()); |
|
| 249 | + }); |
|
| 250 | + $eventDispatcher->addListener(IProvider::EVENT_FAILED, function(GenericEvent $event) { |
|
| 251 | + $security = new Security($this->logger); |
|
| 252 | + $security->twofactorFailed($event->getSubject(), $event->getArguments()); |
|
| 253 | + }); |
|
| 254 | + } |
|
| 255 | 255 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $c = $this->getContainer()->getServer(); |
| 66 | 66 | |
| 67 | 67 | $logFile = $c->getConfig()->getAppValue('admin_audit', 'logfile', null); |
| 68 | - if($logFile === null) { |
|
| 68 | + if ($logFile === null) { |
|
| 69 | 69 | $this->logger = $c->getLogger(); |
| 70 | 70 | return; |
| 71 | 71 | } |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | protected function userManagementHooks() { |
| 101 | 101 | $userActions = new UserManagement($this->logger); |
| 102 | 102 | |
| 103 | - Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
| 104 | - Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
| 105 | - Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
| 103 | + Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
| 104 | + Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
| 105 | + Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
| 106 | 106 | |
| 107 | 107 | /** @var IUserSession|Session $userSession */ |
| 108 | 108 | $userSession = $this->getContainer()->getServer()->getUserSession(); |
@@ -111,15 +111,15 @@ discard block |
||
| 111 | 111 | $userSession->listen('\OC\User', 'postUnassignedUserId', [$userActions, 'unassign']); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - protected function groupHooks() { |
|
| 114 | + protected function groupHooks() { |
|
| 115 | 115 | $groupActions = new GroupManagement($this->logger); |
| 116 | 116 | |
| 117 | 117 | /** @var IGroupManager|Manager $groupManager */ |
| 118 | 118 | $groupManager = $this->getContainer()->getServer()->getGroupManager(); |
| 119 | - $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
| 120 | - $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
| 121 | - $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
| 122 | - $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
| 119 | + $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
| 120 | + $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
| 121 | + $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
| 122 | + $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | protected function sharingHooks() { |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | protected function versionsHooks() { |
| 233 | 233 | $versionsActions = new Versions($this->logger); |
| 234 | 234 | Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); |
| 235 | - Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); |
|
| 235 | + Util::connectHook('\OCP\Versions', 'delete', $versionsActions, 'delete'); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | protected function trashbinHooks() { |