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
01dcd68d
Commit
01dcd68d
authored
Apr 15, 2016
by
Patricio Bruna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getInfo() return info of the current logged user
parent
04f264bc
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
2159 additions
and
1491 deletions
+2159
-1491
README.md
README.md
+2
-2
zimbra-admin-api.js
lib/zimbra-admin-api.js
+2125
-1488
zimbra-admin-api.js.map
lib/zimbra-admin-api.js.map
+1
-1
index.js
src/index.js
+18
-0
test.js
test/js/spec/test.js
+13
-0
No files found.
README.md
View file @
01dcd68d
...
@@ -14,7 +14,7 @@ var zimbraApi = new ZimbraAdminApi({
...
@@ -14,7 +14,7 @@ var zimbraApi = new ZimbraAdminApi({
Here you see how to get basic information using a function like
`getAllDomains`
:
Here you see how to get basic information using a function like
`getAllDomains`
:
```
javascript
```
javascript
zimbraApi
.
getAllDomains
(
function
(
data
,
err
){
zimbraApi
.
getAllDomains
(
function
(
err
,
data
){
if
(
err
)
return
console
.
log
(
err
);
if
(
err
)
return
console
.
log
(
err
);
data
.
forEach
(
function
(
v
){
data
.
forEach
(
function
(
v
){
console
.
log
(
v
.
id
+
' '
+
v
.
name
);
console
.
log
(
v
.
id
+
' '
+
v
.
name
);
...
@@ -25,7 +25,7 @@ zimbraApi.getAllDomains(function(data, err){
...
@@ -25,7 +25,7 @@ zimbraApi.getAllDomains(function(data, err){
Here you see how to get basic information using a function like
`getAllAccounts`
:
Here you see how to get basic information using a function like
`getAllAccounts`
:
```
javascript
```
javascript
zimbraApi
.
getAllAccounts
(
function
(
data
,
err
){
zimbraApi
.
getAllAccounts
(
function
(
err
,
data
){
if
(
err
)
return
console
.
log
(
err
);
if
(
err
)
return
console
.
log
(
err
);
data
.
forEach
(
function
(
v
){
data
.
forEach
(
function
(
v
){
console
.
log
(
v
.
id
+
' '
+
v
.
name
);
console
.
log
(
v
.
id
+
' '
+
v
.
name
);
...
...
lib/zimbra-admin-api.js
View file @
01dcd68d
This diff is collapsed.
Click to expand it.
lib/zimbra-admin-api.js.map
View file @
01dcd68d
This diff is collapsed.
Click to expand it.
src/index.js
View file @
01dcd68d
...
@@ -224,6 +224,24 @@ export default class ZimbraAdminApi {
...
@@ -224,6 +224,24 @@ export default class ZimbraAdminApi {
this
.
getAll
(
'DistributionList'
,
callback
);
this
.
getAll
(
'DistributionList'
,
callback
);
}
}
// Get current logged account information
getInfo
(
callback
)
{
const
req_params
=
{
name
:
'GetInfoRequest'
,
namespace
:
'zimbraAccount'
};
const
that
=
this
;
this
.
client
.
getRequest
({},
function
(
err
,
req
)
{
if
(
err
)
return
callback
(
this
.
handleError
(
err
));
req
.
addRequest
(
req_params
,
function
(
err
){
if
(
err
)
return
callback
(
that
.
handleError
(
err
));
that
.
client
.
send
(
req
,
function
(
err
,
data
){
if
(
err
)
return
callback
(
that
.
handleError
(
err
));
const
result
=
data
.
response
[
0
].
GetInfoResponse
return
callback
(
null
,
result
);
});
});
});
}
}
}
if
(
typeof
module
===
'object'
&&
typeof
module
.
exports
===
'object'
)
{
if
(
typeof
module
===
'object'
&&
typeof
module
.
exports
===
'object'
)
{
...
...
test/js/spec/test.js
View file @
01dcd68d
...
@@ -207,6 +207,19 @@
...
@@ -207,6 +207,19 @@
});
});
});
});
it
(
'getInfo() should return the logged user info'
,
function
(
done
){
let
api
=
new
ZimbraAdminApi
(
auth_data
);
let
callback
=
function
(
err
,
data
)
{
if
(
err
)
return
console
.
log
(
err
);
api
.
getInfo
(
function
(
err
,
data
){
if
(
err
)
return
console
.
log
(
err
);
expect
(
data
.
name
).
to
.
equal
(
'admin@zboxapp.dev'
);
done
();
});
};
api
.
login
(
callback
);
});
});
});
})();
})();
...
...
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