Browse code

Feat: small speed up for Calendars search

Thomas Cataldo authored on 09/03/2018 09:55:48
Showing 1 changed files
... ...
@@ -99,12 +99,7 @@ public class CalendarsService implements ICalendars {
99 99
 					.instance(IContainers.class);
100 100
 			containerService.allForUser(context.getSecurityContext().getContainerUid(), query.owner, containerQuery)
101 101
 					.stream().filter(cal -> {
102
-						try {
103
-							Container calContainer = containerStore.get(cal.uid);
104
-							return RBACManager.forContext(context).forContainer(calContainer).can(Verb.Read.name());
105
-						} catch (Exception e) {
106
-							return false;
107
-						}
102
+						return cal.verbs.stream().anyMatch(v -> v.can(Verb.Read));
108 103
 					}).forEach(cal -> containers.add(cal.uid));
109 104
 		}
110 105