ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\StaticURL\Context Class Reference

What a {. More...

+ Collaboration diagram for ILIAS\StaticURL\Context:

Public Member Functions

 __construct (private readonly GlobalHttpState $http, private readonly Factory $refinery, private readonly Access $access, private readonly URIBuilder $builder, private readonly UserProxy $user, private readonly RepositoryTreeProxy $tree, private readonly LanguageProxy $language, private readonly MainTemplateProxy $main_template, private readonly CtrlProxy $ctrl, private readonly SettingsProxy $settings,)
 
 getUserLanguage ()
 
 refinery ()
 
 lng ()
 
 mainTemplate ()
 
 http ()
 
 ctrl ()
 
 checkPermission (string $permission, int $ref_id)
 
 getParentRefId (int $ref_id)
 
 exists (int $ref_id)
 
 findFirstAccessibleParentRefId (int $ref_id, string $permission='read')
 
 getUserId ()
 
 isUserLoggedIn ()
 
 isPublicSectionActive ()
 
 builder ()
 

Detailed Description

What a {.

See also
\ILIAS\StaticURL\Handler\Handler} may reach out to while it resolves a static URL.

Services that are wired through the component bootstrap are injected as themselves. Everything else still lives in the legacy container and is named by a dedicated proxy, so this class states its dependencies instead of holding a container that can produce anything.

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 43 of file Context.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\StaticURL\Context::__construct ( private readonly GlobalHttpState  $http,
private readonly Factory  $refinery,
private readonly Access  $access,
private readonly URIBuilder  $builder,
private readonly UserProxy  $user,
private readonly RepositoryTreeProxy  $tree,
private readonly LanguageProxy  $language,
private readonly MainTemplateProxy  $main_template,
private readonly CtrlProxy  $ctrl,
private readonly SettingsProxy  $settings 
)

Definition at line 45 of file Context.php.

56 {
57 }

Member Function Documentation

◆ builder()

ILIAS\StaticURL\Context::builder ( )

Definition at line 145 of file Context.php.

145 : URIBuilder
146 {
147 return $this->builder;
148 }

◆ checkPermission()

ILIAS\StaticURL\Context::checkPermission ( string  $permission,
int  $ref_id 
)

Definition at line 89 of file Context.php.

89 : bool
90 {
91 return $this->access->checkAccess($permission, '', $ref_id);
92 }

References ILIAS\Repository\access().

Referenced by ILIAS\StaticURL\Context\findFirstAccessibleParentRefId(), ILIAS\Exercise\PermanentLink\StaticURLHandler\handle(), and ILIAS\Export\ExportHandler\StaticUrlHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ctrl()

◆ exists()

ILIAS\StaticURL\Context::exists ( int  $ref_id)

Definition at line 99 of file Context.php.

99 : bool
100 {
101 return $this->tree->isInTree($ref_id);
102 }

Referenced by ILIAS\Exercise\PermanentLink\StaticURLHandler\handle().

+ Here is the caller graph for this function:

◆ findFirstAccessibleParentRefId()

ILIAS\StaticURL\Context::findFirstAccessibleParentRefId ( int  $ref_id,
string  $permission = 'read' 
)

Definition at line 104 of file Context.php.

104 : ?int
105 {
106 if ($ref_id <= 0 || !$this->tree->isInTree($ref_id)) {
107 return null;
108 }
109
110 $root_id = $this->tree->getRootId();
111 $current = $ref_id;
112 $visited = [];
113 while (($parent = (int) $this->tree->getParentId($current)) > 0) {
114 if (isset($visited[$parent])) {
115 return null;
116 }
117 $visited[$parent] = true;
118 if ($this->checkPermission($permission, $parent)) {
119 return $parent;
120 }
121 if ($parent === $root_id) {
122 return null;
123 }
124 $current = $parent;
125 }
126
127 return null;
128 }
checkPermission(string $permission, int $ref_id)
Definition: Context.php:89

References ILIAS\StaticURL\Context\checkPermission().

+ Here is the call graph for this function:

◆ getParentRefId()

ILIAS\StaticURL\Context::getParentRefId ( int  $ref_id)

Definition at line 94 of file Context.php.

94 : ?int
95 {
96 return $this->tree->getParentId($ref_id);
97 }

◆ getUserId()

ILIAS\StaticURL\Context::getUserId ( )

Definition at line 130 of file Context.php.

130 : int
131 {
132 return $this->user->getId();
133 }

References ILIAS\Repository\user().

Referenced by ILIAS\Export\ExportHandler\StaticUrlHandler\handle(), and ILIAS\StaticURL\Handler\LegacyGotoHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserLanguage()

ILIAS\StaticURL\Context::getUserLanguage ( )

Definition at line 59 of file Context.php.

59 : string
60 {
61 return $this->user->getCurrentLanguage();
62 }

References ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ http()

ILIAS\StaticURL\Context::http ( )

◆ isPublicSectionActive()

ILIAS\StaticURL\Context::isPublicSectionActive ( )

Definition at line 140 of file Context.php.

140 : bool
141 {
142 return (bool) $this->settings->get('pub_section');
143 }

References ILIAS\Repository\settings().

Referenced by ILIAS\Export\ExportHandler\StaticUrlHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isUserLoggedIn()

ILIAS\StaticURL\Context::isUserLoggedIn ( )

Definition at line 135 of file Context.php.

135 : bool
136 {
137 return !$this->user->isAnonymous() && $this->user->getId() !== 0;
138 }

References ILIAS\Repository\user().

Referenced by ILIAS\Badge\URL\StaticUrlHandler\handle(), ILIAS\Certificate\StaticUrlHandler\handle(), ILIAS\Contact\URL\StaticUrlHandler\handle(), ILIAS\Exercise\PermanentLink\StaticURLHandler\handle(), ILIAS\Export\ExportHandler\StaticUrlHandler\handle(), and ILIAS\User\StaticURLHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lng()

ILIAS\StaticURL\Context::lng ( )

Definition at line 69 of file Context.php.

70 {
71 return $this->language->get();
72 }
language handling

References ILIAS\UI\examples\Symbol\Glyph\Language\language().

+ Here is the call graph for this function:

◆ mainTemplate()

ILIAS\StaticURL\Context::mainTemplate ( )

Definition at line 74 of file Context.php.

75 {
76 return $this->main_template->get();
77 }
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

References ILIAS\UICore\GlobalTemplate\get().

+ Here is the call graph for this function:

◆ refinery()

ILIAS\StaticURL\Context::refinery ( )

Definition at line 64 of file Context.php.

64 : Factory
65 {
66 return $this->refinery;
67 }
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31

References ILIAS\UI\examples\Layout\Page\Mail\$refinery.

Referenced by ILIAS\StaticURL\Handler\HandlerService\appendUnknownParameters().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: