Commit dabece5d authored by Patricio Bruna's avatar Patricio Bruna

Added getAccountViewMailPath()

parent 080be678
...@@ -390,6 +390,8 @@ This return an `URL PATH` to access the account Webmail as an administrator. ...@@ -390,6 +390,8 @@ This return an `URL PATH` to access the account Webmail as an administrator.
The first parameter is the `lifetime` of the Token in seconds. The first parameter is the `lifetime` of the Token in seconds.
```javascript ```javascript
client.getAccountViewMailPath(account.name, 3600, callback);
// OR
account.viewMailPath(3600, callback); account.viewMailPath(3600, callback);
// /service/preauth?authtoken=0_8c671f3146....&isredirect=1&adminPreAuth=1 // /service/preauth?authtoken=0_8c671f3146....&isredirect=1&adminPreAuth=1
``` ```
......
...@@ -432,6 +432,14 @@ return /******/ (function(modules) { // webpackBootstrap ...@@ -432,6 +432,14 @@ return /******/ (function(modules) { // webpackBootstrap
value: function getAccount(identifier, callback) { value: function getAccount(identifier, callback) {
return this.get('Account', identifier, callback); return this.get('Account', identifier, callback);
} }
}, {
key: 'getAccountViewMailPath',
value: function getAccountViewMailPath(account, lifetime_seconds, callback) {
this.getAccount(account, function (err, account) {
if (err) return callback(err);
return account.viewMailPath(lifetime_seconds, callback);
});
}
}, { }, {
key: 'getDistributionListOwners', key: 'getDistributionListOwners',
value: function getDistributionListOwners(distributionList, callback) { value: function getDistributionListOwners(distributionList, callback) {
......
...@@ -328,6 +328,13 @@ class ZimbraAdminApi { ...@@ -328,6 +328,13 @@ class ZimbraAdminApi {
return this.get('Account', identifier, callback); return this.get('Account', identifier, callback);
} }
getAccountViewMailPath(account, lifetime_seconds, callback) {
this.getAccount(account, (err, account) => {
if (err) return callback(err);
return account.viewMailPath(lifetime_seconds, callback);
});
}
getDistributionListOwners(distributionList, callback) { getDistributionListOwners(distributionList, callback) {
this.getDistributionList(distributionList, (err, dl) => { this.getDistributionList(distributionList, (err, dl) => {
if (err) return callback(err); if (err) return callback(err);
......
...@@ -14,6 +14,15 @@ ...@@ -14,6 +14,15 @@
this.timeout(10000); this.timeout(10000);
it('Should return the viewMailPath', function(done){
let api = new ZimbraAdminApi(auth_data);
api.getAccountViewMailPath('admin@zboxapp.dev', null, function(err, account){
if (err) return console.error(err);
expect(account).to.match(/adminPreAuth=1$/);
done();
});
});
it('getDistributionListOwners should return the DL owners', function(done) { it('getDistributionListOwners should return the DL owners', function(done) {
let api = new ZimbraAdminApi(auth_data); let api = new ZimbraAdminApi(auth_data);
api.getDistributionListOwners('restringida@customer.dev', function(err, data){ api.getDistributionListOwners('restringida@customer.dev', function(err, data){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment