ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $rbacsystem;
27
28 if (!isset(self::$user_access[$a_user_id])) {
29 include_once("./Services/Mail/classes/class.ilMailGlobalServices.php");
30 self::$user_access[$a_user_id] =
31 $rbacsystem->checkAccessOfUser($a_user_id, 'internal_mail', ilMailGlobalServices::getMailObjectRefId());
32 }
33 return self::$user_access[$a_user_id];
34 }
35
39 public function getComponentId()
40 {
41 return "mail";
42 }
43
47 public function getActionTypes()
48 {
49 return array(
50 "compose" => $this->lng->txt("mail")
51 );
52 }
53
60 public function collectActionsForTargetUser($a_target_user)
61 {
63 include_once("./Services/User/Actions/classes/class.ilUserAction.php");
64 include_once("./Services/Mail/classes/class.ilMailFormCall.php");
65
66 // check mail permission of user
67 if ($this->getUserId() == ANONYMOUS_USER_ID || !$this->checkUserMailAccess($this->getUserId())) {
68 return $coll;
69 }
70
71 // check mail permission of target user
72 if ($this->checkUserMailAccess($a_target_user)) {
73 $f = new ilUserAction();
74 $f->setType("compose");
75 $f->setText($this->lng->txt("mail"));
76 $tn = ilObjUser::_lookupName($a_target_user);
77 $f->setHref(ilMailFormCall::getLinkTarget("", '', array(), array('type' => 'new', 'rcp_to' => $tn["login"])));
78 $coll->addAction($f);
79 }
80
81 return $coll;
82 }
83}
An exception for terminatinating execution or to throw for unit testing.
static getLinkTarget($gui, $cmd, array $gui_params=array(), array $mail_params=array(), $context_params=array())
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.