Skip to content
Snippets Groups Projects
Commit bfa72a6d authored by David Surville's avatar David Surville
Browse files

Modification de la méthode de récupération des membres d'une liste de...

Modification de la méthode de récupération des membres d'une liste de distribution : utilisation de GetDistributionList au lieu de GetDistributionListMembers
parent 056045a4
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,36 @@
namespace UnicaenZimbra\Entity;
use SimpleXMLElement;
class DistributionList extends Entity
{
public function populate( SimpleXMLElement $object )
{
$this->data = array();
$this->data['id'] = (string) $object['id'];
$this->data['name'] = (string) $object['name'];
$this->id = (string) $object['id'];
$this->name = (string) $object['name'];
foreach ($object->children()->a as $data) {
$key = (string) $data['n'];
if (isset($this->data[$key])) { // store multiple attributes in an array
$this->data[$key] = (array) $this->data[$key];
$this->data[$key][] = self::convertFromXml($data);
} else {
$this->data[$key] = self::convertFromXml($data);
}
}
foreach($object->children()->dlm as $member) {
if (isset($this->data['members'])) { // store multiple attributes in an array
$this->data['members'] = (array) $this->data['members'];
$this->data['members'][] = self::convertFromXml($member);
} else {
$this->data['members'] = (array) self::convertFromXml($member);
}
}
}
}
......@@ -252,7 +252,8 @@ class BoiteGenerique extends Processus
$identityService = $this->getServiceManager()->get('zimbraServiceIdentity');
// Travail sur la boite générique
$bgAccount = $distribListService->getMembers($adresseFonctionnelle, 1)[0];
$dlAccount = $distribListService->get($adresseFonctionnelle);
$bgAccount = $dlAccount->members[0];
$userAccount = $accountService->get( $userMail );
$folderService->setAccount($bgAccount);
......@@ -289,7 +290,7 @@ class BoiteGenerique extends Processus
// ACE
$ace = new Right;
$ace->setTarget($distribListService->get($adresseFonctionnelle))
$ace->setTarget($dlAccount)
->setGrantee($userAccount)
->setRightByRightName('sendAsDistList');
$rightService->grantRight($ace);
......@@ -330,7 +331,8 @@ class BoiteGenerique extends Processus
$identityService = $this->getServiceManager()->get('zimbraServiceIdentity');
// Travail sur la boite générique
$bgAccount = $distribListService->getMembers($adresseFonctionnelle, 1)[0];
$dlAccount = $distribListService->get($adresseFonctionnelle);
$bgAccount = $dlAccount->members[0];
$userAccount = $accountService->get( $userMail );
$folderService->setAccount($bgAccount);
......@@ -350,7 +352,7 @@ class BoiteGenerique extends Processus
// ACE
$ace = new Right;
$ace->setTarget($distribListService->get($adresseFonctionnelle))
$ace->setTarget($dlAccount)
->setGrantee($userAccount)
->setRightByRightName('sendAsDistList');
$rightService->revokeRight($ace);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment