ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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...
 

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 102 of file PermissionManager.php.

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

102  : bool
103  {
104  return ($this->checkPermissionBool("redact") ||
105  $this->checkPermissionBool("write"));
106  }
+ Here is the call graph for this function:

◆ canWrite()

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

Definition at line 45 of file PermissionManager.php.

References ILIAS\Repository\access().

45  : bool
46  {
47  return $this->access->checkAccess('write', '', $this->node_id);
48  }
+ 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.

References ILIAS\Repository\access().

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

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  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mayContribute()

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

Definition at line 50 of file PermissionManager.php.

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

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  }
+ 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.

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

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
+ 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: