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

Developers • Re: How to lock or unlock the account using the API

$
0
0
I have test following steps:

Code:

<?php
 
// This file is generated by Composer
require_once 'vendor/autoload.php';

$api = \Zimbra\Admin\AdminFactory::instance('https://10.0.10.40:7071/service/admin/soap');
$api->auth('admin', 'adminpasswordhere');
$account = new \Zimbra\Struct\AccountSelector(\Zimbra\Enum\AccountBy::NAME(), 'username');
$id = ((array)$api->getAccountInfo($account)->a[0])["_"];
echo $id."\n";
$passwordInfo = $api->setPassword($id,"mynewpasswordhere");

$accountns = new \Zimbra\Struct\AccountNameSelector(\Zimbra\Enum\AccountBy::NAME(), 'username' ,'username');
$req=new \Zimbra\Admin\Request\LockoutMailbox($accountns,\Zimbra\Enum\LockoutOperation::END());
$req->setOperation(\Zimbra\Enum\LockoutOperation::START())->setAccount($accountns);


Some step i am missing, or maybe it could accomplished using "vendor/zimbra-api/soap-api/src/Zimbra/Admin/Request/ModifyAccount.php" but i do not find any example of how the attrs array in parameter should be used and what attr should be placed for the status of the account.

Statistics: Posted by rojoblandino — Wed Feb 02, 2022 1:29 pm



Viewing all articles
Browse latest Browse all 168

Trending Articles