ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilExcRepoObjAssignmentAccessInfo Class Reference

Repository object assignment information. 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...
 
 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 ($a_ref_id, $a_user_id)
 

Protected Member Functions

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

Protected Attributes

 $is_granted
 
 $not_granted_reasons
 
 $lng
 
 $access
 

Detailed Description

Repository object assignment information.

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

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
bool$a_is_granted
string[]$a_not_granted_reasons

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

38 {
39 global $DIC;
40
41 $this->access = $DIC->access();
42 $this->is_granted = $a_is_granted;
43 $this->not_granted_reasons = $a_not_granted_reasons;
44
45 $this->lng = $DIC->language();
46 }
$DIC
Definition: xapitoken.php:46

References $DIC.

Member Function Documentation

◆ getInfo()

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

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

77 {
78 global $DIC;
79
81 $lng = $DIC->language();
82 $access = $DIC->access();
83
84 // if this object is not assigned to any assignment, we do not deny the access
85 $assignment_info = $repo_obj_ass->getAssignmentInfoOfObj($a_ref_id, $a_user_id);
86 if (count($assignment_info) == 0) {
87 return new self(true, []);
88 }
89
90 $granted = true;
91 $reasons = [];
92 foreach ($assignment_info as $i) {
93 if (!$i->isUserSubmission()) {
94 $has_write_permission = false;
95 foreach ($i->getReadableRefIds() as $exc_ref_id) {
96 if ($access->checkAccessOfUser($a_user_id, "write", "", $exc_ref_id)) {
97 $has_write_permission = true;
98 }
99 }
100 if (!$has_write_permission) {
101 $granted = false;
102 $reasons[0] = $lng->txt("exc_obj_not_submitted_by_user");
103 }
104 }
105 }
106
107 return new self($granted, $reasons);
108 }
$i
Definition: metadata.php:24

References $access, $DIC, $i, $lng, and ilExcRepoObjAssignment\getInstance().

Referenced by ilExcRepoObjAssignment\getAccessInfo(), and ilExcRepoObjAssignment\isGranted().

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

References $not_granted_reasons.

◆ isGranted()

ilExcRepoObjAssignmentAccessInfo::isGranted ( )

Is access granted due to exercise assignment conditions?

Returns
int assignment id

Implements ilExcRepoObjAssignmentAccessInfoInterface.

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

References $is_granted.

Field Documentation

◆ $access

ilExcRepoObjAssignmentAccessInfo::$access
protected

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

Referenced by getInfo().

◆ $is_granted

ilExcRepoObjAssignmentAccessInfo::$is_granted
protected

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

Referenced by isGranted().

◆ $lng

ilExcRepoObjAssignmentAccessInfo::$lng
protected

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

Referenced by getInfo().

◆ $not_granted_reasons

ilExcRepoObjAssignmentAccessInfo::$not_granted_reasons
protected

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

Referenced by getNotGrantedReasons().


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