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
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -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);
            }
	}
    }
}
+10 −8
Original line number Diff line number Diff line
@@ -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);
+1 −1

File changed.

Contains only whitespace changes.