ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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|NewsItem $i, $user_id=0)
 
 canDelete (\ilNewsItem|NewsItem $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 25 of file class.NewsAccess.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

32 {
33 global $DIC;
34
35 $this->current_user_id = $DIC->user()->getId();
36 $this->ref_id = $ref_id;
37 $this->access = $DIC->access();
38 }
global $DIC
Definition: shib_login.php:26

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

+ 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 61 of file class.NewsAccess.php.

61 : bool
62 {
63 return $this->canAdd($user_id);
64 }

References $user_id, and ILIAS\News\Access\NewsAccess\canAdd().

+ Here is the call graph for this function:

◆ canAdd()

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

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

47 : bool
48 {
49 return $this->access->checkAccessOfUser(
50 $this->getUserId($user_id),
51 "news_add_news",
52 "",
53 $this->ref_id
54 )
55 || $this->canEditAll($user_id);
56 }

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

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

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

◆ canDelete()

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

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

94 : bool
95 {
96 return $this->canEdit($i, $user_id);
97 }
canEdit(\ilNewsItem|NewsItem $i, $user_id=0)

References $user_id, and ILIAS\News\Access\NewsAccess\canEdit().

+ Here is the call graph for this function:

◆ canEdit()

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

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

86 : bool
87 {
88 return (
89 $i->getPriority() === 1 &&
90 ($i->getUserId() === $this->getUserId($user_id) || $this->canEditAll($user_id))
91 );
92 }

References $user_id, ILIAS\News\Data\NewsItem\getPriority(), and ILIAS\News\Data\NewsItem\getUserId().

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

+ 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 76 of file class.NewsAccess.php.

76 : bool
77 {
78 return $this->access->checkAccessOfUser(
79 $this->getUserId($user_id),
80 'write',
81 '',
82 $this->ref_id
83 );
84 }

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

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

+ 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 66 of file class.NewsAccess.php.

66 : bool
67 {
68 return $this->access->checkAccessOfUser(
69 $this->getUserId($user_id),
70 'write',
71 '',
72 $this->ref_id
73 );
74 }

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

+ Here is the call graph for this function:

◆ getUserId()

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

Field Documentation

◆ $access

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

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

◆ $current_user_id

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

Definition at line 27 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 29 of file class.NewsAccess.php.

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


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