ILIAS  trunk Revision v12.0_alpha-1329-g1094ddb0c33
ILIAS\StaticURL\Context Class Reference
+ Collaboration diagram for ILIAS\StaticURL\Context:

Public Member Functions

 __construct (private Container $container)
 
 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

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

Definition at line 29 of file Context.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\StaticURL\Context::__construct ( private Container  $container)

Definition at line 31 of file Context.php.

32 {
33 }

Member Function Documentation

◆ builder()

ILIAS\StaticURL\Context::builder ( )

Definition at line 122 of file Context.php.

122 : URIBuilder
123 {
124 return $this->container['static_url']->builder();
125 }

◆ checkPermission()

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

Definition at line 65 of file Context.php.

65 : bool
66 {
67 return $this->container->access()->checkAccess($permission, '', $ref_id);
68 }
$ref_id
Definition: ltiauth.php:66

References $ref_id.

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

+ Here is the caller graph for this function:

◆ ctrl()

◆ exists()

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

Definition at line 75 of file Context.php.

75 : bool
76 {
77 return $this->container->repositoryTree()->isInTree($ref_id);
78 }

References $ref_id.

◆ findFirstAccessibleParentRefId()

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

Definition at line 80 of file Context.php.

80 : ?int
81 {
82 $tree = $this->container->repositoryTree();
83 if ($ref_id <= 0 || !$tree->isInTree($ref_id)) {
84 return null;
85 }
86
87 $root_id = $tree->getRootId();
88 $current = $ref_id;
89 $visited = [];
90 while (($parent = (int) $tree->getParentId($current)) > 0) {
91 if (isset($visited[$parent])) {
92 return null;
93 }
94 $visited[$parent] = true;
95 if ($this->checkPermission($permission, $parent)) {
96 return $parent;
97 }
98 if ($parent === $root_id) {
99 return null;
100 }
101 $current = $parent;
102 }
103
104 return null;
105 }
checkPermission(string $permission, int $ref_id)
Definition: Context.php:65

References $ref_id, and ILIAS\StaticURL\Context\checkPermission().

+ Here is the call graph for this function:

◆ getParentRefId()

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

Definition at line 70 of file Context.php.

70 : ?int
71 {
72 return $this->container->repositoryTree()->getParentId($ref_id);
73 }

References $ref_id.

◆ getUserId()

ILIAS\StaticURL\Context::getUserId ( )

Definition at line 107 of file Context.php.

107 : int
108 {
109 return $this->container->user()->getId();
110 }

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

+ Here is the caller graph for this function:

◆ getUserLanguage()

ILIAS\StaticURL\Context::getUserLanguage ( )

Definition at line 35 of file Context.php.

35 : string
36 {
37 return $this->container->user()->getCurrentLanguage();
38 }

◆ http()

ILIAS\StaticURL\Context::http ( )

Definition at line 55 of file Context.php.

55 : Services
56 {
57 return $this->container->http();
58 }

Referenced by ILIAS\StaticURL\Handler\HandlerService\appendUnknownParameters(), ilFileStaticURLHandler\handle(), and ILIAS\StaticURL\Shortlinks\Handler\handle().

+ Here is the caller graph for this function:

◆ isPublicSectionActive()

ILIAS\StaticURL\Context::isPublicSectionActive ( )

Definition at line 117 of file Context.php.

117 : bool
118 {
119 return (bool) ($this->container->settings()->get('pub_section') ?? false);
120 }

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

+ Here is the caller graph for this function:

◆ isUserLoggedIn()

ILIAS\StaticURL\Context::isUserLoggedIn ( )

Definition at line 112 of file Context.php.

112 : bool
113 {
114 return !$this->container->user()->isAnonymous() && $this->container->user()->getId() !== 0;
115 }

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

+ Here is the caller graph for this function:

◆ lng()

ILIAS\StaticURL\Context::lng ( )

Definition at line 45 of file Context.php.

46 {
47 return $this->container->language();
48 }
language handling

◆ mainTemplate()

ILIAS\StaticURL\Context::mainTemplate ( )

Definition at line 50 of file Context.php.

51 {
52 return $this->container->ui()->mainTemplate();
53 }

◆ refinery()

ILIAS\StaticURL\Context::refinery ( )

Definition at line 40 of file Context.php.

40 : Factory
41 {
42 return $this->container->refinery();
43 }

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: