1111use OCP \AppFramework \Services \IAppConfig ;
1212use OCP \Cache \CappedMemoryCache ;
1313use OCP \Config \IUserConfig ;
14+ use OCP \EventDispatcher \IEventDispatcher ;
1415use OCP \IAvatarManager ;
1516use OCP \IConfig ;
1617use OCP \IDBConnection ;
@@ -44,6 +45,7 @@ public function __construct(
4445 protected IUserManager $ userManager ,
4546 protected INotificationManager $ notificationManager ,
4647 private IManager $ shareManager ,
48+ private IEventDispatcher $ eventDispatcher ,
4749 ) {
4850 $ this ->usersByDN = new CappedMemoryCache ();
4951 $ this ->usersByUid = new CappedMemoryCache ();
@@ -52,9 +54,8 @@ public function __construct(
5254 /**
5355 * Binds manager to an instance of Access.
5456 * It needs to be assigned first before the manager can be used.
55- * @param Access
5657 */
57- public function setLdapAccess (Access $ access ) {
58+ public function setLdapAccess (Access $ access ): void {
5859 $ this ->access = $ access ;
5960 }
6061
@@ -63,24 +64,22 @@ public function setLdapAccess(Access $access) {
6364 * property array
6465 * @param string $dn the DN of the user
6566 * @param string $uid the internal (owncloud) username
66- * @return User
6767 */
68- private function createAndCache ($ dn , $ uid ) {
68+ private function createAndCache (string $ dn , string $ uid ): User {
6969 $ this ->checkAccess ();
7070 $ user = new User ($ uid , $ dn , $ this ->access , $ this ->ocConfig , $ this ->userConfig , $ this ->appConfig ,
7171 clone $ this ->image , $ this ->logger ,
7272 $ this ->avatarManager , $ this ->userManager ,
73- $ this ->notificationManager );
73+ $ this ->notificationManager , $ this -> eventDispatcher );
7474 $ this ->usersByDN [$ dn ] = $ user ;
7575 $ this ->usersByUid [$ uid ] = $ user ;
7676 return $ user ;
7777 }
7878
7979 /**
80- * removes a user entry from the cache
81- * @param $uid
80+ * Removes a user entry from the cache.
8281 */
83- public function invalidate ($ uid ) {
82+ public function invalidate (string $ uid ): void {
8483 if (!isset ($ this ->usersByUid [$ uid ])) {
8584 return ;
8685 }
@@ -93,9 +92,8 @@ public function invalidate($uid) {
9392 * @brief checks whether the Access instance has been set
9493 * @throws \Exception if Access has not been set
9594 * @psalm-assert !null $this->access
96- * @return null
9795 */
98- private function checkAccess () {
96+ private function checkAccess (): void {
9997 if (is_null ($ this ->access )) {
10098 throw new \Exception ('LDAP Access instance must be set first ' );
10199 }
0 commit comments