- Clone https://github.com/tsukaeru/rushfiles-zimlet.git in project root
- Create folder in project root: .lib
- Go to folder /opt/zimbra/lib/jars in host with deployed Zimbra 9.0.0
- Put in .lib the next jars:
- zimbra-charset.jar
- zimbra-native.jar
- zimbrastore.jar
- zimbrasoap.jar
- zimbracommon.jar
- zimbraclient.jar
- mvn verify
-
Build jar
-
Go to Zimbra console
-
Copy the jar to /opt/zimbra/lib/ext/rushfiles/rushfiles.jar
-
Execute:
su - zimbra -c 'zmmailboxdctl restart' -
Check deploying result (optional):
cat /opt/zimbra/log/mailbox.log | grep -i rushfiles
Tests live in ./tests folder. To make functional Servlet tests work you need to fill in an actual username and password in class ExtensionHttpServletTest.
API testing implemented by mock, Servlet testing - by real requests. We can treat API tests as unit-testing, Servlet tests - as functional-testing. (I do not see the point in long-running testing via requests the same functional twice.)
POST /service/extension/rushfiles/authorize
{
"username": "user@mail.com",
"password": "123456"
}You need to save username, primary_domain and domain_token in cookies. They need to be presented in every further request as cookies.
{
"username": "user@mail.com",
"primary_domain": "cloudfiles.jp",
"domain_token": "11111",
"status": "success"
}On every request backend will check the authorization. If it becomes invalid, you receive the next response:
{
"status": "error",
"message": "unauthorized"
}You can to perform authorization on-the-fly for each specific api call. This method, unlike the standard way, will work for the current call only, and every time will be forced to perform full authentication, but this might be convenient in testing: you do not need make additional authenticational request and manage authentication cookies.
For on-the-fly authorization you need to append in POST two fields: username and password (the same way as in standard authorization). Example:
POST /service/extension/rushfiles/get_share_contents
{
"username": "user@mail.com",
"password": "123456",
"ShareId": "d94f8ed4c56e4f318edb41e5da8b064a"
}POST /service/extension/rushfiles/get_all_shares{
"status": "success",
"objects": [
{
"Id": "17b8cd708c5f41f0a7d30a7230612de2",
"CompanyId": "39929886c09745e3bc98b9e85be7d0fb",
"Name": "Comp Inc"
},
{
"Id": "d94f8ed4c56e4f318edb41e5da8b064a",
"CompanyId": "ca10b965-3b9f-4e5a-96a6-f10b3acea1b8",
"Name": "user - Home folder"
}
]
}POST /service/extension/rushfiles/get_share_contents
{
"ShareId": "d94f8ed4c56e4f318edb41e5da8b064a"
}{
"status": "success",
"objects": [
{
"IsFile": false,
"InternalName": "a42a0704af704efd83e515f97cac7b70",
"PublicName": "cats",
"ShareId": "17b8cd708c5f41f0a7d30a7230612de2"
},
{
"IsFile": true,
"InternalName": "b54e638b67664c688dd0cf28537bf191",
"PublicName": "testfile.txt",
"ShareId": "17b8cd708c5f41f0a7d30a7230612de2"
}
]
}POST /service/extension/rushfiles/get_folder_contents
{
"ShareId": "17b8cd708c5f41f0a7d30a7230612de2",
"InternalName": "a42a0704af704efd83e515f97cac7b70"
}{
"status": "success",
"objects": [
{
"IsFile": true,
"InternalName": "e7a1f0f3373640e3a22504cfcb786540",
"PublicName": "eMail.png",
"ShareId": "17b8cd708c5f41f0a7d30a7230612de2"
},
{
"IsFile": true,
"InternalName": "3a1f3e331a1f47aeb03af1f294e21637",
"PublicName": "DVD-Player.png",
"ShareId": "17b8cd708c5f41f0a7d30a7230612de2"
}
]
}POST /service/extension/rushfiles/create_links_to_files
{
"objects": [
{
"InternalName": "3a1f3e331a1f47aeb03af1f294e21637",
"ShareId": "17b8cd708c5f41f0a7d30a7230612de2"
},
{
"InternalName": "3a1f3e331a1f47aeb03af1f294e21637",
"ShareId": "17b8cd708c5f41f0a7d30a7230612de2",
"DaysToExpire": 10,
"MaxUse": 5,
"Message": "hello world",
"Password": "123456"
}
]
}{
"status": "success",
"objects": [
{
"Link": "http://publiclink.com/123",
"InternalName": "3a1f3e331a1f47aeb03af1f294e21637",
"ShareId": "17b8cd708c5f41f0a7d30a7230612de2",
"DaysToExpire": null,
"MaxUse": null,
"Message": null,
"Password": null
},
{
"Link": "http://publiclink.com/123",
"InternalName": "3a1f3e331a1f47aeb03af1f294e21637",
"ShareId": "17b8cd708c5f41f0a7d30a7230612de2",
"DaysToExpire": 10,
"MaxUse": 5,
"Message": "hello world",
"Password": "123456"
}
]
}