ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\Blog\Permission\BlogCmdPermission Class Reference
+ Inheritance diagram for ILIAS\Blog\Permission\BlogCmdPermission:
+ Collaboration diagram for ILIAS\Blog\Permission\BlogCmdPermission:

Public Member Functions

 __construct (protected \ilLanguage $lng, protected PermissionManager $perm_manager, ?\ilGlobalTemplateInterface $tpl=null, protected ?\ilCtrlInterface $ctrl=null, protected ?StandardGUIRequest $request=null, protected ?BlogExercise $blog_exercise=null)
 
 postingsBelongToBlog (array $posting_ids)
 
 assignmentBelongsToBlog (int $assignment_id)
 
 isCommandPermitted (string $cmd, int $node_id, string $entity, string $entity_id="")
 
 getDefaultCommand ()
 
 getRequestEntity ()
 
 getRequestNodeId ()
 
 isForwardPermitted (string $from_class, string $to_class)
 
- Public Member Functions inherited from ILIAS\Repository\Permission\CmdPermission
 __construct (protected \ilLanguage $lng, protected ?\ilGlobalTemplateInterface $tpl=null, protected ?\ilCtrlInterface $ctrl=null,)
 
 isRequestCommandPermitted ()
 
 isRequestMultiCommand ()
 
 isTableCommandPermitted (string $cmd, string $entity_id)
 
 isCommandPermittedMulti (string $cmd, int $node_id, string $entity, array $entity_ids)
 
 getPermittedCommand ()
 
 getRequestCommand ()
 
 getDefaultCommand ()
 
 checkCommand (string $cmd, int $node_id, string $entity, string $entity_id="")
 
 forwardPermitted (object $from_gui, object $to_gui)
 
 classImplementsMethodDirectly (string $className, string $method)
 For intermediate solutions that don't implement the concept for all subclasses yet. More...
 
 isRequestCommandPermitted ()
 
 getPermittedCommand ()
 
 getRequestCommand ()
 
 getRequestEntity ()
 
 getRequestNodeId ()
 
 isCommandPermitted (string $cmd, int $node_id, string $entity, string $entity_id="")
 
 isCommandPermittedMulti (string $cmd, int $node_id, string $entity, array $entity_ids)
 
 isRequestMultiCommand ()
 
 checkCommand (string $cmd, int $node_id, string $entity, string $entity_id="")
 
 isForwardPermitted (string $from_class, string $to_class)
 
 forwardPermitted (object $from_gui, object $to_gui)
 

Protected Member Functions

 hasBlogCmdPerm (string $cmd, int $node_id)
 
 hasPostingCmdPerm (string $cmd, int $node_id, int $posting_id)
 
 hasBlogAssignmentCmdPerm (string $cmd, int $node_id, int $assignment_id)
 
- Protected Member Functions inherited from ILIAS\Repository\Permission\CmdPermission
 isClass (string $class)
 
 cmdEntity (string $type, string|array $id="")
 

Protected Attributes

const BLOG = "blog"
 
const POSTING = "posting"
 
const BLOG_ASSIGNMENT = "blog_assignment"
 
ilAccessHandler ilWorkspaceAccessHandler $access
 

Detailed Description

Definition at line 34 of file BlogCmdPermission.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Blog\Permission\BlogCmdPermission::__construct ( protected \ilLanguage  $lng,
protected PermissionManager  $perm_manager,
?\ilGlobalTemplateInterface  $tpl = null,
protected ?\ilCtrlInterface  $ctrl = null,
protected ?StandardGUIRequest  $request = null,
protected ?BlogExercise  $blog_exercise = null 
)

Definition at line 41 of file BlogCmdPermission.php.

48 {
50 $this->access = $perm_manager->getAccessHandler();
51 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
readonly ilGlobalTemplateInterface $tpl
global $lng
Definition: privfeed.php:26

References $lng, ILIAS\News\Common\Table\$tpl, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\access(), and ILIAS\Blog\Permission\PermissionManager\getAccessHandler().

+ Here is the call graph for this function:

Member Function Documentation

◆ assignmentBelongsToBlog()

ILIAS\Blog\Permission\BlogCmdPermission::assignmentBelongsToBlog ( int  $assignment_id)

Definition at line 63 of file BlogCmdPermission.php.

63 : bool
64 {
65 if ($this->blog_exercise === null) {
66 return false;
67 }
68
69 foreach ($this->blog_exercise->getAssignmentsOfBlog() as $assignment) {
70 if ($assignment["ass_id"] === $assignment_id) {
71 return true;
72 }
73 }
74 return false;
75 }

◆ getDefaultCommand()

ILIAS\Blog\Permission\BlogCmdPermission::getDefaultCommand ( )

Reimplemented from ILIAS\Repository\Permission\CmdPermission.

Definition at line 166 of file BlogCmdPermission.php.

166 : string
167 {
168 if ($this->isClass(\ilObjBlogGUI::class)) {
169 return "render";
170 }
171 return "";
172 }

◆ getRequestEntity()

ILIAS\Blog\Permission\BlogCmdPermission::getRequestEntity ( )

Implements ILIAS\Repository\Permission\CmdPermissionInterface.

Definition at line 174 of file BlogCmdPermission.php.

174 : ?CmdEntity
175 {
176 if ($this->isClass(\ilObjBlogGUI::class) || $this->isClass(EditingGUI::class)) {
177
178 if (in_array($this->ctrl->getCmd(), ["approve", "deactivateAdmin"])) {
179 $posting_id = $this->request->getApId();
180 return $this->cmdEntity(
181 self::POSTING,
182 (string) $posting_id
183 );
184 }
185 if (in_array($this->ctrl->getCmd(), ["printViewSelection", "printPostings"])) {
186 $posting_ids = $this->request->getObjIds();
187 if ($posting_ids !== []) {
188 return $this->cmdEntity(self::POSTING, $posting_ids);
189 }
190 }
191 return $this->cmdEntity(
192 self::BLOG
193 );
194 }
195 if ($this->isClass(\ilBlogExerciseGUI::class)) {
196 return $this->cmdEntity(
197 self::BLOG_ASSIGNMENT,
198 (string) $this->request->getAssId()
199 );
200 }
201 return null;
202 }
cmdEntity(string $type, string|array $id="")

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getRequestNodeId()

ILIAS\Blog\Permission\BlogCmdPermission::getRequestNodeId ( )

Implements ILIAS\Repository\Permission\CmdPermissionInterface.

Definition at line 204 of file BlogCmdPermission.php.

204 : int
205 {
206 if ($this->access instanceof \ilWorkspaceAccessHandler) {
207 return $this->request->getWspId();
208 }
209 return $this->request->getRefId();
210 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ hasBlogAssignmentCmdPerm()

ILIAS\Blog\Permission\BlogCmdPermission::hasBlogAssignmentCmdPerm ( string  $cmd,
int  $node_id,
int  $assignment_id 
)
protected

Definition at line 156 of file BlogCmdPermission.php.

156 : bool
157 {
158 if (in_array($cmd, ["downloadExcAssFile", "downloadExcSubFile", "finalize"])) {
159 return $this->access->checkAccess("read", "", $node_id) &&
160 $this->assignmentBelongsToBlog($assignment_id);
161 }
162
163 return false;
164 }

References ILIAS\Repository\access().

Referenced by ILIAS\Blog\Permission\BlogCmdPermission\isCommandPermitted().

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

◆ hasBlogCmdPerm()

ILIAS\Blog\Permission\BlogCmdPermission::hasBlogCmdPerm ( string  $cmd,
int  $node_id 
)
protected

Definition at line 94 of file BlogCmdPermission.php.

94 : bool
95 {
96 // write permission
97 if (in_array($cmd, [
98 "edit",
99 "createExportFileWithComments",
100 "createExportFile",
101 "export",
102 "contributors",
103 "addUserFromAutoComplete",
104 "addContributor",
105 "confirmRemoveContributor",
106 "removeContributor",
107 "setContentStyleSheet",
108 "exportWithComments"
109 ])) {
110 return $this->access->checkAccess("write", "", $node_id);
111 }
112
113 if (in_array($cmd, [
114 "createPosting",
115 ])) {
116 return $this->perm_manager->mayContribute();
117 }
118
119 // read permission
120 if (in_array($cmd, [
121 "render", "preview", "addToDesk", "removeFromDesk", "renderFullscreen",
122 "setNotification", "printViewSelection", "printPostings"
123 ])) {
124 return $this->access->checkAccess("read", "", $node_id);
125 }
126
127 // visible permission
128 if (in_array($cmd, [
129 "infoScreen"
130 ])) {
131 return $this->access->checkAccess("visible", "", $node_id);
132 }
133
134
135 return false;
136 }

References ILIAS\Repository\access().

Referenced by ILIAS\Blog\Permission\BlogCmdPermission\isCommandPermitted().

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

◆ hasPostingCmdPerm()

ILIAS\Blog\Permission\BlogCmdPermission::hasPostingCmdPerm ( string  $cmd,
int  $node_id,
int  $posting_id 
)
protected

Definition at line 138 of file BlogCmdPermission.php.

138 : bool
139 {
140 if (in_array($cmd, ["printViewSelection", "printPostings"])) {
141 return $this->access->checkAccess("read", "", $node_id) &&
142 $this->perm_manager->postingIdMatches($posting_id);
143 }
144
145 // redact or write permission
146 if (in_array($cmd, [
147 "approve",
148 "deactivateAdmin"
149 ])) {
150 return $this->perm_manager->canApprove($posting_id);
151 }
152
153 return false;
154 }

References ILIAS\Repository\access().

Referenced by ILIAS\Blog\Permission\BlogCmdPermission\isCommandPermitted().

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

◆ isCommandPermitted()

ILIAS\Blog\Permission\BlogCmdPermission::isCommandPermitted ( string  $cmd,
int  $node_id,
string  $entity,
string  $entity_id = "" 
)

Implements ILIAS\Repository\Permission\CmdPermissionInterface.

Definition at line 77 of file BlogCmdPermission.php.

82 : bool {
83 switch ($entity) {
84 case self::BLOG:
85 return $this->hasBlogCmdPerm($cmd, $node_id);
86 case self::POSTING:
87 return $this->hasPostingCmdPerm($cmd, $node_id, (int) $entity_id);
89 return $this->hasBlogAssignmentCmdPerm($cmd, $node_id, (int) $entity_id);
90 }
91 return false;
92 }
hasPostingCmdPerm(string $cmd, int $node_id, int $posting_id)
hasBlogAssignmentCmdPerm(string $cmd, int $node_id, int $assignment_id)
hasBlogCmdPerm(string $cmd, int $node_id)

References ILIAS\Blog\Permission\BlogCmdPermission\BLOG, ILIAS\Blog\Permission\BlogCmdPermission\BLOG_ASSIGNMENT, ILIAS\Blog\Permission\BlogCmdPermission\hasBlogAssignmentCmdPerm(), ILIAS\Blog\Permission\BlogCmdPermission\hasBlogCmdPerm(), ILIAS\Blog\Permission\BlogCmdPermission\hasPostingCmdPerm(), and ILIAS\Blog\Permission\BlogCmdPermission\POSTING.

+ Here is the call graph for this function:

◆ isForwardPermitted()

ILIAS\Blog\Permission\BlogCmdPermission::isForwardPermitted ( string  $from_class,
string  $to_class 
)

Implements ILIAS\Repository\Permission\CmdPermissionInterface.

Definition at line 212 of file BlogCmdPermission.php.

215 : bool {
216 $node_id = $this->getRequestNodeId();
217 $posting_id = $this->request->getBlogPage();
218 if ($from_class === \ilObjBlogGUI::class) {
219
220 // visible or read
221 if ($to_class === \ilCommonActionDispatcherGUI::class) {
222 return $this->access->checkAccess("visible", "", $node_id) ||
223 $this->access->checkAccess("read", "", $node_id);
224 }
225
226 // edit permission
227 if ($to_class === \ilPermissionGUI::class) {
228 return $this->access->checkAccess("edit_permission", "", $node_id);
229 }
230
231 if ($to_class === EditingGUI::class && in_array($this->ctrl->getCmd(), [
232 "approve",
233 "deactivateAdmin",
234 "printViewSelection",
235 "printPostings"
236 ])) {
237 return $this->isRequestCommandPermitted();
238 }
239
240 // read posting permission
241 if ($to_class === \ilBlogPostingGUI::class) {
242 return $this->perm_manager->canReadPosting($posting_id);
243 }
244
245 // write permission
246 if (in_array($to_class, [
247 \ilExportGUI::class,
248 \ilRepositorySearchGUI::class,
249 \ilObjectContentStyleSettingsGUI::class,
250 \ilObjNotificationSettingsGUI::class,
251 \ilObjectMetaDataGUI::class,
252 SettingsGUI::class,
253 \ILIAS\Blog\Settings\BlockSettingsGUI::class,
254 \ILIAS\Blog\Editing\EditingGUI::class,
255 \ILIAS\Blog\Export\ExportGUI::class,
256 ContributorGUI::class,
257 ])) {
258 return $this->access->checkAccess("write", "", $node_id);
259 }
260
261 // read permission
262 // note on ilObjectCopyGUI: This class performs the copy permission checks and
263 // can act on multiple source ids
264 if (in_array($to_class, [
265 \ilObjectCopyGUI::class,
266 \ILIAS\Blog\Presentation\PresentationGUI::class
267 ])) {
268 return $this->access->checkAccess("read", "", $node_id);
269 }
270
271 if ($to_class === \ilBlogExerciseGUI::class) {
272 $assignment_id = $this->request?->getAssId() ?? 0;
273 return $assignment_id === 0
274 ? $this->access->checkAccess("read", "", $node_id)
275 : $this->isRequestCommandPermitted();
276 }
277
278 // visible
279 if ($to_class === \ilInfoScreenGUI::class) {
280 return $this->access->checkAccess("visible", "", $node_id);
281 }
282 }
283 return false;
284 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References ILIAS\Repository\access(), and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ postingsBelongToBlog()

ILIAS\Blog\Permission\BlogCmdPermission::postingsBelongToBlog ( array  $posting_ids)

Definition at line 53 of file BlogCmdPermission.php.

53 : bool
54 {
55 foreach ($posting_ids as $posting_id) {
56 if (!$this->perm_manager->postingIdMatches($posting_id)) {
57 return false;
58 }
59 }
60 return true;
61 }

Field Documentation

◆ $access

ilAccessHandler ilWorkspaceAccessHandler ILIAS\Blog\Permission\BlogCmdPermission::$access
protected

Definition at line 39 of file BlogCmdPermission.php.

◆ BLOG

const ILIAS\Blog\Permission\BlogCmdPermission::BLOG = "blog"
protected

◆ BLOG_ASSIGNMENT

const ILIAS\Blog\Permission\BlogCmdPermission::BLOG_ASSIGNMENT = "blog_assignment"
protected

◆ POSTING

const ILIAS\Blog\Permission\BlogCmdPermission::POSTING = "posting"
protected

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