Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename to collaboration app #37

Merged
merged 6 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app_name=invitation
app_name=collaboration
# VERSION=please_set_version
version=$(version)
app_dir_name=$(notdir $(CURDIR))
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Invitation app for Federated Sharing
# Collaboration app for Federated Sharing

---
### Enhanced federated sharing between Owncloud instances.
Expand Down Expand Up @@ -27,35 +27,35 @@ Depends on the following Owncloud apps: _Federated File Sharing_, _Notifications
### Building and installation
Clone the project. The app runs in Owncloud so have a local Owncloud instance running. To deploy the app in your local Owncloud instance build it by first running `composer` from the project root folder as you would for any php project. This will create the `vendor` dependencies folder.<br>
Next build the project by executing the command: `make version={version_number} buildapp`<br>
This will create the `invitation_version_number.tar.gz` file in the `build/artifacts/app` folder. After extracting you must place the resulting `invitation` folder in the `apps` folder of your local Owncloud instance. This should make Owncloud aware of the app.<br>
This will create the `collaboration_version_number.tar.gz` file in the `build/artifacts/app` folder. After extracting you must place the resulting `collaboration` folder in the `apps` folder of your local Owncloud instance. This should make Owncloud aware of the app.<br>
Now you can activate it and start experimenting. For a full experience you should setup 2 instances between which you can send invitations and create federated shares.

#### Using (official) releases
Use one of the [official releases](https://github.com/sara-nl/oc-invitation/releases) or build your own compressed archive as explained [here](release/README.md).<br>
Deploy the app by copying the extracted `invitation` folder of the official release or your own custom build to the Owncloud `apps` folder.<br>
Deploy the app by copying the extracted `collaboration` folder of the official release or your own custom build to the Owncloud `apps` folder.<br>
Finally the admin should activate the app. It should than be present as a menu entrance for all users.

#### Activation
To activate enhanced federated sharing (search and display invited remote users in the share dialog) the following configuration must be added to the `config.php` file of the Owncloud instance:
```
'sharing.remoteShareesSearch' => '\\OCA\\Invitation\\Service\\RemoteUserService'
'sharing.remoteShareesSearch' => '\\OCA\\Collaboration\\Service\\RemoteUserService'
```

---
### Configuration
To be able to send invitations between Owncloud instances the app must be installed on each one of them.<br>
Also you must configure the other (remote) instances you want to be able to send invitations to. This is done on the admin settings section of the app (Settings page -> Admin Sharing page -> Invitation Service section).<br>
<br>
![Invitation app settings page](img/invitation-app-settings-page.png "Invitation app settings page")<br>
Fig.2 Invitation app settings page.<br>
![Invitation Service settings page](img/invitation-app-settings-page.png "Invitation Service settings page")<br>
Fig.2 Invitation Service settings page.<br>

##### checkbox - Allow federated sharing with invited users only
* Enabling this option prevents owncloud from showing the label of an uninvited remote user when typing in a cloud ID in the share dialog. Only invited remote users' labels will be displayed to you (as shown in [figure 1](../#enhanced-federated-sharing-between-owncloud-instances)).<br>
*&nbsp;Note that this option does not actually disable federated sharing functionality with uninvited remote users but just does not show the label of an uninvited remote user.

##### section - This Invitation Service Provider
* Here you should specify the endpoint and name of this instance's Invitation Service Provider.<br>
The endpoint structure is as follows: `https://[host]/[path]/apps/invitation`
The endpoint structure is as follows: `https://[host]/[path]/apps/collaboration`

##### section - Remote Invitation Service Providers
* Here you should specify all Invitation Service Providers you want to enable exchanging cloud IDs via invitations with.<br>
Expand All @@ -79,12 +79,12 @@ Check the outcome of the tests and fix any issue.<br>
* [Building a release .tar.gz file](release/README.md)

#### Development options
* Display the generated invite link:<br>
* To display the generated invite link upon the creation of an invite:<br>
Add the key/value set to the db `appconfig` table to display the invite link after an invitation has been created:

| appid | configkey | configvalue |
|------------|-------------|------------------|
| invitation | deploy_mode | deploy_mode_test |
| appid | configkey | configvalue |
|---------------|-------------|------------------|
| collaboration | deploy_mode | deploy_mode_test |

<br>

Expand Down
10 changes: 5 additions & 5 deletions appinfo/Migrations/Version20231130102037.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace OCA\invitation\Migrations;
namespace OCA\Collaboration\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException;
Expand All @@ -21,13 +21,13 @@ public function changeSchema(Schema $schema, array $options)
$prefix = $options['tablePrefix'];

try {
$schema->getTable("{$prefix}invitation_invitations");
$schema->getTable("{$prefix}collaboration_invitations");
} catch (Exception $e) {
if ($e->getCode() == SchemaException::TABLE_DOESNT_EXIST) {
//----------------------
// The invitations table
//----------------------
$table = $schema->createTable("{$prefix}invitation_invitations");
$table = $schema->createTable("{$prefix}collaboration_invitations");
$table->addColumn('id', Types::BIGINT, [
'autoincrement' => true,
'unsigned' => true,
Expand Down Expand Up @@ -100,13 +100,13 @@ public function changeSchema(Schema $schema, array $options)
}
}
try {
$schema->getTable("{$prefix}invitation_invitation_service_providers");
$schema->getTable("{$prefix}collaboration_invitation_service_providers");
} catch (Exception $e) {
if ($e->getCode() == SchemaException::TABLE_DOESNT_EXIST) {
//---------------------------------------
// the invitation_service_providers table
//---------------------------------------
$table = $schema->createTable("{$prefix}invitation_invitation_service_providers");
$table = $schema->createTable("{$prefix}collaboration_invitation_service_providers");
$table->addColumn('id', Types::BIGINT, [
'autoincrement' => true,
'unsigned' => true,
Expand Down
8 changes: 4 additions & 4 deletions appinfo/Migrations/Version20231130125300.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace OCA\invitation\Migrations;
namespace OCA\Collaboration\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException;
Expand All @@ -21,13 +21,13 @@ public function changeSchema(Schema $schema, array $options)
$prefix = $options['tablePrefix'];

//----------------------
// The invitations constants table
// The collaboration constants table
//----------------------
try {
$schema->getTable("{$prefix}invitation_constants");
$schema->getTable("{$prefix}collaboration_constants");
} catch (Exception $e) {
if ($e->getCode() == SchemaException::TABLE_DOESNT_EXIST) {
$table = $schema->createTable("{$prefix}invitation_constants");
$table = $schema->createTable("{$prefix}collaboration_constants");
$table->addColumn('name', Types::STRING, [
'length' => 255,
'notnull' => true,
Expand Down
40 changes: 20 additions & 20 deletions appinfo/Migrations/Version20240209130007.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<?php

namespace OCA\invitation\Migrations;
namespace OCA\Collaboration\Migrations;

use OCP\IDBConnection;
use OCP\Migration\ISqlMigration;

/**
* Adds constants to oc_invitation_constants table
* Adds constants to oc_collaboration_constants table
* Adds views: invitation_view_invitations, invitation_view_remote_users
*/
class Version20240209130007 implements ISqlMigration
{
public function sql(IDBConnection $connection)
{
$stmnt = $connection->prepare(
"INSERT INTO `oc_invitation_constants` (`name`, `value`)
"INSERT INTO `oc_collaboration_constants` (`name`, `value`)
SELECT * FROM (SELECT 'invitation.received', 'received') AS tmp
WHERE NOT EXISTS (
SELECT name FROM oc_invitation_constants WHERE name = 'invitation.received'
SELECT name FROM oc_collaboration_constants WHERE name = 'invitation.received'
) LIMIT 1;
INSERT INTO `oc_invitation_constants` (`name`, `value`)
INSERT INTO `oc_collaboration_constants` (`name`, `value`)
SELECT * FROM (SELECT 'invitation.sent', 'sent') AS tmp
WHERE NOT EXISTS (
SELECT name FROM oc_invitation_constants WHERE name = 'invitation.sent'
SELECT name FROM oc_collaboration_constants WHERE name = 'invitation.sent'
) LIMIT 1;

drop view if exists invitation_view_invitations;
create view invitation_view_invitations as
drop view if exists collaboration_view_invitations;
create view collaboration_view_invitations as
select distinct
s.id, s.token, s.timestamp, s.status,
s.user_cloud_id, s.user_provider_endpoint, s.sent_received,
Expand All @@ -37,53 +37,53 @@ public function sql(IDBConnection $connection)
from (
select
i.id as id, i.token as token, i.timestamp as timestamp, i.status as status,
i.sender_cloud_id as user_cloud_id, i.provider_endpoint as user_provider_endpoint, (select value from oc_invitation_constants where name='invitation.sent') as sent_received,
i.sender_cloud_id as user_cloud_id, i.provider_endpoint as user_provider_endpoint, (select value from oc_collaboration_constants where name='invitation.sent') as sent_received,
i.provider_endpoint as provider_endpoint, i.recipient_endpoint as recipient_endpoint,
i.sender_cloud_id as sender_cloud_id, i.sender_name as sender_name, i.sender_email as sender_email,
i.recipient_cloud_id as recipient_cloud_id, i.recipient_name as recipient_name, i.recipient_email as recipient_email,
i.recipient_cloud_id as remote_user_cloud_id, i.recipient_name as remote_user_name, i.recipient_email as remote_user_email, i.recipient_endpoint as remote_user_provider_endpoint
from oc_invitation_invitations i
from oc_collaboration_invitations i
union all
select
ii.id as id, ii.token as token, ii.timestamp as timestamp, ii.status as status,
ii.recipient_cloud_id as user_cloud_id, ii.recipient_endpoint as user_provider_endpoint, (select value from oc_invitation_constants where name='invitation.received') as sent_received,
ii.recipient_cloud_id as user_cloud_id, ii.recipient_endpoint as user_provider_endpoint, (select value from oc_collaboration_constants where name='invitation.received') as sent_received,
ii.provider_endpoint as provider_endpoint, ii.recipient_endpoint as recipient_endpoint,
ii.sender_cloud_id as sender_cloud_id, ii.sender_name as sender_name, ii.sender_email as sender_email,
ii.recipient_cloud_id as recipient_cloud_id, ii.recipient_name as recipient_name, ii.recipient_email as recipient_email,
ii.sender_cloud_id as remote_user_cloud_id, ii.sender_name as remote_user_name, ii.sender_email as remote_user_email, ii.provider_endpoint as remote_user_provider_endpoint
from oc_invitation_invitations ii
from oc_collaboration_invitations ii
) s
left join oc_invitation_invitation_service_providers as isp
left join oc_collaboration_invitation_service_providers as isp
on isp.endpoint=s.remote_user_provider_endpoint
join oc_appconfig c
on c.configvalue=s.user_provider_endpoint
where c.appid='invitation' and c.configkey='endpoint'
where c.appid='collaboration' and c.configkey='endpoint'
group by s.id;

drop view if exists invitation_view_remote_users;
create view invitation_view_remote_users as
drop view if exists collaboration_view_remote_users;
create view collaboration_view_remote_users as
select distinct
s.invitation_id, s.user_cloud_id, s.user_name, s.remote_user_cloud_id, s.remote_user_name, s.remote_user_email, s.remote_provider_endpoint as remote_user_provider_endpoint, isp.name as remote_user_provider_name
from (
select
i.id as invitation_id, i.provider_endpoint as provider_endpoint,
i.sender_cloud_id as user_cloud_id, i.sender_name as user_name,
i.recipient_cloud_id as remote_user_cloud_id, i.recipient_name as remote_user_name, i.recipient_email as remote_user_email, i.recipient_endpoint as remote_provider_endpoint
from oc_invitation_invitations i
from oc_collaboration_invitations i
where i.status='accepted'
union all
select
ii.id as invitation_id, ii.recipient_endpoint as provider_endpoint,
ii.recipient_cloud_id as user_cloud_id, ii.recipient_name as user_name,
ii.sender_cloud_id as remote_user_cloud_id, ii.sender_name as remote_user_name, ii.sender_email as remote_user_email, ii.provider_endpoint as remote_provider_endpoint
from oc_invitation_invitations ii
from oc_collaboration_invitations ii
where ii.status='accepted'
) s
join oc_invitation_invitation_service_providers as isp
join oc_collaboration_invitation_service_providers as isp
on isp.endpoint=s.remote_provider_endpoint
join oc_appconfig c
on c.configvalue=s.provider_endpoint
where c.appid='invitation' and c.configkey='endpoint'
where c.appid='collaboration' and c.configkey='endpoint'
group by s.invitation_id;"
);
$stmnt->execute();
Expand Down
20 changes: 11 additions & 9 deletions appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

use OCA\Invitation\AppInfo\InvitationApp;
use OCA\Collaboration\AppInfo\CollaborationApp;
use OCP\Util;

require __DIR__ . '/../vendor/autoload.php';
Expand All @@ -20,29 +20,31 @@ function () {

return [
// The string under which your app will be referenced in owncloud
'id' => InvitationApp::APP_NAME,
'id' => CollaborationApp::APP_NAME,

// The sorting weight for the navigation.
// The higher the number, the higher will it be listed in the navigation
'order' => 10,

// The route that will be shown on startup
'href' => $urlGenerator->linkToRoute(InvitationApp::APP_NAME . '.invitation.index'),
'href' => $urlGenerator->linkToRoute(CollaborationApp::APP_NAME . '.invitation.index'),

// The icon that will be shown in the navigation, located in img/
'icon' => $urlGenerator->imagePath(InvitationApp::APP_NAME, 'handshake.svg'),
'icon' => $urlGenerator->imagePath(CollaborationApp::APP_NAME, 'handshake.svg'),

// The application's title, used in the navigation & the settings page of your app
'name' => OC::$server->getL10N(InvitationApp::APP_NAME)->t('Invitation'),
'name' => OC::$server->getL10N(CollaborationApp::APP_NAME)->t('Collaboration'),
];
}
);
$app = \OC::$server->query(\OCA\Invitation\AppInfo\InvitationApp::class);
$app = \OC::$server->query(\OCA\Collaboration\AppInfo\CollaborationApp::class);
// this overrides the OC core sharedialogview.js file.
Util::addScript(InvitationApp::APP_NAME, 'oc/sharedialogview');
Util::addScript(CollaborationApp::APP_NAME, 'oc/sharedialogview');
Util::addStyle(CollaborationApp::APP_NAME, 'pure-min-css-3.0.0');
Util::addStyle(CollaborationApp::APP_NAME, 'collaboration');
} else {
\OC::$server->getLogger()->error('Error: not installed. Invitations app requires: Federated File Sharing app, Notifications app', ['app' => InvitationApp::APP_NAME]);
\OC::$server->getLogger()->error('Error: not installed. Collaboration app requires: Federated File Sharing app, Notifications app', ['app' => CollaborationApp::APP_NAME]);
$eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', function () {
script(InvitationApp::APP_NAME, 'app-install-error');
script(CollaborationApp::APP_NAME, 'app-install-error');
});
}
14 changes: 7 additions & 7 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0"?>
<info>
<!-- Mandatory fields -->
<id>invitation</id>
<name>Invitation App</name>
<description>Invitation App</description>
<id>collaboration</id>
<name>Collaboration</name>
<description>Collaboration</description>
<version>0.003</version>
<!-- TODO: check licence-->
<licence>mit</licence>
<!-- <screenshot small-thumbnail="https://raw.githubusercontent.com/foo/yourapp/master/screenshots/thumb.png">https://raw.githubusercontent.com/foo/yourapp/master/screenshots/big.png</screenshot> -->
<!-- Category values available at: https://marketplace.owncloud.com/ajax/categories -->
<category>Integration.</category>
<category>Collaboration</category>
<summary>Enhances federated sharing between Owncloud instances by implementing an invitation workflow.</summary>
<types>
</types>
Expand All @@ -23,7 +23,7 @@


<author>Antoon Prins</author>
<namespace>Invitation</namespace>
<namespace>Collaboration</namespace>
<website>https://github.com/sara-nl/oc-invitation</website>
<bugs>https://github.com/sara-nl/oc-invitation/issues</bugs>
<repository type="git">https://github.com/sara-nl/oc-invitation.git</repository>
Expand All @@ -33,11 +33,11 @@
</dependencies>

<settings>
<admin>OCA\Invitation\Settings\Admin</admin>
<admin>OCA\Collaboration\Settings\Admin</admin>
</settings>

<background-jobs>
<job>OCA\Invitation\Job\CleanupInvitations</job>
<job>OCA\Collaboration\Job\CleanupInvitations</job>
</background-jobs>

<use-migrations>true</use-migrations>
Expand Down
2 changes: 1 addition & 1 deletion appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
return [
'routes' => [
// bespoke API - invitation
// unprotected endpoint /invitation
// unprotected endpoint /collaboration
['name' => 'invitation#invitation', 'url' => '/invite/{token}', 'verb' => 'GET'],
['name' => 'invitation#invitation_form', 'url' => '/invitation-form', 'verb' => 'GET'],
['name' => 'invitation#generate_invite', 'url' => '/generate-invite', 'verb' => 'POST'],
Expand Down
14 changes: 7 additions & 7 deletions css/invitation.css → css/collaboration.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ span.settings-error {
color: red;
}

div.app-invitation div.error a {
div.app-collaboration div.error a {
color: darkblue !important;
}

Expand Down Expand Up @@ -260,16 +260,16 @@ div.wayf div.institute-logo img {
max-height: 2.5em;
}

div.app-invitation>div.oc-dialog {
div.app-collaboration>div.oc-dialog {
width: 50%;
z-index: 10000;
}

div.app-invitation>div.oc-dialog h3.oc-dialog-title {
div.app-collaboration>div.oc-dialog h3.oc-dialog-title {
font-size: larger;
}

div.app-invitation>div.oc-dialog legend {
div.app-collaboration>div.oc-dialog legend {
font-weight: normal;
}

Expand All @@ -295,15 +295,15 @@ div.invitation-form div.invitation-form-button-row {
padding-top: .7em;
}

div.app-invitation div.oc-dialog {
div.app-collaboration div.oc-dialog {
z-index: 900;
}

div.app-invitation>div.oc-dialog-dim {
div.app-collaboration>div.oc-dialog-dim {
z-index: 899;
}

div.app-invitation>div.oc-dialog-dim.confirmation {
div.app-collaboration>div.oc-dialog-dim.confirmation {
z-index: 999;
}

Expand Down
Binary file modified img/invitation-app-settings-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion js/app-install-error.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
OC.dialogs.alert("The Invitation app requires installment of: Federated File Sharing app, Notifications app", "Installation error 'Invitation app'");
OC.dialogs.alert("The Invitation app requires installment of: Federated File Sharing app, Notifications app", "Installation error 'Collaboration app'");
Loading
Loading