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
4a9c3837
Commit
4a9c3837
authored
Sep 20, 2016
by
David Gatica
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
function copyCos, added
parent
50f8a198
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
14 deletions
+62
-14
README.md
README.md
+12
-0
index.js
src/index.js
+12
-0
test.js
test/test.js
+38
-14
No files found.
README.md
View file @
4a9c3837
...
@@ -447,6 +447,18 @@ var attributes = {'zimbraDumpsterEnabled' : 'TRUE'};
...
@@ -447,6 +447,18 @@ var attributes = {'zimbraDumpsterEnabled' : 'TRUE'};
client
.
modifyCos
(
"cos_Id"
,
attributes
,
callback
);
client
.
modifyCos
(
"cos_Id"
,
attributes
,
callback
);
```
```
## Rename Cos
```
javascript
var
newName
=
"basicv2"
client
.
renameCos
(
"cos_Id"
,
newName
,
callback
);
```
## Copy Cos
To copy a Cos with other name
```
javascript
var
newCos
=
"Pro2"
;
client
.
copyCos
(
nameCos
|
idCos
,
newCos
,
callback
);
```
## Domains
## Domains
This are functions especifics to
`Domains`
.
This are functions especifics to
`Domains`
.
...
...
src/index.js
View file @
4a9c3837
...
@@ -606,6 +606,13 @@ class ZimbraAdminApi {
...
@@ -606,6 +606,13 @@ class ZimbraAdminApi {
return
this
.
performRequest
(
request_data
);
return
this
.
performRequest
(
request_data
);
}
}
copyCos
(
cos
,
newcos
,
callback
){
const
request_data
=
this
.
buildRequestData
(
'CopyCos'
,
callback
);
request_data
.
parse_response
=
ResponseParser
.
emptyResponse
;
request_data
.
params
.
params
=
{
'name'
:
{
'_content'
:
newcos
},
'cos'
:{
'_content'
:
cos
,
by
:
this
.
dictionary
.
byIdOrName
(
cos
)}};
return
this
.
performRequest
(
request_data
);
}
removeDomainAdmin
(
domain
,
account_id
,
coses
,
callback
)
{
removeDomainAdmin
(
domain
,
account_id
,
coses
,
callback
)
{
this
.
getDomain
(
domain
,
(
err
,
domain
)
=>
{
this
.
getDomain
(
domain
,
(
err
,
domain
)
=>
{
...
@@ -646,6 +653,11 @@ class ZimbraAdminApi {
...
@@ -646,6 +653,11 @@ class ZimbraAdminApi {
return
this
.
rename
(
'DistributionList'
,
resource_data
,
callback
);
return
this
.
rename
(
'DistributionList'
,
resource_data
,
callback
);
}
}
renameCos
(
cos_Id
,
new_name
,
callback
)
{
const
resource_data
=
{
id
:
{
'_content'
:
cos_Id
},
newName
:
{
'_content'
:
new_name
}
}
return
this
.
rename
(
'Cos'
,
resource_data
,
callback
);
}
revokeRight
(
target_data
,
grantee_data
,
right_name
,
callback
)
{
revokeRight
(
target_data
,
grantee_data
,
right_name
,
callback
)
{
const
target_grantee
=
this
.
dictionary
.
buildTargetGrantee
(
target_data
,
grantee_data
);
const
target_grantee
=
this
.
dictionary
.
buildTargetGrantee
(
target_data
,
grantee_data
);
const
target
=
target_grantee
[
0
];
const
target
=
target_grantee
[
0
];
...
...
test/test.js
View file @
4a9c3837
...
@@ -841,20 +841,20 @@ var zimbraAdminPassword = process.env.ZIMBRA_PASSWORD || '12345678';
...
@@ -841,20 +841,20 @@ var zimbraAdminPassword = process.env.ZIMBRA_PASSWORD || '12345678';
});
});
})
})
//
it('Should delete COS "unknow" ', function(done){
it
(
'Should delete COS "unknow" '
,
function
(
done
){
//
let api = new ZimbraAdminApi(auth_data);
let
api
=
new
ZimbraAdminApi
(
auth_data
);
//
api.getCos("unknow", function(err, cos){
api
.
getCos
(
"unknow"
,
function
(
err
,
cos
){
//
if (err) return console.error(err);
if
(
err
)
return
console
.
error
(
err
);
//
let cosId = cos.id;
let
cosId
=
cos
.
id
;
//
console.log(cosId);
console
.
log
(
cosId
);
//
api.deleteCos(cosId, function(err, res){
api
.
deleteCos
(
cosId
,
function
(
err
,
res
){
//
if (err) return console.error(err);
if
(
err
)
return
console
.
error
(
err
);
//
console.log(res);
console
.
log
(
res
);
//
expect(err).to.be.null;
expect
(
err
).
to
.
be
.
null
;
//
done();
done
();
//
})
})
//
});
});
//
})
})
it
(
'Should modify a Cos "basic"'
,
function
(
done
){
it
(
'Should modify a Cos "basic"'
,
function
(
done
){
let
api
=
new
ZimbraAdminApi
(
auth_data
);
let
api
=
new
ZimbraAdminApi
(
auth_data
);
...
@@ -870,6 +870,30 @@ var zimbraAdminPassword = process.env.ZIMBRA_PASSWORD || '12345678';
...
@@ -870,6 +870,30 @@ var zimbraAdminPassword = process.env.ZIMBRA_PASSWORD || '12345678';
});
});
});
});
it
(
'Should rename Cos "Basic"'
,
function
(
done
){
let
api
=
new
ZimbraAdminApi
(
auth_data
);
let
newName
=
"basicv2"
api
.
getCos
(
"basic"
,
function
(
err
,
cos
){
if
(
err
)
return
console
.
error
(
err
);
api
.
renameCos
(
cos
.
id
,
newName
,
function
(
err
,
res
){
if
(
err
)
return
console
.
log
(
err
);
console
.
log
(
res
);
expect
(
err
).
to
.
be
.
null
;
done
();
});
});
});
it
.
only
(
'Should create a copy of Cos Professional, called Pro2 '
,
function
(
done
){
let
api
=
new
ZimbraAdminApi
(
auth_data
);
let
newCos
=
"Pro2"
;
api
.
copyCos
(
"professional"
,
newCos
,
function
(
err
,
res
){
if
(
err
)
return
console
.
error
(
err
);
console
.
log
(
res
);
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