ILIAS  release_8 Revision v8.23
ilExcRepoObjAssignmentAccessInfo Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilExcRepoObjAssignmentAccessInfo:
+ Collaboration diagram for ilExcRepoObjAssignmentAccessInfo:

Public Member Functions

 isGranted ()
 Is access granted due to exercise assignment conditions? More...
 
 getNotGrantedReasons ()
 Get reasons why access is not granted. More...
 

Static Public Member Functions

static getInfo (int $a_ref_id, int $a_user_id)
 

Protected Member Functions

 __construct (bool $a_is_granted, array $a_not_granted_reasons)
 Constructor. More...
 

Protected Attributes

bool $is_granted
 
array $not_granted_reasons
 
ilLanguage $lng
 
ilAccessHandler $access
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Repository object assignment information

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ilExcRepoObjAssignmentAccessInfo.php.

Constructor & Destructor Documentation

◆ __construct()

ilExcRepoObjAssignmentAccessInfo::__construct ( bool  $a_is_granted,
array  $a_not_granted_reasons 
)
protected

Constructor.

Parameters
string[]$a_not_granted_reasons

Definition at line 40 of file class.ilExcRepoObjAssignmentAccessInfo.php.

References $DIC, ILIAS\Repository\access(), and ILIAS\Repository\lng().

41  {
42  global $DIC;
43 
44  $this->access = $DIC->access();
45  $this->is_granted = $a_is_granted;
46  $this->not_granted_reasons = $a_not_granted_reasons;
47 
48  $this->lng = $DIC->language();
49  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ getInfo()

static ilExcRepoObjAssignmentAccessInfo::getInfo ( int  $a_ref_id,
int  $a_user_id 
)
static
Parameters
int$a_ref_idref id
int$a_user_iduser id

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

References $DIC, $i, ilRBACAccessHandler\checkAccessOfUser(), ilExcRepoObjAssignment\getInstance(), and ilLanguage\txt().

Referenced by ilExcRepoObjAssignment\getAccessInfo().

74  : self
75  {
76  global $DIC;
77 
78  $repo_obj_ass = ilExcRepoObjAssignment::getInstance();
79  $lng = $DIC->language();
80  $access = $DIC->access();
81 
82  // if this object is not assigned to any assignment, we do not deny the access
83  $assignment_info = $repo_obj_ass->getAssignmentInfoOfObj($a_ref_id, $a_user_id);
84  if (count($assignment_info) == 0) {
85  return new self(true, []);
86  }
87 
88  $granted = true;
89  $reasons = [];
90  foreach ($assignment_info as $i) {
91  if (!$i->isUserSubmission()) {
92  $has_write_permission = false;
93  foreach ($i->getReadableRefIds() as $exc_ref_id) {
94  if ($access->checkAccessOfUser($a_user_id, "write", "", $exc_ref_id)) {
95  $has_write_permission = true;
96  }
97  }
98  if (!$has_write_permission) {
99  $granted = false;
100  $reasons[0] = $lng->txt("exc_obj_not_submitted_by_user");
101  }
102  }
103  }
104 
105  return new self($granted, $reasons);
106  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
global $DIC
Definition: feed.php:28
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
$i
Definition: metadata.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNotGrantedReasons()

ilExcRepoObjAssignmentAccessInfo::getNotGrantedReasons ( )

Get reasons why access is not granted.

Returns
string[]

Implements ilExcRepoObjAssignmentAccessInfoInterface.

Definition at line 65 of file class.ilExcRepoObjAssignmentAccessInfo.php.

References $not_granted_reasons.

◆ isGranted()

ilExcRepoObjAssignmentAccessInfo::isGranted ( )

Is access granted due to exercise assignment conditions?

Implements ilExcRepoObjAssignmentAccessInfoInterface.

Definition at line 55 of file class.ilExcRepoObjAssignmentAccessInfo.php.

References $is_granted.

Field Documentation

◆ $access

ilAccessHandler ilExcRepoObjAssignmentAccessInfo::$access
protected

Definition at line 34 of file class.ilExcRepoObjAssignmentAccessInfo.php.

◆ $is_granted

bool ilExcRepoObjAssignmentAccessInfo::$is_granted
protected

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

Referenced by isGranted().

◆ $lng

ilLanguage ilExcRepoObjAssignmentAccessInfo::$lng
protected

Definition at line 33 of file class.ilExcRepoObjAssignmentAccessInfo.php.

◆ $not_granted_reasons

array ilExcRepoObjAssignmentAccessInfo::$not_granted_reasons
protected

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

Referenced by getNotGrantedReasons().


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