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
50f8a198
Commit
50f8a198
authored
Sep 20, 2016
by
David Gatica
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
function modifyCos, added
parent
fa5f6ee6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
11 deletions
+76
-11
README.md
README.md
+43
-2
index.js
src/index.js
+8
-0
test.js
test/test.js
+25
-9
No files found.
README.md
View file @
50f8a198
...
...
@@ -419,6 +419,35 @@ This are functions especifics to `Cos`.
client
.
getAllCos
(
callback
);
```
## Create / Delete Cos
To create a Cos
```
javascript
//Simple, without attributes
var
attributes
=
{};
client
.
createCos
(
"cos_name"
,
attributes
,
callback
);
// With attributes
var
attributes
=
{
'zimbraFeatureContactsEnabled'
:
'FALSE'
};
client
.
createCos
(
"cos_name"
,
attributes
,
callback
)
```
To delete a Cos
```
javascript
client
.
deleteCos
(
"cos_Id"
,
callback
)
```
## Get Cos
```
javascript
client
.
getCos
(
name
|
id
,
callback
);
```
## Modify Cos
```
javascript
var
attributes
=
{
'zimbraDumpsterEnabled'
:
'TRUE'
};
client
.
modifyCos
(
"cos_Id"
,
attributes
,
callback
);
```
## Domains
This are functions especifics to
`Domains`
.
...
...
@@ -564,6 +593,18 @@ dl.getOwners(callback);
// {name: 'email_address', id: 'ZimbraId', type: 'usr|grp'}
```
### Add / Remove Alias
To set alias at
`DL`
.
```
javascript
client
.
addDistributionListAlias
(
dl
.
id
,
alias
,
callback
);
```
To delete alias of
`DL`
.
```
javascript
api
.
removeDistributionListAlias
(
dl
.
id
,
alias
,
callback
);
```
## Contributing
...
...
src/index.js
View file @
50f8a198
...
...
@@ -572,6 +572,13 @@ class ZimbraAdminApi {
this
.
modify
(
'DistributionList'
,
resource_data
,
callback
);
}
modifyCos
(
id_cos
,
attributes
,
callback
){
const
request_data
=
this
.
buildRequestData
(
'ModifyCos'
,
callback
);
request_data
.
parse_response
=
ResponseParser
.
emptyResponse
;
request_data
.
params
.
params
=
{
'id'
:{
'_content'
:
id_cos
},
'a'
:
this
.
dictionary
.
attributesToArray
(
attributes
)};
return
this
.
performRequest
(
request_data
);
}
// Remove Account
removeAccount
(
zimbra_id
,
callback
)
{
let
resource_data
=
{
id
:
zimbra_id
};
...
...
@@ -599,6 +606,7 @@ class ZimbraAdminApi {
return
this
.
performRequest
(
request_data
);
}
removeDomainAdmin
(
domain
,
account_id
,
coses
,
callback
)
{
this
.
getDomain
(
domain
,
(
err
,
domain
)
=>
{
if
(
err
)
return
callback
(
err
);
...
...
test/test.js
View file @
50f8a198
...
...
@@ -841,20 +841,34 @@ var zimbraAdminPassword = process.env.ZIMBRA_PASSWORD || '12345678';
});
})
it
.
only
(
'Should delete COS "unknow" '
,
function
(
done
){
// it('Should delete COS "unknow" ', function(done){
// let api = new ZimbraAdminApi(auth_data);
// api.getCos("unknow", function(err, cos){
// if (err) return console.error(err);
// let cosId = cos.id;
// console.log(cosId);
// api.deleteCos(cosId, function(err, res){
// if (err) return console.error(err);
// console.log(res);
// expect(err).to.be.null;
// done();
// })
// });
// })
it
(
'Should modify a Cos "basic"'
,
function
(
done
){
let
api
=
new
ZimbraAdminApi
(
auth_data
);
api
.
getCos
(
"unknow"
,
function
(
err
,
cos
){
if
(
err
)
return
console
.
error
(
err
);
let
cosId
=
cos
.
id
;
console
.
log
(
cosId
);
api
.
deleteCos
(
cosId
,
function
(
err
,
res
){
if
(
err
)
return
console
.
error
(
err
);
let
attrs
=
{
'zimbraDumpsterEnabled'
:
'TRUE'
};
api
.
getCos
(
"basic"
,
function
(
err
,
cos
){
if
(
err
)
return
console
.
error
(
err
);
api
.
modifyCos
(
cos
.
id
,
attrs
,
function
(
err
,
res
){
if
(
err
)
return
console
.
error
(
err
);
console
.
log
(
res
);
expect
(
err
).
to
.
be
.
null
;
done
();
})
});
})
});
});
});
...
...
@@ -916,6 +930,7 @@ var zimbraAdminPassword = process.env.ZIMBRA_PASSWORD || '12345678';
let
dl
=
data
;
api
.
addDistributionListAlias
(
dl
.
id
,
alias
,
function
(
err
,
data
){
if
(
err
)
return
console
.
error
(
err
);
console
.
log
(
data
);
expect
(
err
).
to
.
be
.
null
;
done
();
});
...
...
@@ -931,6 +946,7 @@ var zimbraAdminPassword = process.env.ZIMBRA_PASSWORD || '12345678';
if
(
err
)
return
console
.
error
(
err
);
api
.
removeDistributionListAlias
(
dl
.
id
,
alias
,
function
(
err
,
data
){
if
(
err
)
return
console
.
error
(
err
);
console
.
log
(
data
);
expect
(
err
).
to
.
be
.
null
;
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