ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

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: 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 59 of file class.NewsAccess.php.

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

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

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 }

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  $i,
  $user_id = 0 
)

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

92 : bool
93 {
94 return $this->canEdit($i, $user_id);
95 }
canEdit(\ilNewsItem $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  $i,
  $user_id = 0 
)

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

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

References $user_id, ilNewsItem\getPriority(), and ilNewsItem\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 74 of file class.NewsAccess.php.

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

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

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

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