ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMailUserActionProvider.php
Go to the documentation of this file.
1<?php
2
24{
25 public static array $user_access = [];
26
27 public function checkUserMailAccess(int $a_user_id): bool
28 {
29 global $DIC;
30
31 $rbacsystem = $DIC['rbacsystem'];
32
33 if (!isset(self::$user_access[$a_user_id])) {
34 self::$user_access[$a_user_id] =
35 $rbacsystem->checkAccessOfUser($a_user_id, 'internal_mail', ilMailGlobalServices::getMailObjectRefId());
36 }
37 return (bool) self::$user_access[$a_user_id];
38 }
39
40 public function getComponentId(): string
41 {
42 return "mail";
43 }
44
48 public function getActionTypes(): array
49 {
50 return [
51 "compose" => $this->lng->txt("mail")
52 ];
53 }
54
55 public function collectActionsForTargetUser(int $a_target_user): ilUserActionCollection
56 {
57 $coll = new ilUserActionCollection();
58
59 // check mail permission of user
60 if ($this->getUserId() == ANONYMOUS_USER_ID || !$this->checkUserMailAccess($this->getUserId())) {
61 return $coll;
62 }
63
64 // check mail permission of target user
65 if ($this->checkUserMailAccess($a_target_user)) {
66 $f = new ilUserAction();
67 $f->setType("compose");
68 $f->setText($this->lng->txt("mail"));
69 $tn = ilObjUser::_lookupName($a_target_user);
70 $f->setHref(ilMailFormCall::getLinkTarget("", '', [], ['type' => 'new', 'rcp_to' => $tn["login"]]));
71 $coll->addAction($f);
72 }
73
74 return $coll;
75 }
76}
static getLinkTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
collectActionsForTargetUser(int $a_target_user)
Collect actions for a target user.
static _lookupName(int $a_user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A class that provides a collection of actions on users.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ANONYMOUS_USER_ID
Definition: constants.php:27
global $DIC
Definition: shib_login.php:26