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
364fb85d
Commit
364fb85d
authored
May 25, 2016
by
Patricio Bruna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added checkMxRecord() to Domain
parent
59c18d29
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
62 additions
and
5 deletions
+62
-5
README.md
README.md
+8
-0
zimbra-admin-api.js
lib/zimbra-admin-api.js
+28
-2
zimbra-admin-api.js.map
lib/zimbra-admin-api.js.map
+1
-1
package.json
package.json
+1
-1
index.js
src/index.js
+10
-0
response_parser.js
src/utils/response_parser.js
+10
-0
domain.js
src/zimbra/domain.js
+4
-0
test.js
test/js/spec/test.js
+0
-1
No files found.
README.md
View file @
364fb85d
...
@@ -419,6 +419,14 @@ domain.countAccounts(callback);
...
@@ -419,6 +419,14 @@ domain.countAccounts(callback);
If the
`Domain`
is empty, no 'Accounts', the result will be a
`{}`
.
If the
`Domain`
is empty, no 'Accounts', the result will be a
`{}`
.
### CheckDomainMXRecord
```
javascript
domain
.
checkMxRecord
(
callback
);
// Object {entry: "5 mailcleaner.zboxapp.com.", code: "Failed",
// message: "Domain is configured to use SMTP host: zimbra.zboxapp.dev. None of the MX records match this name."}
```
### Add / Remove Admin
### Add / Remove Admin
To add or remove a
`Domain Admin`
you
**must**
use the
`account.id`
.
To add or remove a
`Domain Admin`
you
**must**
use the
`account.id`
.
...
...
lib/zimbra-admin-api.js
View file @
364fb85d
...
@@ -247,6 +247,17 @@ return /******/ (function(modules) { // webpackBootstrap
...
@@ -247,6 +247,17 @@ return /******/ (function(modules) { // webpackBootstrap
})();
})();
}
}
}
}
}, {
key: 'checkDomainMxRecord',
value: function checkDomainMxRecord(domain, callback) {
var request_data = this.buildRequestData('CheckDomainMXRecord', callback);
request_data.parse_response = _response_parser2.default.checkDomainMxRecordResponse;
request_data.params.params.domain = {
'by': this.dictionary.byIdOrName(domain),
'_content': domain
};
return this.performRequest(request_data);
}
}, {
}, {
key: 'create',
key: 'create',
value: function create(resource, resource_data, callback) {
value: function create(resource, resource_data, callback) {
...
@@ -13495,6 +13506,11 @@ return /******/ (function(modules) { // webpackBootstrap
...
@@ -13495,6 +13506,11 @@ return /******/ (function(modules) { // webpackBootstrap
return callback(null, d.dl);
return callback(null, d.dl);
}, query_object);
}, query_object);
}
}
}, {
key: 'checkMxRecord',
value: function checkMxRecord(callback) {
return this.api.checkDomainMxRecord(this.id, callback);
}
}, {
}, {
key: 'countAccounts',
key: 'countAccounts',
value: function countAccounts(callback) {
value: function countAccounts(callback) {
...
@@ -14333,6 +14349,17 @@ return /******/ (function(modules) { // webpackBootstrap
...
@@ -14333,6 +14349,17 @@ return /******/ (function(modules) { // webpackBootstrap
}
}
return callback(null, response_object);
return callback(null, response_object);
}
}
}, {
key: 'checkDomainMxRecordResponse',
value: function checkDomainMxRecordResponse(data, request_data, callback) {
var response = data.get().CheckDomainMXRecordResponse;
var result = {
entry: response.entry[0] ? response.entry[0]._content : null,
code: response.code[0] ? response.code[0]._content : null,
message: response.message[0] ? response.message[0]._content : null
};
return callback(null, result);
}
}, {
}, {
key: 'countAccountResponse',
key: 'countAccountResponse',
value: function countAccountResponse(data, request_data, callback) {
value: function countAccountResponse(data, request_data, callback) {
...
@@ -15003,7 +15030,6 @@ return /******/ (function(modules) { // webpackBootstrap
...
@@ -15003,7 +15030,6 @@ return /******/ (function(modules) { // webpackBootstrap
.send(JSON.stringify(requestPojo))
.send(JSON.stringify(requestPojo))
.end(function(err, data){
.end(function(err, data){
if (err) {
if (err) {
console.log(err);
var error_result = JSON.parse(data.text);
var error_result = JSON.parse(data.text);
return callback(error_result.Body);
return callback(error_result.Body);
}
}
...
@@ -43045,7 +43071,7 @@ return /******/ (function(modules) { // webpackBootstrap
...
@@ -43045,7 +43071,7 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = {
module.exports = {
"name": "zimbra-admin-api-js",
"name": "zimbra-admin-api-js",
"version": "0.1.
4
",
"version": "0.1.
5
",
"private": true,
"private": true,
"main": "lib/zimbra-admin-api.js",
"main": "lib/zimbra-admin-api.js",
"dependencies": {
"dependencies": {
lib/zimbra-admin-api.js.map
View file @
364fb85d
This diff is collapsed.
Click to expand it.
package.json
View file @
364fb85d
{
{
"name"
:
"zimbra-admin-api-js"
,
"name"
:
"zimbra-admin-api-js"
,
"version"
:
"0.1.
4
"
,
"version"
:
"0.1.
5
"
,
"private"
:
true
,
"private"
:
true
,
"main"
:
"lib/zimbra-admin-api.js"
,
"main"
:
"lib/zimbra-admin-api.js"
,
"dependencies"
:
{
"dependencies"
:
{
...
...
src/index.js
View file @
364fb85d
...
@@ -144,6 +144,16 @@ export default class ZimbraAdminApi {
...
@@ -144,6 +144,16 @@ export default class ZimbraAdminApi {
}
}
}
}
checkDomainMxRecord
(
domain
,
callback
)
{
const
request_data
=
this
.
buildRequestData
(
'CheckDomainMXRecord'
,
callback
);
request_data
.
parse_response
=
ResponseParser
.
checkDomainMxRecordResponse
;
request_data
.
params
.
params
.
domain
=
{
'by'
:
this
.
dictionary
.
byIdOrName
(
domain
),
'_content'
:
domain
};
return
this
.
performRequest
(
request_data
);
}
create
(
resource
,
resource_data
,
callback
){
create
(
resource
,
resource_data
,
callback
){
const
request_data
=
this
.
buildRequestData
(
`Create
${
resource
}
`
,
callback
);
const
request_data
=
this
.
buildRequestData
(
`Create
${
resource
}
`
,
callback
);
request_data
.
resource
=
resource
;
request_data
.
resource
=
resource
;
...
...
src/utils/response_parser.js
View file @
364fb85d
...
@@ -34,6 +34,16 @@ export default class ResponseParser {
...
@@ -34,6 +34,16 @@ export default class ResponseParser {
return
callback
(
null
,
response_object
);
return
callback
(
null
,
response_object
);
}
}
static
checkDomainMxRecordResponse
(
data
,
request_data
,
callback
)
{
const
response
=
data
.
get
().
CheckDomainMXRecordResponse
;
const
result
=
{
entry
:
response
.
entry
[
0
]
?
response
.
entry
[
0
].
_content
:
null
,
code
:
response
.
code
[
0
]
?
response
.
code
[
0
].
_content
:
null
,
message
:
response
.
message
[
0
]
?
response
.
message
[
0
].
_content
:
null
,
};
return
callback
(
null
,
result
);
}
static
countAccountResponse
(
data
,
request_data
,
callback
)
{
static
countAccountResponse
(
data
,
request_data
,
callback
)
{
const
coses
=
data
.
get
().
CountAccountResponse
.
cos
;
const
coses
=
data
.
get
().
CountAccountResponse
.
cos
;
const
result
=
ResponseParser
.
dictionary
().
cosesToCountAccountObject
(
coses
);
const
result
=
ResponseParser
.
dictionary
().
cosesToCountAccountObject
(
coses
);
...
...
src/zimbra/domain.js
View file @
364fb85d
...
@@ -51,6 +51,10 @@ export default class Domain extends Zimbra {
...
@@ -51,6 +51,10 @@ export default class Domain extends Zimbra {
},
query_object
);
},
query_object
);
}
}
checkMxRecord
(
callback
)
{
return
this
.
api
.
checkDomainMxRecord
(
this
.
id
,
callback
);
}
countAccounts
(
callback
)
{
countAccounts
(
callback
)
{
const
maxAccountsByCos
=
this
.
maxAccountsByCos
();
const
maxAccountsByCos
=
this
.
maxAccountsByCos
();
this
.
api
.
countAccounts
(
this
.
id
,
function
(
e
,
d
){
this
.
api
.
countAccounts
(
this
.
id
,
function
(
e
,
d
){
...
...
test/js/spec/test.js
View file @
364fb85d
...
@@ -752,7 +752,6 @@
...
@@ -752,7 +752,6 @@
let
api
=
new
ZimbraAdminApi
(
auth_data
);
let
api
=
new
ZimbraAdminApi
(
auth_data
);
api
.
client
.
options
.
timeout
=
100
;
api
.
client
.
options
.
timeout
=
100
;
api
.
getAllAccounts
(
function
(
err
,
data
){
api
.
getAllAccounts
(
function
(
err
,
data
){
console
.
log
(
err
);
expect
(
err
).
to
.
exist
;
expect
(
err
).
to
.
exist
;
done
();
done
();
});
});
...
...
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