Skip to content

Commit

Permalink
Merge pull request #262 from ONLYOFFICE/develop
Browse files Browse the repository at this point in the history
Release/2.2.1
  • Loading branch information
LinneyS authored May 27, 2019
2 parents 7a29fe4 + fa182b8 commit 33753bc
Show file tree
Hide file tree
Showing 26 changed files with 385 additions and 98 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Change Log

## 2.2.1
## Added
- download permission
- review permission
- filling forms permission
- comment permission
- modify filter permission

## Changed
- fix getting domain for desktop
- title in the convertation request

## 2.1.7
## Added
- file creation in public folder
Expand Down
104 changes: 90 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# ![](screenshots/icon.png) ownCloud ONLYOFFICE integration app
* [ownCloud-ONLYOFFICE integration app](#-owncloud-onlyoffice-integration-app)
* [Installing ONLYOFFICE Document Server](#installing-onlyoffice-document-server)
* [ONLYOFFICE Document Server editions](#onlyoffice-document-server-editions)
* [Installing ownCloud ONLYOFFICE integration app](#installing-owncloud-onlyoffice-integration-app)
* [Configuring ownCloud-ONLYOFFICE integration app](#configuring-owncloud-onlyoffice-integration-app)
* [How it works](#how-it-works)
* [Known issues](#known-issues)

# ![onlyoffice icon](screenshots/icon.png) ownCloud ONLYOFFICE integration app

This app enables users to edit office documents from [ownCloud](https://owncloud.com) using ONLYOFFICE Document Server.
Currently the following document formats can be edited with this app: csv, docx, pptx, txt, xlsx.
Expand All @@ -11,7 +19,6 @@ This allows multiple users to collaborate in real time and to save back those ch

You can also use our **[Docker installation](https://github.com/ONLYOFFICE/docker-onlyoffice-owncloud)** to get installed and configured Document Server and ownCloud installation with a couple of commands.


## Installing ONLYOFFICE Document Server

You will need an instance of ONLYOFFICE Document Server that is resolvable and connectable both from ownCloud and any end clients (version 4.2.7 and later are supported for use with the app).
Expand All @@ -23,6 +30,73 @@ Or you can use Document Server behind a proxy, please refer to [this article](ht

The easiest way to start an instance of ONLYOFFICE Document Server is to use [Docker](https://github.com/ONLYOFFICE/Docker-DocumentServer).

## ONLYOFFICE Document Server editions

ONLYOFFICE offers different versions of its online document editors that can be deployed on your own servers.

ONLYOFFICE Document Server:

* Community Edition (`onlyoffice-documentserver` package)

* Integration Edition (`onlyoffice-documentserver-ie` package)

The table below will help you to make the right choice.

| Pricing and licensing | Community Edition | Integration Edition |
| ------------- | ------------- | ------------- |
| | [Get it now](https://www.onlyoffice.com/download.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubOwncloud) | [Start Free Trial](https://www.onlyoffice.com/connectors-request.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubOwncloud) |
| Cost | FREE | [Go to the pricing page](https://www.onlyoffice.com/integration-edition-prices.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubOwncloud) |
| Simultaneous connections | up to 20 maximum | As in chosen pricing plan |
| Number of users | up to 20 recommended | As in chosen pricing plan |
| License | GNU AGPL v.3 | Proprietary |
| **Support** | **Community Edition** | **Integration Edition** |
| Documentation | [Help Center](https://helpcenter.onlyoffice.com/server/docker/opensource/index.aspx) | [Help Center](https://helpcenter.onlyoffice.com/server/integration-edition/index.aspx) |
| Standard support | [GitHub](https://github.com/ONLYOFFICE/DocumentServer/issues) or paid | One year support included |
| Premium support | [Buy Now](https://www.onlyoffice.com/support.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubOwncloud) | [Buy Now](https://www.onlyoffice.com/support.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubOwncloud) |
| **Services** | **Community Edition** | **Integration Edition** |
| Conversion Service | + | + |
| Document Builder Service | - | + |
| **Interface** | **Community Edition** | **Integration Edition** |
| Tabbed interface | - | + |
| White Label | - | - |
| Integrated test example (node.js)* | - | + |
| **Plugins & Macros** | **Community Edition** | **Integration Edition** |
| Plugins | + | + |
| Macros | + | + |
| **Collaborative capabilities** | **Community Edition** | **Integration Edition** |
| Two co-editing modes | + | + |
| Comments | + | + |
| Built-in chat | + | + |
| Review and tracking changes | + | + |
| Display modes of tracking changes | - | + |
| Version history | + | + |
| **Document Editor features** | **Community Edition** | **Integration Edition** |
| Font and paragraph formatting | + | + |
| Object insertion | + | + |
| Content control | - | + |
| Layout tools | + | + |
| Table of contents | + | + |
| Navigation panel | - | + |
| Mail Merge | + | + |
| **Spreadsheet Editor features** | **Community Edition** | **Integration Edition** |
| Font and paragraph formatting | + | + |
| Object insertion | + | + |
| Functions, formulas, equations | + | + |
| Table templates | + | + |
| Pivot tables | - | +** |
| **Presentation Editor features** | **Community Edition** | **Integration Edition** |
| Font and paragraph formatting | + | + |
| Object insertion | + | + |
| Animations | + | + |
| Presenter mode | - | + |
| Notes | + | + |
| | [Get it now](https://www.onlyoffice.com/download.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubOwncloud) | [Start Free Trial](https://www.onlyoffice.com/connectors-request.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubOwncloud) |

\* Note that by default DocumentServer Community Edition does not contain any document management system.
Integration Edition and Developer Edition versions include integrated test examples (simplest DMS to test the editors).
For Community version, please use the [ONLYOFFICE Community Server](https://github.com/ONLYOFFICE/CommunityServer/) or [check out integration](https://www.onlyoffice.com/connectors.aspx) with 3rd party platforms, e.g. ownCloud/Nextcloud

\** Changing style and deleting (Full support coming soon)

## Installing ownCloud ONLYOFFICE integration app

Expand All @@ -34,7 +108,8 @@ If the server with the ownCloud installed does not have an Internet access, or i
To start using ONLYOFFICE Document Server with ownCloud, the following steps must be performed:

1. Go to the ownCloud server _apps/_ directory (or some other directory [used](https://doc.owncloud.org/server/administration_manual/installation/apps_management_installation.html#using-custom-app-directories)):
```

```bash
cd apps/
```

Expand All @@ -45,27 +120,28 @@ There are several ways to do that:

b. Or you can download the latest signed version from the application [release page](https://github.com/ONLYOFFICE/onlyoffice-owncloud/releases) on GitHub.

c. Or you can clone the application source code and compile it yourself:
```
c. Or you can clone the application source code and compile it yourself:

```bash
git clone https://github.com/ONLYOFFICE/onlyoffice-owncloud.git onlyoffice
```

> ownCloud does not work with unsigned applications giving an alert, so you will need to use either option **a** or **b** to get the application.

2. Change the owner to update the application right from ownCloud web interface:
```
3. Change the owner to update the application right from ownCloud web interface:

```bash
chown -R www-data:www-data onlyoffice
```

3. In ownCloud open the `~/index.php/settings/apps?category=disabled` page with _Not enabled_ apps by administrator and click _Enable_ for the **ONLYOFFICE** application.

4. In ownCloud open the `~/index.php/settings/apps?category=disabled` page with _Not enabled_ apps by administrator and click _Enable_ for the **ONLYOFFICE** application.

## Configuring ownCloud ONLYOFFICE integration app

In ownCloud open the `~/index.php/settings/admin#onlyoffice` page with administrative settings for **ONLYOFFICE** section.
Enter the following address to connect ONLYOFFICE Document Server:

```
```bash
https://<documentserver>/
```

Expand All @@ -86,10 +162,9 @@ Enable or disable the _Open file in the same tab_ setting.
The **Open in ONLYOFFICE** action will be added to the file context menu.
You can specify this action as default and it will be used when the file name is clicked for the selected file types.


## How it works

The ONLYOFFICE integration follows the API documented here https://api.onlyoffice.com/editors/basic:
The ONLYOFFICE integration follows the API documented [here](https://api.onlyoffice.com/editors/basic):

* When creating a new file, the user navigates to a document folder within ownCloud and clicks the **Document**, **Spreadsheet** or **Presentation** item in the _new_ (+) menu.

Expand Down Expand Up @@ -124,7 +199,6 @@ This method adds the copy of the file from the assets folder to the folder the u

* ownCloud downloads the new version of the document, replacing the old one.


## Known issues

* If the document is shared using the **Federated Cloud Sharing** app, the co-editing among the servers will not be avaialble.
Expand All @@ -142,9 +216,11 @@ However if you set the encryption with the _master key_, ONLYOFFICE application
The instruction on enabling _master key_ based encryption is available in the official documentation on [ownCloud](https://doc.owncloud.org/server/administration_manual/configuration/files/encryption_configuration.html#enabling-encryption-from-the-command-line) websites.

* If you are using a self-signed certificate for your **Document Server**, ownCloud will not validate such a certificate and will not allow connection to/from **Document Server**. This issue can be solved the following way: locate the ownCloud config file (_/owncloud/config/config.php_) and open it. Insert the following section to it:
```

```php
'onlyoffice' => array (
'verify_peer_off' => true
)
```

This will disable the certificate verification and allow ownCloud to establish connection with **Document Server**, but you must remember that this is a temporary insecure solution and we strongly recommend that you replace the certificate with the one issued by some CA. Once you do that, do not forget to remove the above section from ownCloud config file.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<description>ONLYOFFICE connector enables you to edit Office documents within ONLYOFFICE from the familiar web interface. This will create a new Open in ONLYOFFICE action within the document library for Office documents. This allows multiple users to collaborate in real time and to save back those changes to your file storage.</description>
<licence>agpl</licence>
<author>Ascensio System SIA</author>
<version>2.1.7</version>
<version>2.2.1</version>
<namespace>Onlyoffice</namespace>
<types>
<filesystem/>
Expand Down
26 changes: 16 additions & 10 deletions controller/callbackcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,26 +373,30 @@ public function track($doc, $users, $key, $status, $url, $token) {
}

try {
$ownerId = $hashData->ownerId;
$token = isset($hashData->token) ? $hashData->token : NULL;
if (empty($ownerId) && empty($token)) {
$this->logger->error("Track without owner: " . $fileId . " status " . $trackerStatus, array("app" => $this->appName));
return new JSONResponse(["message" => $this->trans->t("File owner is empty")], Http::STATUS_BAD_REQUEST);
}

$userId = $users[0];
$user = $this->userManager->get($userId);
if (!empty($user)) {
\OC_Util::tearDownFS();
\OC_Util::setupFS($userId);

$this->userSession->setUser($user);
} else {
$ownerId = $hashData->ownerId;
$this->logger->debug("Track by anonymous " . $userId, array("app" => $this->appName));
}

\OC_Util::tearDownFS();
if (!empty($ownerId)) {
\OC_Util::setupFS($ownerId);
}
\OC_Util::tearDownFS();
if (!empty($ownerId)) {
\OC_Util::setupFS($ownerId);
}

$token = isset($hashData->token) ? $hashData->token : NULL;
list ($file, $error) = empty($token) ? $this->getFile($userId, $fileId) : $this->getFileByToken($fileId, $token);
list ($file, $error) = !empty($ownerId) ? $this->getFile($ownerId, $fileId) : $this->getFileByToken($fileId, $token);

if (isset($error)) {
$this->logger->error("track error" . $fileId ." " . $error, array("app" => $this->appName));
return $error;
}

Expand Down Expand Up @@ -430,6 +434,8 @@ public function track($doc, $users, $key, $status, $url, $token) {
}

$newData = $documentService->Request($url);

$this->logger->debug("Track put content " . $file->getPath(), array("app" => $this->appName));
$file->putContent($newData);
$error = 0;
} catch (\Exception $e) {
Expand Down
58 changes: 47 additions & 11 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ public function config($fileId, $filePath = NULL, $token = NULL, $desktop = fals
"document" => [
"fileType" => $ext,
"key" => DocumentService::GenerateRevisionId($key),
"permissions" => [],
"title" => $fileName,
"url" => $fileUrl,
],
Expand All @@ -494,14 +495,53 @@ public function config($fileId, $filePath = NULL, $token = NULL, $desktop = fals
]
];

if (\OC::$server->getRequest()->isUserAgent([$this::USER_AGENT_MOBILE])) {
$params["type"] = "mobile";
$restrictedEditing = false;
$fileStorage = $file->getStorage();
if (empty($token) && $fileStorage->instanceOfStorage("\OCA\Files_Sharing\SharedStorage")) {
$share = $fileStorage->getShare();

$permissionsDownload = $share->getAttributes()->getAttribute("permissions", "download");
if ($permissionsDownload !== null) {
$params["document"]["permissions"]["download"] = $params["document"]["permissions"]["print"] = $permissionsDownload === true;
}

if (isset($format["review"]) && $format["review"]) {
$permissionsReviewOnly = $share->getAttributes()->getAttribute($this->appName, "review");
if ($permissionsReviewOnly !== null && $permissionsReviewOnly === true) {
$restrictedEditing = true;
$params["document"]["permissions"]["review"] = true;
}
}

if (isset($format["fillForms"]) && $format["fillForms"]) {
$permissionsFillFormsOnly = $share->getAttributes()->getAttribute($this->appName, "fillForms");
if ($permissionsFillFormsOnly !== null && $permissionsFillFormsOnly === true) {
$restrictedEditing = true;
$params["document"]["permissions"]["fillForms"] = true;
}
}

if (isset($format["comment"]) && $format["comment"]) {
$permissionsCommentOnly = $share->getAttributes()->getAttribute($this->appName, "comment");
if ($permissionsCommentOnly !== null && $permissionsCommentOnly === true) {
$restrictedEditing = true;
$params["document"]["permissions"]["comment"] = true;
}
}

if (isset($format["modifyFilter"]) && $format["modifyFilter"]) {
$permissionsModifyFilter = $share->getAttributes()->getAttribute($this->appName, "modifyFilter");
if ($permissionsModifyFilter !== null) {
$params["document"]["permissions"]["modifyFilter"] = $permissionsModifyFilter === true;
}
}
}

$canEdit = isset($format["edit"]) && $format["edit"];
$editable = $file->isUpdateable()
&& (empty($token) || ($share->getPermissions() & Constants::PERMISSION_UPDATE) === Constants::PERMISSION_UPDATE);
if ($editable && $canEdit) {
$params["document"]["permissions"]["edit"] = $editable;
if (($editable || $restrictedEditing) && $canEdit) {
$ownerId = NULL;
$owner = $file->getOwner();
if (!empty($owner)) {
Expand All @@ -520,6 +560,10 @@ public function config($fileId, $filePath = NULL, $token = NULL, $desktop = fals
$params["editorConfig"]["mode"] = "view";
}

if (\OC::$server->getRequest()->isUserAgent([$this::USER_AGENT_MOBILE])) {
$params["type"] = "mobile";
}

if (!empty($userId)) {
$params["editorConfig"]["user"] = [
"id" => $userId,
Expand Down Expand Up @@ -569,14 +613,6 @@ public function config($fileId, $filePath = NULL, $token = NULL, $desktop = fals

$params = $this->setCustomization($params);

$permissions_modifyFilter = $this->config->getSystemValue($this->config->_permissions_modifyFilter);
if (isset($permissions_modifyFilter)) {
if (!array_key_exists("permissions", $params["document"])) {
$params["document"]["permissions"] = [];
}
$params["document"]["permissions"]["modifyFilter"] = $permissions_modifyFilter;
}

if (!empty($this->config->GetDocumentServerSecret())) {
$token = \Firebase\JWT\JWT::encode($params, $this->config->GetDocumentServerSecret());
$params["token"] = $token;
Expand Down
3 changes: 2 additions & 1 deletion js/desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
OCA.Onlyoffice.Desktop = true;
$("html").addClass("AscDesktopEditor");

var domain = location.href.split(OC.generateUrl(""))[0];
var domain = new RegExp("^http(s)?:\/\/[^\/]+").exec(location)[0];
domain += OC.getRootPath();

var data = {
displayName: oc_user.displayName,
Expand Down
Loading

0 comments on commit 33753bc

Please sign in to comment.