37 protected function __construct($a_is_granted, array $a_not_granted_reasons)
41 $this->access = $DIC->access();
42 $this->is_granted = $a_is_granted;
43 $this->not_granted_reasons = $a_not_granted_reasons;
45 $this->lng = $DIC->language();
76 public static function getInfo($a_ref_id, $a_user_id)
81 $lng = $DIC->language();
85 $assignment_info = $repo_obj_ass->getAssignmentInfoOfObj($a_ref_id, $a_user_id);
86 if (count($assignment_info) == 0) {
87 return new self(
true, []);
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;
100 if (!$has_write_permission) {
102 $reasons[0] =
$lng->txt(
"exc_obj_not_submitted_by_user");
107 return new self($granted, $reasons);
static getInfo($a_ref_id, $a_user_id)
getNotGrantedReasons()
Get reasons why access is not granted.
static getInstance()
Get instance.
__construct($a_is_granted, array $a_not_granted_reasons)
Constructor.
isGranted()
Is access granted due to exercise assignment conditions?
Interface for assignment types.
Repository object assignment information.