ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMailLoginOrEmailAddressAddressType Class Reference

Class ilMailLoginOrEmailAddressAddressType. More...

+ Inheritance diagram for ilMailLoginOrEmailAddressAddressType:
+ Collaboration diagram for ilMailLoginOrEmailAddressAddressType:

Public Member Functions

 resolve ()
 {Returns an array of resolved user ids.
Returns
int[]
} More...
 
- Public Member Functions inherited from ilBaseMailAddressType
 __construct (\ilMailAddress $a_address)
 ilBaseMailAddressType constructor. More...
 
 validate ($a_sender_id)
 {
Parameters
$a_sender_idinteger
Returns
bool
} More...
 
 getErrors ()
 
 resolve ()
 Returns an array of resolved user ids. More...
 
 validate ($a_sender_id)
 

Protected Member Functions

 isValid ($a_sender_id)
 {
Parameters
$a_sender_idinteger
Returns
boolean
} More...
 
- Protected Member Functions inherited from ilBaseMailAddressType
 init ()
 
 isValid ($a_sender_id)
 

Private Member Functions

 receivesInternalMailsOnly ($usrId)
 

Additional Inherited Members

- Protected Attributes inherited from ilBaseMailAddressType
 $address
 
 $rbacsystem
 
 $rbacreview
 
 $errors = array()
 

Detailed Description

Member Function Documentation

◆ isValid()

ilMailLoginOrEmailAddressAddressType::isValid (   $a_sender_id)
protected

{

Parameters
$a_sender_idinteger
Returns
boolean
}

Reimplemented from ilBaseMailAddressType.

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

16 {
17 if ($this->address->getHost() == ilMail::ILIAS_HOST) {
18 $usr_id = ilObjUser::getUserIdByLogin($this->address->getMailbox());
19 } else {
20 $usr_id = false;
21 }
22
23 if (!$usr_id && $this->address->getHost() == ilMail::ILIAS_HOST) {
24 $this->errors[] = array('mail_recipient_not_found', $this->address->getMailbox());
25 return false;
26 }
27
28 require_once 'Services/Mail/classes/class.ilMailGlobalServices.php';
29 if ($usr_id && !$this->rbacsystem->checkAccessOfUser($usr_id, 'internal_mail', ilMailGlobalServices::getMailObjectRefId())) {
30 if ($this->receivesInternalMailsOnly($usr_id)) {
32 "Address '%s' not valid. Found id %s, but user can't use mail system.",
33 $this->address->getMailbox(),
34 $usr_id
35 ));
36 $this->errors[] = array('user_cant_receive_mail', $this->address->getMailbox());
37 return false;
38 }
39 }
40
41 return true;
42 }
sprintf('%.4f', $callTime)
static getLogger($a_component_id)
Get component logger.
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable.
const ILIAS_HOST
static getUserIdByLogin($a_login)

References ilLoggerFactory\getLogger(), ilMailGlobalServices\getMailObjectRefId(), ilObjUser\getUserIdByLogin(), ilMail\ILIAS_HOST, receivesInternalMailsOnly(), and sprintf.

+ Here is the call graph for this function:

◆ receivesInternalMailsOnly()

ilMailLoginOrEmailAddressAddressType::receivesInternalMailsOnly (   $usrId)
private
Parameters
integer$usrId
Returns
bool

Definition at line 48 of file class.ilMailLoginOrEmailAddressAddressType.php.

49 {
50 $options = new \ilMailOptions($usrId);
51
52 return (int) $options->getIncomingType() === (int) \ilMailOptions::INCOMING_LOCAL;
53 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20

References $options, and ilMailOptions\INCOMING_LOCAL.

Referenced by isValid().

+ Here is the caller graph for this function:

◆ resolve()

ilMailLoginOrEmailAddressAddressType::resolve ( )

{Returns an array of resolved user ids.

Returns
int[]
}

Implements ilMailAddressType.

Definition at line 58 of file class.ilMailLoginOrEmailAddressAddressType.php.

59 {
60 if ($this->address->getHost() == ilMail::ILIAS_HOST) {
61 $address = $this->address->getMailbox();
62 } else {
63 $address = $this->address->getMailbox() . '@' . $this->address->getHost();
64 }
65
66 $usr_ids = array_filter(array(ilObjUser::getUserIdByLogin($address)));
67
68 if (count($usr_ids) > 0) {
70 "Found the following user ids for address (login) '%s': %s",
72 implode(', ', array_unique($usr_ids))
73 ));
74 } elseif (strlen($address) > 0) {
76 "Did not find any user account for address (login) '%s'",
78 ));
79 }
80
81 return $usr_ids;
82 }

References ilBaseMailAddressType\$address, ilLoggerFactory\getLogger(), ilObjUser\getUserIdByLogin(), ilMail\ILIAS_HOST, and sprintf.

+ Here is the call graph for this function:

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