ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilMailUserActionProvider.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("./Services/User/Actions/classes/class.ilUserActionProvider.php");
6
15{
16 public static $user_access = array();
17
24 public function checkUserMailAccess($a_user_id)
25 {
26 global $DIC;
27
28 $rbacsystem = $DIC['rbacsystem'];
29
30 if (!isset(self::$user_access[$a_user_id])) {
31 include_once("./Services/Mail/classes/class.ilMailGlobalServices.php");
32 self::$user_access[$a_user_id] =
33 $rbacsystem->checkAccessOfUser($a_user_id, 'internal_mail', ilMailGlobalServices::getMailObjectRefId());
34 }
35 return self::$user_access[$a_user_id];
36 }
37
41 public function getComponentId()
42 {
43 return "mail";
44 }
45
49 public function getActionTypes()
50 {
51 return array(
52 "compose" => $this->lng->txt("mail")
53 );
54 }
55
62 public function collectActionsForTargetUser($a_target_user)
63 {
65 include_once("./Services/User/Actions/classes/class.ilUserAction.php");
66 include_once("./Services/Mail/classes/class.ilMailFormCall.php");
67
68 // check mail permission of user
69 if ($this->getUserId() == ANONYMOUS_USER_ID || !$this->checkUserMailAccess($this->getUserId())) {
70 return $coll;
71 }
72
73 // check mail permission of target user
74 if ($this->checkUserMailAccess($a_target_user)) {
75 $f = new ilUserAction();
76 $f->setType("compose");
77 $f->setText($this->lng->txt("mail"));
78 $tn = ilObjUser::_lookupName($a_target_user);
79 $f->setHref(ilMailFormCall::getLinkTarget("", '', array(), array('type' => 'new', 'rcp_to' => $tn["login"])));
80 $coll->addAction($f);
81 }
82
83 return $coll;
84 }
85}
An exception for terminatinating execution or to throw for unit testing.
static getLinkTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], $context_params=[])
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable.
getComponentId()
string component id as defined in services.xml/module.xml
getActionTypes()
array[string] keys must be unique action ids (strings), values should be the names of the actions (fr...
checkUserMailAccess($a_user_id)
Check user chat access.
collectActionsForTargetUser($a_target_user)
Collect user actions.
static _lookupName($a_user_id)
lookup user name
A class that provides a collection of actions on users.
Action that can be performed on a user.
const ANONYMOUS_USER_ID
Definition: constants.php:25
global $DIC
Definition: goto.php:24