19declare(strict_types=1);
36 protected readonly \
ilTree $tree,
47 $cached_contexts = $this->cache->getUserContextAccess($user->
getId(), $criteria);
48 if ($cached_contexts !==
null) {
49 return $cached_contexts;
56 $this->cache->storeUserContextAccess($user->
getId(), $criteria, $contexts);
82 return $user->
getPref(
'pd_items_news') !==
'n';
92 foreach ($this->favourites_repository->getFavouritesOfUser($user->
getId()) as $item) {
93 $contexts[] =
new NewsContext($item[
'ref_id'], $item[
'obj_id'], $item[
'type']);
106 foreach ($memberships as $obj_id) {
107 $contexts = array_merge(
123 $unique_contexts = [];
126 if (isset($unique_contexts[
$context->getRefId()])) {
132 !$this->access->checkAccessOfUser($user->
getId(),
'read',
'',
$context->getRefId())
140 return array_values($unique_contexts);
News Context DTO represents a context where news items can be associated with.
News Criteria DTO for querying news items supports caching, JSON serialization, and validation.
User Context Resolver resolves which contexts a user can access for news operations.
getMembershipContexts(\ilObjUser $user)
filterContexts(\ilObjUser $user, array $contexts, NewsCriteria $criteria)
Deduplicate and filter contexts by access.
getAccessibleContexts(\ilObjUser $user, NewsCriteria $criteria)
__construct(protected readonly \ilFavouritesDBRepository $favourites_repository, protected readonly \ilAccessHandler $access, protected readonly \ilTree $tree, protected readonly NewsCache $cache)
shouldIncludePersonalDesktop(\ilObjUser $user)
getPersonalDesktopContexts(\ilObjUser $user)
resolveUserContexts(\ilObjUser $user, NewsCriteria $criteria)
Multi-Level News Cache Implementation:
static _getAllReferences(int $id)
get all reference ids for object ID
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...