|
28 | 28 | import java.util.concurrent.CompletableFuture; |
29 | 29 |
|
30 | 30 | import org.apache.commons.lang3.StringUtils; |
31 | | -import org.apache.commons.collections4.CollectionUtils; |
32 | 31 |
|
33 | 32 | import org.exoplatform.commons.cache.future.FutureCache; |
34 | 33 | import org.exoplatform.commons.cache.future.FutureExoCache; |
35 | 34 | import org.exoplatform.commons.cache.future.Loader; |
36 | 35 | import org.exoplatform.commons.file.services.FileService; |
37 | 36 | import org.exoplatform.container.PortalContainer; |
38 | 37 | import org.exoplatform.container.RootContainer.PortalContainerPostCreateTask; |
| 38 | +import org.exoplatform.portal.config.UserACL; |
39 | 39 | import org.exoplatform.services.cache.CacheService; |
40 | 40 | import org.exoplatform.services.cache.CachedObjectSelector; |
41 | 41 | import org.exoplatform.services.cache.ExoCache; |
@@ -65,6 +65,8 @@ public class ProgramCachedStorage extends ProgramStorage { |
65 | 65 |
|
66 | 66 | public static final String PROGRAM_CACHE_NAME = "gamification.domain"; |
67 | 67 |
|
| 68 | + private UserACL userAcl; |
| 69 | + |
68 | 70 | private FutureExoCache<Long, ProgramDTO, Object> programFutureCache; |
69 | 71 |
|
70 | 72 | private FutureCache<Object, List<String>, Object> administratorsRetrivalTask; |
@@ -218,10 +220,9 @@ public void postDelete(User user) throws Exception { |
218 | 220 | @ContainerTransactional |
219 | 221 | public void clearCachedAdministrator(User user) { |
220 | 222 | if (administrators != null |
| 223 | + && user != null |
221 | 224 | && (administrators.stream().anyMatch(u -> StringUtils.equals(u, user.getUserName())) |
222 | | - || CollectionUtils.isNotEmpty(organizationService.getMembershipHandler() |
223 | | - .findMembershipsByUserAndGroup(user.getUserName(), |
224 | | - Utils.REWARDING_GROUP)))) { |
| 225 | + || userAcl.getUserIdentity(user.getUserName()).isMemberOf(Utils.REWARDING_GROUP))) { |
225 | 226 | administrators = null; |
226 | 227 | } |
227 | 228 | } |
|
0 commit comments