19 declare(strict_types=1);
41 $db = $DIC->database();
90 $parser = $this->parserFactory->getParser($a_address_list);
91 $parsedList = $parser->parse();
94 foreach ($parsedList as $address) {
95 $local_part = $address->getMailbox();
96 if (strpos($local_part,
'#') !== 0 && !($local_part[0] ===
'"' && $local_part[1] ===
"#")) {
102 $local_part = substr($local_part, 1);
105 if ($local_part[0] ===
'#' && $local_part[strlen($local_part) - 1] ===
'"') {
106 $local_part = substr($local_part, 1);
107 $local_part = substr($local_part, 0, -1);
110 if (strpos($local_part,
'il_role_') === 0) {
111 $role_id = substr($local_part, 8);
112 $query =
"SELECT t.tree " .
114 "JOIN tree t ON t.child = fa.parent " .
115 "WHERE fa.rol_id = " . $this->db->quote($role_id,
'integer') .
" " .
116 "AND fa.assign = 'y' " .
119 if ($this->db->numRows(
$res) > 0) {
120 $role_ids[] = (
int) $role_id;
125 $domain = $address->getHost();
126 if (strpos($domain,
'[') === 0 && strrpos($domain,
']')) {
127 $domain = substr($domain, 1, -1);
129 if ($local_part ===
'') {
130 $local_part = $domain;
137 $query =
"SELECT dat.obj_id " .
138 "FROM object_data dat " .
139 "JOIN rbac_fa fa ON fa.rol_id = dat.obj_id " .
140 "JOIN tree t ON t.child = fa.parent " .
141 "WHERE dat.title =" . $this->db->quote($local_part,
'text') .
" " .
142 "AND dat.type = 'role' " .
143 "AND fa.assign = 'y' " .
147 $query =
"SELECT rdat.obj_id " .
148 "FROM object_data odat " .
149 "JOIN object_reference oref ON oref.obj_id = odat.obj_id " .
150 "JOIN tree otree ON otree.child = oref.ref_id " .
151 "JOIN rbac_fa rfa ON rfa.parent = otree.child " .
152 "JOIN object_data rdat ON rdat.obj_id = rfa.rol_id " .
153 "WHERE odat.title = " . $this->db->quote($domain,
'text') .
" " .
154 "AND otree.tree = 1 " .
155 "AND rfa.assign = 'y' " .
156 "AND rdat.title LIKE " .
158 '%' . preg_replace(
'/([_%])/',
'\\\\$1', $local_part) .
'%',
165 while ($row = $this->db->fetchAssoc(
$res)) {
166 $role_ids[] = (
int) $row[
'obj_id'];
174 $q =
"SELECT dat.obj_id " .
175 "FROM object_data dat " .
176 "JOIN object_reference ref ON ref.obj_id = dat.obj_id " .
177 "JOIN tree t ON t.child = ref.ref_id " .
178 "WHERE dat.title = " . $this->db->quote($domain,
'text') .
" " .
179 "AND dat.type = 'role' " .
181 $res = $this->db->query($q);
183 while ($row = $this->db->fetchAssoc(
$res)) {
184 $role_ids[] = (
int) $row[
'obj_id'];
ilMailRfc822AddressParserFactory $parserFactory
Class ilRoleMailboxSearch.
Class ilMailRfc822AddressParserFactory.
searchRoleIdsByAddressString(string $a_address_list)
Finds all role ids that match the specified user friendly role mailbox address list.
__construct(ilMailRfc822AddressParserFactory $parserFactory, ilDBInterface $db=null)