@@ -92,7 +92,7 @@ public function getChildren() {
9292 // Should never happen because we don't allow anonymous access
9393 return [];
9494 }
95- if (!$ shareEnumeration || (!$ shareEnumerationGroup && $ shareEnumerationPhone )) {
95+ if ($ user -> getBackendClassName () === ' Guests ' || !$ shareEnumeration || (!$ shareEnumerationGroup && $ shareEnumerationPhone )) {
9696 $ name = SyncService::getCardUri ($ user );
9797 try {
9898 return [parent ::getChild ($ name )];
@@ -135,8 +135,8 @@ public function getMultipleChildren($paths): array {
135135 $ shareEnumeration = $ this ->config ->getAppValue ('core ' , 'shareapi_allow_share_dialog_user_enumeration ' , 'yes ' ) === 'yes ' ;
136136 $ shareEnumerationGroup = $ this ->config ->getAppValue ('core ' , 'shareapi_restrict_user_enumeration_to_group ' , 'no ' ) === 'yes ' ;
137137 $ shareEnumerationPhone = $ this ->config ->getAppValue ('core ' , 'shareapi_restrict_user_enumeration_to_phone ' , 'no ' ) === 'yes ' ;
138- if (! $ shareEnumeration || (! $ shareEnumerationGroup && $ shareEnumerationPhone )) {
139- $ user = $ this -> userSession -> getUser ();
138+ $ user = $ this -> userSession -> getUser ();
139+ if (( $ user !== null && $ user -> getBackendClassName () === ' Guests ' ) || ! $ shareEnumeration || (! $ shareEnumerationGroup && $ shareEnumerationPhone )) {
140140 // No user or cards with no access
141141 if ($ user === null || !in_array (SyncService::getCardUri ($ user ), $ paths , true )) {
142142 return [];
@@ -149,7 +149,6 @@ public function getMultipleChildren($paths): array {
149149 }
150150 }
151151 if ($ shareEnumerationGroup ) {
152- $ user = $ this ->userSession ->getUser ();
153152 if ($ this ->groupManager === null || $ user === null ) {
154153 // Group manager or user is not available, so we can't determine which data is safe
155154 return [];
@@ -196,19 +195,18 @@ public function getMultipleChildren($paths): array {
196195 * @throws Forbidden
197196 */
198197 public function getChild ($ name ): Card {
198+ $ user = $ this ->userSession ->getUser ();
199199 $ shareEnumeration = $ this ->config ->getAppValue ('core ' , 'shareapi_allow_share_dialog_user_enumeration ' , 'yes ' ) === 'yes ' ;
200200 $ shareEnumerationGroup = $ this ->config ->getAppValue ('core ' , 'shareapi_restrict_user_enumeration_to_group ' , 'no ' ) === 'yes ' ;
201201 $ shareEnumerationPhone = $ this ->config ->getAppValue ('core ' , 'shareapi_restrict_user_enumeration_to_phone ' , 'no ' ) === 'yes ' ;
202- if (!$ shareEnumeration || (!$ shareEnumerationGroup && $ shareEnumerationPhone )) {
203- $ currentUser = $ this ->userSession ->getUser ();
204- $ ownName = $ currentUser !== null ? SyncService::getCardUri ($ currentUser ) : null ;
202+ if (($ user !== null && $ user ->getBackendClassName () === 'Guests ' ) || !$ shareEnumeration || (!$ shareEnumerationGroup && $ shareEnumerationPhone )) {
203+ $ ownName = $ user !== null ? SyncService::getCardUri ($ user ) : null ;
205204 if ($ ownName === $ name ) {
206205 return parent ::getChild ($ name );
207206 }
208207 throw new Forbidden ();
209208 }
210209 if ($ shareEnumerationGroup ) {
211- $ user = $ this ->userSession ->getUser ();
212210 if ($ user === null || $ this ->groupManager === null ) {
213211 // Group manager is not available, so we can't determine which data is safe
214212 throw new Forbidden ();
0 commit comments