@@ -194,10 +194,26 @@ private function registerForUser(IUser $user, StorageConfig $storage): void {
194194 );
195195 }
196196
197+ private function isApplicableForUser (StorageConfig $ storage , IUser $ user ): bool {
198+ if (count ($ storage ->getApplicableUsers ()) + count ($ storage ->getApplicableGroups ()) === 0 ) {
199+ return true ;
200+ }
201+ if (in_array ($ user ->getUID (), $ storage ->getApplicableUsers ())) {
202+ return true ;
203+ }
204+ $ groupIds = $ this ->groupManager ->getUserGroupIds ($ user );
205+ foreach ($ groupIds as $ groupId ) {
206+ if (in_array ($ groupId , $ storage ->getApplicableGroups ())) {
207+ return true ;
208+ }
209+ }
210+ return false ;
211+ }
212+
197213 private function handleUserRemoved (IGroup $ group , IUser $ user ): void {
198214 $ storages = $ this ->storagesService ->getAllStoragesForGroup ($ group );
199215 foreach ($ storages as $ storage ) {
200- if (!in_array ( $ user -> getUID () , $ storage -> getApplicableUsers () )) {
216+ if (!$ this -> isApplicableForUser ( $ storage , $ user )) {
201217 $ this ->userMountCache ->removeMount ($ storage ->getMountPointForUser ($ user ));
202218 }
203219 }
@@ -214,7 +230,7 @@ private function handleGroupDeleted(IGroup $group): void {
214230 $ storages = $ this ->storagesService ->getAllStoragesForGroup ($ group );
215231 foreach ($ storages as $ storage ) {
216232 foreach ($ group ->searchUsers ('' ) as $ user ) {
217- if (!in_array ( $ user -> getUID () , $ storage -> getApplicableUsers () )) {
233+ if (!$ this -> isApplicableForUser ( $ storage , $ user )) {
218234 $ this ->userMountCache ->removeMount ($ storage ->getMountPointForUser ($ user ));
219235 }
220236 }
0 commit comments