ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\News\Access\NewsAccess Class Reference
+ Collaboration diagram for ILIAS\News\Access\NewsAccess:

Public Member Functions

 __construct (int $ref_id)
 
 canAdd ($user_id=0)
 
 canAccessManageOverview ($user_id=0)
 List of news of the news block. More...
 
 canEditSettings ($user_id=0)
 
 canEditAll ($user_id=0)
 
 canEdit (\ilNewsItem $i, $user_id=0)
 
 canDelete (\ilNewsItem $i, $user_id=0)
 

Protected Member Functions

 getUserId (int $user_id=0)
 

Protected Attributes

int $current_user_id
 
ilAccessHandler $access
 
int $ref_id
 

Detailed Description

Definition at line 23 of file class.NewsAccess.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\News\Access\NewsAccess::__construct ( int  $ref_id)

Definition at line 29 of file class.NewsAccess.php.

References $DIC, ILIAS\News\Access\NewsAccess\$ref_id, and ILIAS\Repository\access().

30  {
31  global $DIC;
32 
33  $this->current_user_id = $DIC->user()->getId();
34  $this->ref_id = $ref_id;
35  $this->access = $DIC->access();
36  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ canAccessManageOverview()

ILIAS\News\Access\NewsAccess::canAccessManageOverview (   $user_id = 0)

List of news of the news block.

Definition at line 59 of file class.NewsAccess.php.

References ILIAS\News\Access\NewsAccess\canAdd().

59  : bool
60  {
61  return $this->canAdd($user_id);
62  }
+ Here is the call graph for this function:

◆ canAdd()

ILIAS\News\Access\NewsAccess::canAdd (   $user_id = 0)

Definition at line 45 of file class.NewsAccess.php.

References ILIAS\Repository\access(), ILIAS\News\Access\NewsAccess\canEditAll(), and ILIAS\News\Access\NewsAccess\getUserId().

Referenced by ILIAS\News\Access\NewsAccess\canAccessManageOverview().

45  : bool
46  {
47  return $this->access->checkAccessOfUser(
48  $this->getUserId($user_id),
49  "news_add_news",
50  "",
51  $this->ref_id
52  )
53  || $this->canEditAll($user_id);
54  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canDelete()

ILIAS\News\Access\NewsAccess::canDelete ( \ilNewsItem  $i,
  $user_id = 0 
)

Definition at line 92 of file class.NewsAccess.php.

References ILIAS\News\Access\NewsAccess\canEdit().

92  : bool
93  {
94  return $this->canEdit($i, $user_id);
95  }
canEdit(\ilNewsItem $i, $user_id=0)
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ canEdit()

ILIAS\News\Access\NewsAccess::canEdit ( \ilNewsItem  $i,
  $user_id = 0 
)

Definition at line 84 of file class.NewsAccess.php.

References ILIAS\News\Access\NewsAccess\canEditAll(), ilNewsItem\getPriority(), ILIAS\News\Access\NewsAccess\getUserId(), and ilNewsItem\getUserId().

Referenced by ILIAS\News\Access\NewsAccess\canDelete().

84  : bool
85  {
86  return (
87  $i->getPriority() === 1 &&
88  ($i->getUserId() === $this->getUserId($user_id) || $this->canEditAll($user_id))
89  );
90  }
$i
Definition: metadata.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canEditAll()

ILIAS\News\Access\NewsAccess::canEditAll (   $user_id = 0)

Definition at line 74 of file class.NewsAccess.php.

References ILIAS\Repository\access(), and ILIAS\News\Access\NewsAccess\getUserId().

Referenced by ILIAS\News\Access\NewsAccess\canAdd(), and ILIAS\News\Access\NewsAccess\canEdit().

74  : bool
75  {
76  return $this->access->checkAccessOfUser(
77  $this->getUserId($user_id),
78  'write',
79  '',
80  $this->ref_id
81  );
82  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canEditSettings()

ILIAS\News\Access\NewsAccess::canEditSettings (   $user_id = 0)

Definition at line 64 of file class.NewsAccess.php.

References ILIAS\Repository\access(), and ILIAS\News\Access\NewsAccess\getUserId().

64  : bool
65  {
66  return $this->access->checkAccessOfUser(
67  $this->getUserId($user_id),
68  'write',
69  '',
70  $this->ref_id
71  );
72  }
+ Here is the call graph for this function:

◆ getUserId()

ILIAS\News\Access\NewsAccess::getUserId ( int  $user_id = 0)
protected

Definition at line 38 of file class.NewsAccess.php.

References ILIAS\News\Access\NewsAccess\$current_user_id.

Referenced by ILIAS\News\Access\NewsAccess\canAdd(), ILIAS\News\Access\NewsAccess\canEdit(), ILIAS\News\Access\NewsAccess\canEditAll(), and ILIAS\News\Access\NewsAccess\canEditSettings().

38  : int
39  {
40  return ($user_id > 0)
41  ? $user_id
43  }
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ILIAS\News\Access\NewsAccess::$access
protected

Definition at line 26 of file class.NewsAccess.php.

◆ $current_user_id

int ILIAS\News\Access\NewsAccess::$current_user_id
protected

Definition at line 25 of file class.NewsAccess.php.

Referenced by ILIAS\News\Access\NewsAccess\getUserId().

◆ $ref_id

int ILIAS\News\Access\NewsAccess::$ref_id
protected

Definition at line 27 of file class.NewsAccess.php.

Referenced by ILIAS\News\Access\NewsAccess\__construct().


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