Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zimbra-admin-api-js
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Public
zimbra-admin-api-js
Commits
9ab231e7
Commit
9ab231e7
authored
Apr 13, 2016
by
Patricio Bruna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete the password and secret after authentication
parent
24f3d7f8
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
6 deletions
+54
-6
zimbra-admin-api.js
lib/zimbra-admin-api.js
+14
-2
zimbra-admin-api.js.map
lib/zimbra-admin-api.js.map
+1
-1
index.js
src/index.js
+12
-2
test.js
test/js/spec/test.js
+27
-1
No files found.
lib/zimbra-admin-api.js
View file @
9ab231e7
...
...
@@ -19193,6 +19193,8 @@ var ZimbraAdminApi =
};
var that = this;
this.client.auth(auth_object, function (err, response) {
that.secret = null;
that.password = null;
if (err) return (callback || that.handleError)(err);
return (callback || that.handleResponse)(null, response);
});
...
...
@@ -19298,8 +19300,18 @@ var ZimbraAdminApi =
}
}, {
key: 'getAccount',
value: function getAccount(account, callback) {
this.get('Account', account, callback);
value: function getAccount(identifier, callback) {
this.get('Account', identifier, callback);
}
}, {
key: 'getDomain',
value: function getDomain(identifier, callback) {
this.get('Domain', identifier, callback);
}
}, {
key: 'getDistributionList',
value: function getDistributionList(identifier, callback) {
this.get('DistributionList', identifier, callback);
}
}, {
key: 'getAllDomains',
lib/zimbra-admin-api.js.map
View file @
9ab231e7
This diff is collapsed.
Click to expand it.
src/index.js
View file @
9ab231e7
...
...
@@ -71,6 +71,8 @@ class ZimbraAdminApi {
};
let
that
=
this
;
this
.
client
.
auth
(
auth_object
,
function
(
err
,
response
){
that
.
secret
=
null
;
that
.
password
=
null
;
if
(
err
)
return
(
callback
||
that
.
handleError
)(
err
);
return
(
callback
||
that
.
handleResponse
)(
null
,
response
);
});
...
...
@@ -162,8 +164,16 @@ class ZimbraAdminApi {
}
}
getAccount
(
account
,
callback
)
{
this
.
get
(
'Account'
,
account
,
callback
);
getAccount
(
identifier
,
callback
)
{
this
.
get
(
'Account'
,
identifier
,
callback
);
}
getDomain
(
identifier
,
callback
)
{
this
.
get
(
'Domain'
,
identifier
,
callback
);
}
getDistributionList
(
identifier
,
callback
)
{
this
.
get
(
'DistributionList'
,
identifier
,
callback
);
}
getAllDomains
(
callback
)
{
...
...
test/js/spec/test.js
View file @
9ab231e7
...
...
@@ -47,7 +47,7 @@
expect
(
error
.
title
).
to
.
equal
(
'Internal Server Error'
);
expect
(
error
.
extra
.
code
).
to
.
equal
(
'account.AUTH_FAILED'
);
done
();
}
}
;
api
.
login
(
callback
);
});
...
...
@@ -56,6 +56,16 @@
let
callback
=
function
(
err
,
response
)
{
expect
(
api
.
client
.
token
).
to
.
exist
;
done
();
};
api
.
login
(
callback
);
});
it
(
'should delete the password after authentication'
,
function
(
done
)
{
let
api
=
new
ZimbraAdminApi
(
auth_data
);
let
callback
=
function
(
err
,
response
)
{
expect
(
api
.
secret
).
not
.
to
.
exist
;
expect
(
api
.
password
).
not
.
to
.
exist
;
done
();
}
api
.
login
(
callback
);
});
...
...
@@ -106,6 +116,22 @@
});
});
it
(
'should return an error if domain not found'
,
function
(
done
){
let
api
=
new
ZimbraAdminApi
(
auth_data
);
api
.
getDomain
(
'nuncajams.com'
,
function
(
err
,
data
){
expect
(
err
.
extra
.
code
).
to
.
equal
(
'account.NO_SUCH_DOMAIN'
);
done
();
});
});
it
(
'should return the DL'
,
function
(
done
){
let
api
=
new
ZimbraAdminApi
(
auth_data
);
api
.
getDistributionList
(
'abierta@customer.dev'
,
function
(
err
,
data
){
expect
(
data
.
name
).
to
.
equal
(
'abierta@customer.dev'
);
done
();
});
});
// it('should get and return with name or id', function(done){
// let api = new ZimbraAdminApi(auth_data);
// let account_id = null;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment