Quantcast
Channel: Zimbra Forums
Viewing all articles
Browse latest Browse all 1226

Developers • Re: zimbra-api php delegateAuth!!!

$
0
0
Trying to build a web app to create an appoint as any user.whatsapp web 192.168.0.1 routerlogin


The following works great in a single user scenario if i have the users password. However I would like to auth as admin and then create the appointment as if the user I pick created it. I was reading about delegateAuth but can't find any examples on how to successfully implement. Can someone help or post an example

Code:

use Zimbra\Enum\AccountBy;use Zimbra\Enum\AddressType;use Zimbra\Enum\AlarmAction;use Zimbra\Enum\FreeBusyStatus;use Zimbra\Enum\InviteStatus;use Zimbra\Enum\InviteClass;use Zimbra\Enum\ParticipationStatus;use Zimbra\Enum\Transparency;use Zimbra\Mail\MailFactory;use Zimbra\Mail\Struct\AlarmInfo;use Zimbra\Mail\Struct\AlarmTriggerInfo;use Zimbra\Mail\Struct\CalendarAttendee;use Zimbra\Mail\Struct\CalOrganizer;use Zimbra\Mail\Struct\DtTimeInfo;use Zimbra\Mail\Struct\DurationInfo;use Zimbra\Mail\Struct\EmailAddrInfo;use Zimbra\Mail\Struct\InvitationInfo;use Zimbra\Mail\Struct\InviteComponent;use Zimbra\Mail\Struct\MimePartInfo;use Zimbra\Mail\Struct\Msg;use Zimbra\Struct\AccountSelector;$api = MailFactory::instance('https://zimbraserver/service/soap');try {    $account = new AccountSelector(AccountBy::NAME(), 'test@mailserver.com');    $api->auth($account, 'xxxx');    $trigger = new AlarmTriggerInfo();    $trigger->setRelative(new DurationInfo(true, null, null, null, 5, null, 'START'));    $alarm = new AlarmInfo(AlarmAction::DISPLAY(), $trigger);    $comp = new InviteComponent();    $comp->setName('Meet celebrities for free')        ->setLocation('My home')        ->setFreeBusy(FreeBusyStatus::FREE())        ->setStatus(InviteStatus::COMPLETED())        ->setCalClass(InviteClass::PUB())        ->setTransparency(Transparency::OPAQUE())        ->setIsAllDay(false)        ->setIsDraft(false)        ->addAttendee(new CalendarAttendee('test@mailserver.com', null, 'User1'))        ->setDtStart(new DtTimeInfo('20180130T160000', 'America/New_York'))        ->setDtEnd(new DtTimeInfo('20180130T170000', 'America/New_York'))        ->addAlarm($alarm);    $inv = new InvitationInfo();    $inv->setInviteComponent($comp);    $mp = new MimePartInfo(null, 'multipart/alternative');    $mp->addMimePart(new MimePartInfo(null, 'text/plain', 'Meet celebrities for free'));    $msg = new Msg();    $msg->setSubject('Meet celebrities for free')        ->setFolderId('10')        ->addEmail(new EmailAddrInfo('test@mailserver.com', AddressType::TO(), 'User1'))        ->setInvite($inv)        ->setMimePart($mp);    $result = $api->createAppointment($msg);    var_dump($result);}catch(Exception $ex) {    $client = $api->getClient();    echo $client->lastResponse();
Navigating delegateAuth for admin-level access when setting appointments appears difficult. Seeking examples or direction is a sensible decision. Community support or government documents may provide insights into successfully implementing this.Fm Whatsapp Download

Statistics: Posted by Darsh — Fri Jan 26, 2024 7:35 am



Viewing all articles
Browse latest Browse all 1226

Trending Articles