ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Blog\Permission\PermissionManager Class Reference
+ Collaboration diagram for ILIAS\Blog\Permission\PermissionManager:

Public Member Functions

 __construct ( $access_handler, ?int $node_id, int $id_type, int $user_id, int $owner)
 
 canWrite ()
 
 mayContribute ()
 
 mayEditPosting (int $a_posting_id, ?int $a_author_id=null)
 
 canManage ()
 Check if user has admin access (approve, may edit & deactivate all postings) More...
 
 canReadPosting (int $posting_id)
 
 isActive (int $posting_id)
 

Protected Member Functions

 checkPermissionBool (string $perm)
 

Protected Attributes

int $owner
 
int $id_type
 
 $access
 
int $node_id
 
int $user_id
 

Detailed Description

Definition at line 23 of file PermissionManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Blog\Permission\PermissionManager::__construct (   $access_handler,
?int  $node_id,
int  $id_type,
int  $user_id,
int  $owner 
)

Member Function Documentation

◆ canManage()

ILIAS\Blog\Permission\PermissionManager::canManage ( )

Check if user has admin access (approve, may edit & deactivate all postings)

Definition at line 103 of file PermissionManager.php.

103 : bool
104 {
105 return ($this->checkPermissionBool("redact") ||
106 $this->checkPermissionBool("write"));
107 }

◆ canReadPosting()

ILIAS\Blog\Permission\PermissionManager::canReadPosting ( int  $posting_id)

Definition at line 109 of file PermissionManager.php.

109 : bool
110 {
111 return ($this->mayContribute() ||
112 \ilBlogPosting::_lookupActive($posting_id, "blp"));
113 }
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status

References ilPageObject\_lookupActive().

+ Here is the call graph for this function:

◆ canWrite()

ILIAS\Blog\Permission\PermissionManager::canWrite ( )

Definition at line 45 of file PermissionManager.php.

45 : bool
46 {
47 return $this->access->checkAccess('write', '', $this->node_id);
48 }

References ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ checkPermissionBool()

ILIAS\Blog\Permission\PermissionManager::checkPermissionBool ( string  $perm)
protected

Definition at line 88 of file PermissionManager.php.

88 : bool
89 {
90 if (!is_null($this->node_id)) {
91 return $this->access->checkAccess($perm, "", $this->node_id);
92 }
93 if ($this->owner === $this->user_id) {
94 return true;
95 }
96 return false;
97 }

References ILIAS\Repository\access().

Referenced by ILIAS\Blog\Permission\PermissionManager\mayContribute(), and ILIAS\Blog\Permission\PermissionManager\mayEditPosting().

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

◆ isActive()

ILIAS\Blog\Permission\PermissionManager::isActive ( int  $posting_id)

Definition at line 115 of file PermissionManager.php.

115 : bool
116 {
117 return (\ilBlogPosting::_lookupActive($posting_id, "blp"));
118 }

References ilPageObject\_lookupActive().

+ Here is the call graph for this function:

◆ mayContribute()

ILIAS\Blog\Permission\PermissionManager::mayContribute ( )

Definition at line 50 of file PermissionManager.php.

50 : bool
51 {
52 if ($this->id_type === \ilObject2GUI::WORKSPACE_NODE_ID) {
53 return $this->checkPermissionBool("write");
54 }
55
56 return ($this->checkPermissionBool("redact") ||
57 $this->checkPermissionBool("contribute"));
58 }

References ILIAS\Blog\Permission\PermissionManager\checkPermissionBool(), and ilObject2GUI\WORKSPACE_NODE_ID.

+ Here is the call graph for this function:

◆ mayEditPosting()

ILIAS\Blog\Permission\PermissionManager::mayEditPosting ( int  $a_posting_id,
?int  $a_author_id = null 
)

Definition at line 60 of file PermissionManager.php.

63 : bool {
64 // single author blog (owner) in personal workspace
65 if ($this->id_type === \ilObject2GUI::WORKSPACE_NODE_ID) {
66 return $this->checkPermissionBool("write");
67 }
68
69 // repository blogs
70
71 // redact allows to edit all postings
72 if ($this->checkPermissionBool("redact")) {
73 return true;
74 }
75
76 // contribute gives access to own postings
77 if ($this->checkPermissionBool("contribute")) {
78 // check owner of posting
79 if (!$a_author_id) {
80 $post = new \ilBlogPosting($a_posting_id);
81 $a_author_id = $post->getAuthor();
82 }
83 return $this->user_id === $a_author_id;
84 }
85 return false;
86 }
$post
Definition: ltitoken.php:46

References ILIAS\Blog\Permission\PermissionManager\checkPermissionBool().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ILIAS\Blog\Permission\PermissionManager::$access
protected

Definition at line 27 of file PermissionManager.php.

◆ $id_type

int ILIAS\Blog\Permission\PermissionManager::$id_type
protected

◆ $node_id

int ILIAS\Blog\Permission\PermissionManager::$node_id
protected

◆ $owner

int ILIAS\Blog\Permission\PermissionManager::$owner
protected

◆ $user_id

int ILIAS\Blog\Permission\PermissionManager::$user_id
protected

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