diff --git a/Makefile b/Makefile index 1900b0f..9df94e4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -app_name=invitation +app_name=collaboration # VERSION=please_set_version version=$(version) app_dir_name=$(notdir $(CURDIR)) diff --git a/README.md b/README.md index 5549610..b0dcbfc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Invitation app for Federated Sharing +# Collaboration app for Federated Sharing --- ### Enhanced federated sharing between Owncloud instances. @@ -27,18 +27,18 @@ 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.
Next build the project by executing the command: `make version={version_number} buildapp`
-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.
+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.
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).
-Deploy the app by copying the extracted `invitation` folder of the official release or your own custom build to the Owncloud `apps` folder.
+Deploy the app by copying the extracted `collaboration` folder of the official release or your own custom build to the Owncloud `apps` folder.
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' ``` --- @@ -46,8 +46,8 @@ To activate enhanced federated sharing (search and display invited remote users To be able to send invitations between Owncloud instances the app must be installed on each one of them.
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).

-![Invitation app settings page](img/invitation-app-settings-page.png "Invitation app settings page")
-Fig.2 Invitation app settings page.
+![Invitation Service settings page](img/invitation-app-settings-page.png "Invitation Service settings page")
+Fig.2 Invitation Service settings page.
##### 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)).
@@ -55,7 +55,7 @@ Fig.2 Invitation app settings page.
##### section - This Invitation Service Provider * Here you should specify the endpoint and name of this instance's Invitation Service Provider.
- 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.
@@ -79,12 +79,12 @@ Check the outcome of the tests and fix any issue.
* [Building a release .tar.gz file](release/README.md) #### Development options -* Display the generated invite link:
+* To display the generated invite link upon the creation of an invite:
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 |
diff --git a/appinfo/Migrations/Version20231130102037.php b/appinfo/Migrations/Version20231130102037.php index 493b0af..1094fab 100644 --- a/appinfo/Migrations/Version20231130102037.php +++ b/appinfo/Migrations/Version20231130102037.php @@ -1,6 +1,6 @@ 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, @@ -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, diff --git a/appinfo/Migrations/Version20231130125300.php b/appinfo/Migrations/Version20231130125300.php index 12a536c..c0eaaab 100644 --- a/appinfo/Migrations/Version20231130125300.php +++ b/appinfo/Migrations/Version20231130125300.php @@ -1,6 +1,6 @@ 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, diff --git a/appinfo/Migrations/Version20240209130007.php b/appinfo/Migrations/Version20240209130007.php index d640781..0f778c5 100644 --- a/appinfo/Migrations/Version20240209130007.php +++ b/appinfo/Migrations/Version20240209130007.php @@ -1,12 +1,12 @@ 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, @@ -37,31 +37,31 @@ 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 ( @@ -69,21 +69,21 @@ public function sql(IDBConnection $connection) 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(); diff --git a/appinfo/app.php b/appinfo/app.php index e0d2814..0bb1ac9 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -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'; @@ -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'); }); } diff --git a/appinfo/info.xml b/appinfo/info.xml index eaddfff..df4d577 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -1,15 +1,15 @@ - invitation - Invitation App - Invitation App + collaboration + Collaboration + Collaboration 0.003 mit - Integration. + Collaboration Enhances federated sharing between Owncloud instances by implementing an invitation workflow. @@ -23,7 +23,7 @@ Antoon Prins - Invitation + Collaboration https://github.com/sara-nl/oc-invitation https://github.com/sara-nl/oc-invitation/issues https://github.com/sara-nl/oc-invitation.git @@ -33,11 +33,11 @@ - OCA\Invitation\Settings\Admin + OCA\Collaboration\Settings\Admin - OCA\Invitation\Job\CleanupInvitations + OCA\Collaboration\Job\CleanupInvitations true diff --git a/appinfo/routes.php b/appinfo/routes.php index f7af50e..a91f1d6 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -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'], diff --git a/css/invitation.css b/css/collaboration.css similarity index 94% rename from css/invitation.css rename to css/collaboration.css index dfc5bd7..f93fb8d 100644 --- a/css/invitation.css +++ b/css/collaboration.css @@ -75,7 +75,7 @@ span.settings-error { color: red; } -div.app-invitation div.error a { +div.app-collaboration div.error a { color: darkblue !important; } @@ -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; } @@ -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; } diff --git a/img/invitation-app-settings-page.png b/img/invitation-app-settings-page.png index ae1d2f4..a8ca3d4 100644 Binary files a/img/invitation-app-settings-page.png and b/img/invitation-app-settings-page.png differ diff --git a/js/app-install-error.js b/js/app-install-error.js index c6dc552..0cc45fc 100644 --- a/js/app-install-error.js +++ b/js/app-install-error.js @@ -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'"); diff --git a/js/invitation-service.js b/js/invitation-service.js index c81278f..1e17065 100644 --- a/js/invitation-service.js +++ b/js/invitation-service.js @@ -61,7 +61,7 @@ */ let _call = function (route, method, paramsObject, successCallback, errorCallback) { var path = trimSlashes(route); - var endpoint = OC.generateUrl('/apps/invitation/' + path); + var endpoint = OC.generateUrl('/apps/collaboration/' + path); var options = { method: method, headers: { diff --git a/js/invitation.js b/js/invitation.js index 77659f6..f51905c 100644 --- a/js/invitation.js +++ b/js/invitation.js @@ -14,7 +14,7 @@ if ($('input[value="deploy_mode_test"]').size() === 1) { console.log(errorMessage); } - OC.dialogs.alert(t('invitation', errorMessage), t('invitation', 'UPDATE_INVITATION_ERROR')); + OC.dialogs.alert(t('collaboration', errorMessage), t('collaboration', 'UPDATE_INVITATION_ERROR')); } ); } @@ -32,7 +32,7 @@ if ($('input[value="deploy_mode_test"]').size() === 1) { console.log(errorMessage); } - OC.dialogs.alert(t('invitation', errorMessage), t('invitation', 'ACCEPT_INVITATION_ERROR')); + OC.dialogs.alert(t('collaboration', errorMessage), t('collaboration', 'ACCEPT_INVITATION_ERROR')); } ); @@ -40,7 +40,7 @@ let invitationButton = function (status, token, recipientCloudId, recipientName, recipientEmail) { if (status === 'accepted') { - var acceptButton = $('' + t('invitation', 'accept') + ''); + var acceptButton = $('' + t('collaboration', 'accept') + ''); acceptButton.on( "click", function (event) { event.preventDefault(); @@ -63,9 +63,9 @@ ).done(() => { // here we render the actual message which includes html $('.' + dialogClass).empty().append( '

' - + t('invitation', 'Your cloud ID: {cloudId}', { "cloudId": recipientCloudId }) + '
' - + t('invitation', 'Your name: {name}', { "name": recipientName }) + '
' - + t('invitation', 'Your email: {email}', { "email": recipientEmail }) + '
' + + t('collaboration', 'Your cloud ID: {cloudId}', { "cloudId": recipientCloudId }) + '
' + + t('collaboration', 'Your name: {name}', { "name": recipientName }) + '
' + + t('collaboration', 'Your email: {email}', { "email": recipientEmail }) + '
' + '
' + '

' ); @@ -75,15 +75,15 @@ return acceptButton; } if (status === 'declined') { - var declineButton = $('' + t('invitation', 'decline') + ''); + var declineButton = $('' + t('collaboration', 'decline') + ''); declineButton.on( "click", function (event) { event.preventDefault(); event.stopPropagation(); $('div#invitation-index-message span.message').empty(); OC.dialogs.confirm( - t('invitation', 'decline-invitation-confirmation-title'), - t('invitation', 'decline-invitation-confirmation-message'), + t('collaboration', 'decline-invitation-confirmation-title'), + t('collaboration', 'decline-invitation-confirmation-message'), function (declined) { if (declined == true) { _updateInvite(token, 'declined'); @@ -96,15 +96,15 @@ return declineButton; } if (status === 'revoked') { - var revokeButton = $('' + t('invitation', 'revoke') + ''); + var revokeButton = $('' + t('collaboration', 'revoke') + ''); revokeButton.on( "click", function (event) { event.preventDefault(); event.stopPropagation(); $('div#invitation-index-message span.message').empty(); OC.dialogs.confirm( - t('invitation', 'revoke-invitation-confirmation-title'), - t('invitation', 'revoke-invitation-confirmation-message'), + t('collaboration', 'revoke-invitation-confirmation-title'), + t('collaboration', 'revoke-invitation-confirmation-message'), function (revoked) { if (revoked == true) { _updateInvite(token, 'revoked'); @@ -117,15 +117,15 @@ return revokeButton; } if (status === 'withdrawn') { - var withdrawButton = $('' + t('invitation', 'withdraw') + ''); + var withdrawButton = $('' + t('collaboration', 'withdraw') + ''); withdrawButton.on( "click", function (event) { event.preventDefault(); event.stopPropagation(); $('div#invitation-index-message span.message').empty(); OC.dialogs.confirm( - t('invitation', 'withdraw-invitation-confirmation-title'), - t('invitation', 'withdraw-invitation-confirmation-message'), + t('collaboration', 'withdraw-invitation-confirmation-title'), + t('collaboration', 'withdraw-invitation-confirmation-message'), function (withdraw) { if (withdraw == true) { _updateInvite(token, 'withdrawn'); @@ -148,13 +148,13 @@ */ let validateInvitationFields = function (email, recipientName, senderName) { if (typeof recipientName !== "string" || recipientName.trim() === "") { - return t('invitation', "CREATE_INVITATION_NO_RECIPIENT_NAME") + return t('collaboration', "CREATE_INVITATION_NO_RECIPIENT_NAME") } if (typeof email !== "string" || email.trim() === "") { - return t('invitation', "CREATE_INVITATION_NO_RECIPIENT_EMAIL") + return t('collaboration', "CREATE_INVITATION_NO_RECIPIENT_EMAIL") } if (typeof senderName !== "string" || senderName.trim() === "") { - return t('invitation', "CREATE_INVITATION_NO_SENDER_NAME") + return t('collaboration', "CREATE_INVITATION_NO_SENDER_NAME") } return ""; } @@ -164,7 +164,7 @@ table.empty(); invitations.forEach((invitation) => { table.append( - '' + t('invitation', invitation.sentReceived) + '' + t('collaboration', invitation.sentReceived) + '' + invitation.remoteUserName + '' + invitation.remoteUserProviderName + '' + invitation.remoteUserEmail @@ -186,7 +186,7 @@ table.empty(); invitations.forEach((invitation) => { table.append( - '' + t('invitation', invitation.sentReceived) + '' + t('collaboration', invitation.sentReceived) + '' + invitation.remoteUserName + '' + invitation.remoteUserProviderName + '' + invitation.remoteUserEmail @@ -217,7 +217,7 @@ $('#invitation-message span.error').text(""); OC.dialogs.message( '', - t('invitation', 'confirmation-header'), + t('collaboration', 'confirmation-header'), '', OCdialogs.YES_BUTTON, function () { @@ -230,7 +230,7 @@ if ($('input[value="deploy_mode_test"]').size() === 1) { $('#invitation-index-message span.message').html( '
' - + '
' + t('invitation', 'Your invitation has been sent to', { recipientName: result.data.recipientName, recipientEmail: result.data.email }) + '
' + + '
' + t('collaboration', 'Your invitation has been sent to', { recipientName: result.data.recipientName, recipientEmail: result.data.email }) + '
' + '

Invite link: ' + result.data.inviteLink + '

' + '
' ); @@ -238,7 +238,7 @@ } else { $('#invitation-index-message span.message').html( ' ' - + '
' + t('invitation', 'Your invitation has been sent to', { recipientName: result.data.recipientName, recipientEmail: result.data.email }) + '
' + + '
' + t('collaboration', 'Your invitation has been sent to', { recipientName: result.data.recipientName, recipientEmail: result.data.email }) + '
' + '' ); } @@ -246,7 +246,7 @@ window.INVITATION.closeInvitationForm(); }, function (errorMessage) { - $('#invitation-message span.error').append(' ' + t('invitation', errorMessage)); + $('#invitation-message span.error').append(' ' + t('collaboration', errorMessage)); } ); }, @@ -254,7 +254,7 @@ dialogClass ).done(() => { // this prevents the message dialog to remove the html present in the translation $('.' + dialogClass).empty().append( - t('invitation', 'confirmation', { "cloudId": cloudId, "name": yourName, "email": email }) + t('collaboration', 'confirmation', { "cloudId": cloudId, "name": yourName, "email": email }) ); // to position the confirmation dialog overlay on top of the invitation form overlay $('div.oc-dialog-dim:last').addClass('confirmation'); @@ -284,8 +284,8 @@ console.log(errorMessage); } v = []; - status.forEach((e) => v.push(t('invitation', e.status))); - $('#invitation-index-message span.error').append(' ' + t('invitation', 'GET_INVITATIONS_ERROR_UNSPECIFIED', { status: v.join() }) + '
'); + status.forEach((e) => v.push(t('collaboration', e.status))); + $('#invitation-index-message span.error').append(' ' + t('collaboration', 'GET_INVITATIONS_ERROR_UNSPECIFIED', { status: v.join() }) + '
'); } ); }; @@ -342,7 +342,7 @@ close: function () { window.INVITATION.closeInvitationForm(); }, - title: t('invitation', 'Create Invitation') + title: t('collaboration', 'Create invitation to exchange cloud ID') }); } } else { @@ -353,7 +353,7 @@ if ($('input[value="deploy_mode_test"]').size() === 1) { console.log(response.toString()); } - $('#invitation-error span').text(t('invitation', 'ERROR_UNSPECIFIED')); + $('#invitation-error span').text(t('collaboration', 'ERROR_UNSPECIFIED')); } ); } @@ -363,6 +363,6 @@ window.INVITATION.listInvitations([{ "status": "open" }], window.INVITATION.renderOpenInvitations); window.INVITATION.listInvitations([{ "status": "accepted" }], window.INVITATION.renderAcceptedInvitations); - $(".information").html(t('invitation', 'explanation')); + $(".information").html(t('collaboration', 'explanation')); }); })(window, jQuery); \ No newline at end of file diff --git a/js/settings.js b/js/settings.js index 04857d4..4e5c287 100644 --- a/js/settings.js +++ b/js/settings.js @@ -21,11 +21,11 @@ if (result.success == true) { console.log('allow sharing with invited users only updated to "' + result.data + '"'); } else { - document.getElementById('allow-sharing-with-invited-users-only-error').innerText = t('invitation', result.error_message); + document.getElementById('allow-sharing-with-invited-users-only-error').innerText = t('collaboration', result.error_message); } }, (response) => { - document.getElementById('allow-sharing-with-invited-users-only-error').innerText = t('invitation', 'SETTINGS_UPDATE_ERROR'); + document.getElementById('allow-sharing-with-invited-users-only-error').innerText = t('collaboration', 'SETTINGS_UPDATE_ERROR'); console.log(response.toString()); } ) @@ -56,20 +56,20 @@ $('[id="invitation-service-settings-success"]').text('saved'); $('[id="invitation-service-settings-success"]').addClass('fade-out'); } else { - document.getElementById('invitation-service-settings-error').innerText = t('invitation', result.error_message); + document.getElementById('invitation-service-settings-error').innerText = t('collaboration', result.error_message); } }, (response) => { - document.getElementById('invitation-service-settings-error').innerText = t('invitation', 'MESH_REGISTRY_UPDATE_PROVIDER_ERROR'); + document.getElementById('invitation-service-settings-error').innerText = t('collaboration', 'MESH_REGISTRY_UPDATE_PROVIDER_ERROR'); console.log(response.toString()); } ) } else { if (_endpoint === "") { - document.getElementById('invitation-service-settings-endpoint-error').innerText = t('invitation', 'MESH_REGISTRY_UPDATE_PROVIDER_REQUIRED_FIELD_ERROR'); + document.getElementById('invitation-service-settings-endpoint-error').innerText = t('collaboration', 'MESH_REGISTRY_UPDATE_PROVIDER_REQUIRED_FIELD_ERROR'); } if (_name === "") { - document.getElementById('invitation-service-settings-name-error').innerText = t('invitation', "MESH_REGISTRY_UPDATE_PROVIDER_REQUIRED_FIELD_ERROR"); + document.getElementById('invitation-service-settings-name-error').innerText = t('collaboration', "MESH_REGISTRY_UPDATE_PROVIDER_REQUIRED_FIELD_ERROR"); } } } @@ -98,11 +98,11 @@ } }); } else { - document.getElementById('invitation-remote-service-providers-error').innerText = t('invitation', result.error_message); + document.getElementById('invitation-remote-service-providers-error').innerText = t('collaboration', result.error_message); } }, function (response) { - document.getElementById('invitation-remote-service-providers-error').innerText = t('invitation', 'MESH_REGISTRY_GET_SERVICE_PROVIDERS_ERROR'); + document.getElementById('invitation-remote-service-providers-error').innerText = t('collaboration', 'MESH_REGISTRY_GET_SERVICE_PROVIDERS_ERROR'); console.log(response.toString()); } ); @@ -129,11 +129,11 @@ getAllProviders(); console.log('invitation service provider with endpoint ' + endpoint + ' deleted'); } else { - errorElement.innerText = t('invitation', result.error_message); + errorElement.innerText = t('collaboration', result.error_message); } }, (response) => { - errorElement.innerText = t('invitation', 'MESH_REGISTRY_DELETE_SERVICE_PROVIDER_ERROR'); + errorElement.innerText = t('collaboration', 'MESH_REGISTRY_DELETE_SERVICE_PROVIDER_ERROR'); console.log(response.toString()); } ) @@ -174,15 +174,15 @@ document.getElementById('invitation-add-remote-service-provider-endpoint').value = ""; getAllProviders(); } else { - document.getElementById('invitation-remote-service-provider-save-error').innerText = t('invitation', result.error_message); + document.getElementById('invitation-remote-service-provider-save-error').innerText = t('collaboration', result.error_message); } }, (response) => { console.log(response.toString()); if (response == "SETTINGS_ADD_PROVIDER_IS_NOT_REMOTE_ERROR") { - document.getElementById('invitation-remote-service-provider-save-error').innerText = t('invitation', 'SETTINGS_ADD_PROVIDER_IS_NOT_REMOTE_ERROR'); + document.getElementById('invitation-remote-service-provider-save-error').innerText = t('collaboration', 'SETTINGS_ADD_PROVIDER_IS_NOT_REMOTE_ERROR'); } else { - document.getElementById('invitation-remote-service-provider-save-error').innerText = t('invitation', 'MESH_REGISTRY_ADD_PROVIDER_ERROR'); + document.getElementById('invitation-remote-service-provider-save-error').innerText = t('collaboration', 'MESH_REGISTRY_ADD_PROVIDER_ERROR'); } } ); diff --git a/l10n/en.js b/l10n/en.js index ac6c6c8..9352a6e 100644 --- a/l10n/en.js +++ b/l10n/en.js @@ -1,5 +1,5 @@ OC.L10N.register( - "invitation", + "collaboration", { "ERROR_UNSPECIFIED": "An error has occurred. No further information available.", "APPLICATION_CONFIGURATION_EXCEPTION": "An error has occurred. The application is not configured correctly.", @@ -24,7 +24,7 @@ OC.L10N.register( "confirmation": "

Your cloud ID: {cloudId}
Your email: {email}
Your name: {name}

", "sent": "Sent to", "received": "Received from", - "explanation": "

Invite a remote user to exchange cloud ID's.

If you want to share data with a Research Drive user from a different institute you need that person's cloud ID.
You can obtain the cloud ID of the person you want to share with by sending a one time invitation.
When this person accepts the invitation your cloud IDs will be exchanged and saved in each others Research Drive environment.
From then on, when sharing, you can find that remote person by name, email or institute name.", + "explanation": "

Collaborate with users between Research Drive environments.

To share data with a Research Drive user from another institute, who is active on another Research Drive environment, you need the cloud ID of that user.
With the cloud ID, you can immediately start sharing a folder or file between Research Drive environments.
To simplify federated sharing, a one-time invitation allows you to request this remote user to exchange your cloud IDs.
When that user accepts the invitation, the cloud IDs are automatically exchanged and stored.
From then on, when sharing, you can find that remote person by name, email or institute name.

If you want to collaborate with an external user, you can invite them to a Research Drive account, go to Research Drive Dashboard.", "MESH_REGISTRY_ADD_PROVIDER_ERROR": "An error has occurred. Could not add provider.", "MESH_REGISTRY_UPDATE_PROVIDER_ERROR": "An error has occurred. Could not update provider.", "SETTINGS_UPDATE_ERROR": "An error has occurred. Could not update this setting.", diff --git a/l10n/nl.js b/l10n/nl.js index dbb6777..8658ec0 100644 --- a/l10n/nl.js +++ b/l10n/nl.js @@ -1,7 +1,8 @@ OC.L10N.register( - "invitation", + "collaboration", { - "Create Invitation": "Nieuwe Uitnodiging", + "Exchange cloud ID": "Cloud ID uitwisselen", + "Create invitation to exchange cloud ID":"Nieuwe uitnodiging voor het uitwisselen van cloud ID", "ERROR_UNSPECIFIED": "Er is iets misgegaan. Geen verdere informatie beschikbaar.", "APPLICATION_CONFIGURATION_EXCEPTION": "Er is iets misgegaan. De applicatie is incorrect geconfigureerd.", "GET_INVITATIONS_ERROR_UNSPECIFIED": "Foutmelding: kon geen {status} uitnodigingen ophalen.", @@ -32,7 +33,7 @@ OC.L10N.register( "revoke": "intrekken", "confirmation-header": "Let op, the volgende informatie zal worden gedeeld met de ontvanger van de uitnodiging:", "confirmation": "

Uw cloud ID: {cloudId}
Uw email: {email}
Uw naam: {name}

", - "explanation": "

Een remote gebruiker uitnodigen om cloud IDs uit te wisselen.

Om data te kunnen delen met een Research Drive gebruiker van een ander instituut heeft u het cloud ID van die gebruiker nodig.
U kunt middels een eenmalige uitnodiging deze remote gebruiker verzoeken uw cloud IDs uit te wisselen.
Wanneer die gebruiker de uitnodiging accepteert worden de cloud IDs automatisch uitgewisseld en opgeslagen in de Research Drive omgeving.
Vanaf dat moment kunt u bij het data delen elkaar vinden op basis van naam, email en naam van het instituut.", + "explanation": "

Samenwerken met gebruikers tussen Research Drive omgevingen.

Om data te kunnen delen met een Research Drive gebruiker van een ander instituut, die op een andere Research Drive omgeving actief is, heeft u het cloud ID van deze gebruiker nodig.
Met het cloud id kunt u direct beginnen met het delen van bestand of map tussen Research Drive omgeving in.
Om het gefedereerd delen te vereenvoudigen, kunt u middels een eenmalige uitnodiging deze remote gebruiker verzoeken de cloud IDs uit te wisselen.
Wanneer die gebruiker de uitnodiging accepteert worden de cloud IDs automatisch uitgewisseld en opgeslagen.
Vanaf dat moment kunt u bij het data delen elkaar direct vinden op basis van naam, email en naam van het instituut.

Wilt u samenwerken met een externe gebruiker, dan kunt u deze uitnodigen voor een Research Drive account, ga hiervoor naar het Research Drive Dashboard.", "MESH_REGISTRY_ADD_PROVIDER_ERROR": "Er is iets misgegaan. Kan geen provider toevoegen.", "MESH_REGISTRY_UPDATE_PROVIDER_ERROR": "Er is iets misgegaan. Kan provider niet aanpassen.", "SETTINGS_UPDATE_ERROR": "An error has occurred. Kon deze setting niet updaten.", diff --git a/l10n/nl.json b/l10n/nl.json index 271fb0d..d080336 100644 --- a/l10n/nl.json +++ b/l10n/nl.json @@ -1,6 +1,6 @@ { "translations": { - "Create invitation": "Nieuwe Uitnodiging", + "Exchange cloud ID": "Cloud ID uitwisselen", "Recipient email": "Email ontvanger", "Recipient name": "Naam ontvanger", "Invitation to": "Uitnodiging naar", diff --git a/lib/AppInfo/AppError.php b/lib/AppInfo/AppError.php index e1b1e3d..b7318d0 100644 --- a/lib/AppInfo/AppError.php +++ b/lib/AppInfo/AppError.php @@ -4,7 +4,7 @@ * Translatable errors that may be returned or used as exception messages. */ -namespace OCA\Invitation\AppInfo; +namespace OCA\Collaboration\AppInfo; class AppError { diff --git a/lib/AppInfo/InvitationApp.php b/lib/AppInfo/CollaborationApp.php similarity index 80% rename from lib/AppInfo/InvitationApp.php rename to lib/AppInfo/CollaborationApp.php index 071048f..3d47c12 100644 --- a/lib/AppInfo/InvitationApp.php +++ b/lib/AppInfo/CollaborationApp.php @@ -4,19 +4,19 @@ * Setup and wiring of the app. */ -namespace OCA\Invitation\AppInfo; +namespace OCA\Collaboration\AppInfo; -use OCA\Invitation\Federation\InvitationServiceProviderMapper; -use OCA\Invitation\Federation\InvitationMapper; -use OCA\Invitation\Service\InvitationNotifier; -use OCA\Invitation\Service\InvitationService; -use OCA\Invitation\Service\MeshRegistry\MeshRegistryService; +use OCA\Collaboration\Federation\InvitationServiceProviderMapper; +use OCA\Collaboration\Federation\InvitationMapper; +use OCA\Collaboration\Service\InvitationNotifier; +use OCA\Collaboration\Service\InvitationService; +use OCA\Collaboration\Service\MeshRegistry\MeshRegistryService; use OCP\AppFramework\App; use OCP\IContainer; -class InvitationApp extends App +class CollaborationApp extends App { - public const APP_NAME = 'invitation'; + public const APP_NAME = 'collaboration'; public const CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY = 'allow_sharing_with_invited_users_only'; @@ -68,8 +68,8 @@ function () { }, function () { return [ - 'id' => 'invitation', - 'name' => 'Invitation app' + 'id' => 'collaboration', + 'name' => 'Collaboration app' ]; } ); diff --git a/lib/Controller/ErrorController.php b/lib/Controller/ErrorController.php index b45199a..594e130 100644 --- a/lib/Controller/ErrorController.php +++ b/lib/Controller/ErrorController.php @@ -5,9 +5,9 @@ * */ -namespace OCA\Invitation\Controller; +namespace OCA\Collaboration\Controller; -use OCA\Invitation\AppInfo\InvitationApp; +use OCA\Collaboration\AppInfo\CollaborationApp; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\TemplateResponse; use OCP\IRequest; @@ -29,6 +29,6 @@ public function __construct($appName, IRequest $request) */ public function invitation(string $message, string $param1 = ""): TemplateResponse { - return new TemplateResponse(InvitationApp::APP_NAME, 'error', ['message' => $message, 'param1' => $param1]); + return new TemplateResponse(CollaborationApp::APP_NAME, 'error', ['message' => $message, 'param1' => $param1]); } } diff --git a/lib/Controller/InvitationController.php b/lib/Controller/InvitationController.php index a928cad..b718c1a 100644 --- a/lib/Controller/InvitationController.php +++ b/lib/Controller/InvitationController.php @@ -5,20 +5,20 @@ * */ -namespace OCA\Invitation\Controller; +namespace OCA\Collaboration\Controller; use DateTime; use Exception; -use OCA\Invitation\AppInfo\InvitationApp; -use OCA\Invitation\AppInfo\AppError; -use OCA\Invitation\Db\Schema; -use OCA\Invitation\Federation\Invitation; -use OCA\Invitation\HttpClient; -use OCA\Invitation\Service\ApplicationConfigurationException; -use OCA\Invitation\Service\InvitationService; -use OCA\Invitation\Service\MeshRegistry\MeshRegistryService; -use OCA\Invitation\Service\NotFoundException; -use OCA\Invitation\Service\ServiceException; +use OCA\Collaboration\AppInfo\CollaborationApp; +use OCA\Collaboration\AppInfo\AppError; +use OCA\Collaboration\Db\Schema; +use OCA\Collaboration\Federation\Invitation; +use OCA\Collaboration\HttpClient; +use OCA\Collaboration\Service\ApplicationConfigurationException; +use OCA\Collaboration\Service\InvitationService; +use OCA\Collaboration\Service\MeshRegistry\MeshRegistryService; +use OCA\Collaboration\Service\NotFoundException; +use OCA\Collaboration\Service\ServiceException; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; @@ -84,7 +84,7 @@ public function invitation(string $token): DataResponse $data["remoteUserProviderName"] = $this->meshRegistryService->getName(); $data["status"] = $invitation->getStatus(); } catch (NotFoundException $e) { - $this->logger->debug($e->getMessage(), ["app" => InvitationApp::APP_NAME]); + $this->logger->debug($e->getMessage(), ["app" => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -93,7 +93,7 @@ public function invitation(string $token): DataResponse Http::STATUS_NOT_FOUND ); } catch (ServiceException $e) { - $this->logger->debug($e->getMessage(), ["app" => InvitationApp::APP_NAME]); + $this->logger->debug($e->getMessage(), ["app" => CollaborationApp::APP_NAME]); return new DataResponse( [ "success" => false @@ -101,7 +101,7 @@ public function invitation(string $token): DataResponse Http::STATUS_NOT_FOUND ); } catch (Exception $e) { - $this->logger->error($e->getMessage(), ["app" => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage(), ["app" => CollaborationApp::APP_NAME]); return new DataResponse( [ "success" => false @@ -130,8 +130,8 @@ public function invitationForm() if (strtolower(\OC::$server->getUserSession()->getUser()->getUID()) === strtolower($displayName)) { $displayName = ''; } - $languageCode = \OC::$server->getL10NFactory()->findLanguage(InvitationApp::APP_NAME); - $tmpl = new Template(InvitationApp::APP_NAME, "invitation.form", '', false, $languageCode); + $languageCode = \OC::$server->getL10NFactory()->findLanguage(CollaborationApp::APP_NAME); + $tmpl = new Template(CollaborationApp::APP_NAME, "invitation.form", '', false, $languageCode); $tmpl->assign('senderName', $displayName); $tmpl->assign('cloudID', \OC::$server->getUserSession()->getUser()->getCloudId()); return new DataResponse( @@ -240,7 +240,7 @@ public function generateInvite(string $email = '', string $recipientName = '', s $inviteLink = $this->meshRegistryService->inviteLink($params); } catch (ApplicationConfigurationException $e) { - $this->logger->error("An error has occurred: " . $e->getMessage() . " Stacktrace: " . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("An error has occurred: " . $e->getMessage() . " Stacktrace: " . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -249,7 +249,7 @@ public function generateInvite(string $email = '', string $recipientName = '', s Http::STATUS_NOT_FOUND, ); } catch (Exception $e) { - $this->logger->error("An error has occurred: " . $e->getMessage() . " Stacktrace: " . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("An error has occurred: " . $e->getMessage() . " Stacktrace: " . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -274,7 +274,7 @@ public function generateInvite(string $email = '', string $recipientName = '', s try { $mailer = \OC::$server->getMailer(); $mail = $mailer->createMessage(); - $mail->setSubject($this->il10n->t(InvitationApp::INVITATION_EMAIL_SUBJECT)); + $mail->setSubject($this->il10n->t(CollaborationApp::INVITATION_EMAIL_SUBJECT)); $mail->setFrom([$this->getEmailFromAddress('invitation-no-reply')]); $mail->setTo(array($email => $email)); $language = 'en'; // actually not used, the email itself is multi language @@ -284,10 +284,10 @@ public function generateInvite(string $email = '', string $recipientName = '', s $mail->setPlainBody($plainText); $failedRecipients = $mailer->send($mail); if (sizeof($failedRecipients) > 0) { - $this->logger->error(' - failed recipients: ' . print_r($failedRecipients, true), ['app' => InvitationApp::APP_NAME]); + $this->logger->error(' - failed recipients: ' . print_r($failedRecipients, true), ['app' => CollaborationApp::APP_NAME]); } } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); // TODO Instead of failing, we could continue and still insert and display the invitation as failed in the list // this would probably work best with a modify and resend option @@ -299,7 +299,7 @@ public function generateInvite(string $email = '', string $recipientName = '', s try { $newInvitation = $this->invitationService->insert($invitation); } catch (Exception $e) { - $this->logger->error('An error occurred while generating the invite: ' . $e->getMessage(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('An error occurred while generating the invite: ' . $e->getMessage(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -354,7 +354,7 @@ private function getEmailFromAddress(string $address = null) */ private function getMailBody(string $inviteLink, string $recipientName, string $message, string $targetTemplate = 'html', string $languageCode = '') { - $tmpl = new Template('invitation', "mail/$targetTemplate", '', false, $languageCode); + $tmpl = new Template('collaboration', "mail/$targetTemplate", '', false, $languageCode); $tmpl->assign('recipientName', $recipientName); $tmpl->assign('fromName', \OC::$server->getUserSession()->getUser()->getDisplayName()); $tmpl->assign('inviteLink', $inviteLink); @@ -377,17 +377,17 @@ public function handleInvite(string $token = '', string $providerEndpoint = ''): $urlGenerator = \OC::$server->getURLGenerator(); if ($token == '') { - \OC::$server->getLogger()->error('Invite is missing the token.', ['app' => InvitationApp::APP_NAME]); - return new RedirectResponse($urlGenerator->linkToRoute(InvitationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_ERROR])); + \OC::$server->getLogger()->error('Invite is missing the token.', ['app' => CollaborationApp::APP_NAME]); + return new RedirectResponse($urlGenerator->linkToRoute(CollaborationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_ERROR])); } if ($providerEndpoint == '') { - \OC::$server->getLogger()->error('Invite is missing the invitation service provider endpoint.', ['app' => InvitationApp::APP_NAME]); - return new RedirectResponse($urlGenerator->linkToRoute(InvitationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_ERROR])); + \OC::$server->getLogger()->error('Invite is missing the invitation service provider endpoint.', ['app' => CollaborationApp::APP_NAME]); + return new RedirectResponse($urlGenerator->linkToRoute(CollaborationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_ERROR])); } if (!$this->meshRegistryService->isKnowInvitationServiceProvider($providerEndpoint)) { - \OC::$server->getLogger()->error('Invitation service provider endpoint is unknown.', ['app' => InvitationApp::APP_NAME]); - return new RedirectResponse($urlGenerator->linkToRoute(InvitationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_ERROR])); + \OC::$server->getLogger()->error('Invitation service provider endpoint is unknown.', ['app' => CollaborationApp::APP_NAME]); + return new RedirectResponse($urlGenerator->linkToRoute(CollaborationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_ERROR])); } // check if invitation doesn't already exists @@ -397,17 +397,17 @@ public function handleInvite(string $token = '', string $providerEndpoint = ''): if ($invitation->getStatus() === Invitation::STATUS_OPEN) { // redirect to the open invitation - return new RedirectResponse($urlGenerator->linkToRoute('invitation.invitation.index')); + return new RedirectResponse($urlGenerator->linkToRoute(CollaborationApp::APP_NAME . '.index')); } if ($invitation->getStatus() === Invitation::STATUS_ACCEPTED) { - return new RedirectResponse($urlGenerator->linkToRoute(InvitationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_ALREADY_ACCEPTED, 'param1' => $invitation->getSenderName()])); + return new RedirectResponse($urlGenerator->linkToRoute(CollaborationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_ALREADY_ACCEPTED, 'param1' => $invitation->getSenderName()])); } - return new RedirectResponse($urlGenerator->linkToRoute(InvitationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_EXISTS, 'param1' => $this->il10n->t($invitation->getStatus())])); + return new RedirectResponse($urlGenerator->linkToRoute(CollaborationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_EXISTS, 'param1' => $this->il10n->t($invitation->getStatus())])); } catch (NotFoundException $e) { // we're good to go } catch (Exception $e) { - $this->logger->error($e->getMessage(), ['app' => InvitationApp::APP_NAME]); - return new RedirectResponse($urlGenerator->linkToRoute(InvitationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_ERROR])); + $this->logger->error($e->getMessage(), ['app' => CollaborationApp::APP_NAME]); + return new RedirectResponse($urlGenerator->linkToRoute(CollaborationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_ERROR])); } //retrieve the sender info @@ -415,11 +415,11 @@ public function handleInvite(string $token = '', string $providerEndpoint = ''): $httpClient = new HttpClient(); $response = $httpClient->curlGet($url); if ($response['success'] == false) { - $this->logger->error("Failed to retrieve the invitation with token $token from $providerEndpoint: " . print_r($response, true), ['app' => InvitationApp::APP_NAME]); - $this->logger->error($e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("Failed to retrieve the invitation with token $token from $providerEndpoint: " . print_r($response, true), ['app' => CollaborationApp::APP_NAME]); + $this->logger->error($e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new RedirectResponse( $urlGenerator->linkToRoute( - InvitationApp::APP_NAME . '.error.invitation', + CollaborationApp::APP_NAME . '.error.invitation', [ 'message' => AppError::GET_INVITE_ERROR ] @@ -431,10 +431,10 @@ public function handleInvite(string $token = '', string $providerEndpoint = ''): $data['status'] !== Invitation::STATUS_OPEN || $data['token'] !== $token ) { - $this->logger->error("Unable to handle invitation. /invite response from sender seems invalid. Response: " . print_r($response, true), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("Unable to handle invitation. /invite response from sender seems invalid. Response: " . print_r($response, true), ['app' => CollaborationApp::APP_NAME]); return new RedirectResponse( $urlGenerator->linkToRoute( - InvitationApp::APP_NAME . '.error.invitation', + CollaborationApp::APP_NAME . '.error.invitation', [ 'message' => AppError::HANDLE_INVITATION_INVALID_INVITELINK ] @@ -459,28 +459,28 @@ public function handleInvite(string $token = '', string $providerEndpoint = ''): try { $this->invitationService->insert($invitation); } catch (Exception $e) { - $this->logger->error($e->getMessage(), ['app' => InvitationApp::APP_NAME]); - return new RedirectResponse($urlGenerator->linkToRoute(InvitationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_ERROR])); + $this->logger->error($e->getMessage(), ['app' => CollaborationApp::APP_NAME]); + return new RedirectResponse($urlGenerator->linkToRoute(CollaborationApp::APP_NAME . '.error.invitation', ['message' => AppError::HANDLE_INVITATION_ERROR])); } $manager = \OC::$server->getNotificationManager(); $notification = $manager->createNotification(); - $notification->setApp(InvitationApp::APP_NAME) + $notification->setApp(CollaborationApp::APP_NAME) // the user that has received the invite is logged in at this point ->setUser(\OC::$server->getUserSession()->getUser()->getUID()) ->setDateTime(new DateTime()) ->setObject(MeshRegistryService::PARAM_NAME_TOKEN, $token) - ->setSubject('invitation', [ + ->setSubject('collaboration', [ MeshRegistryService::PARAM_NAME_TOKEN => $token, MeshRegistryService::PARAM_NAME_PROVIDER_ENDPOINT => $providerEndpoint, MeshRegistryService::PARAM_NAME_NAME => $senderName, ]) - ->setLink($urlGenerator->linkToRoute('invitation.invitation.index')); + ->setLink($urlGenerator->linkToRoute(CollaborationApp::APP_NAME . '.invitation.index')); $manager->notify($notification); - return new RedirectResponse($urlGenerator->linkToRoute('invitation.invitation.index')); + return new RedirectResponse($urlGenerator->linkToRoute(CollaborationApp::APP_NAME . '.invitation.index')); } /** @@ -497,7 +497,7 @@ public function acceptInvite(string $token = ''): DataResponse { try { if ($token == '') { - $this->logger->error('acceptInvite: missing parameter token.', ['app' => InvitationApp::APP_NAME]); + $this->logger->error('acceptInvite: missing parameter token.', ['app' => CollaborationApp::APP_NAME]); return new DataResponse( ['success' => false, 'error_message' => AppError::REQUEST_MISSING_PARAMETER], Http::STATUS_NOT_FOUND @@ -508,7 +508,7 @@ public function acceptInvite(string $token = ''): DataResponse try { $invitation = $this->invitationService->findByToken($token); } catch (NotFoundException $e) { - $this->logger->error("acceptInvite: invitation not found for token '$token'", ['app' => InvitationApp::APP_NAME]); + $this->logger->error("acceptInvite: invitation not found for token '$token'", ['app' => CollaborationApp::APP_NAME]); return new DataResponse( ['success' => false, 'error_message' => AppError::INVITATION_NOT_FOUND], Http::STATUS_NOT_FOUND @@ -538,7 +538,7 @@ public function acceptInvite(string $token = ''): DataResponse $response = $httpClient->curlPost($url, $params); if (isset($response['success']) && $response['success'] == false) { - $this->logger->error('Failed to accept the invitation: /invite-accepted failed with response: ' . print_r($response, true), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Failed to accept the invitation: /invite-accepted failed with response: ' . print_r($response, true), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -549,7 +549,7 @@ public function acceptInvite(string $token = ''): DataResponse } // note: beware of the format of response of the OCM call, it has no 'data' field if ($this->verifiedInviteAcceptedResponse($response) == false) { - $this->logger->error('Failed to accept the invitation - returned fields not valid: ' . print_r($response, true), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Failed to accept the invitation - returned fields not valid: ' . print_r($response, true), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -573,7 +573,7 @@ public function acceptInvite(string $token = ''): DataResponse $existingInvitations = array_merge($existingInvitationsReceived, $existingInvitationsSent); if (count($existingInvitations) > 0) { foreach ($existingInvitations as $existingInvitation) { - $this->logger->debug("A previous invitation for remote user with name " . $response[MeshRegistryService::PARAM_NAME_NAME] . " was accepted already. Withdrawing that one", ['app' => InvitationApp::APP_NAME]); + $this->logger->debug("A previous invitation for remote user with name " . $response[MeshRegistryService::PARAM_NAME_NAME] . " was accepted already. Withdrawing that one", ['app' => CollaborationApp::APP_NAME]); $updateResult = $this->invitationService->update([ Schema::INVITATION_TOKEN => $existingInvitation->getToken(), Schema::INVITATION_STATUS => Invitation::STATUS_WITHDRAWN, @@ -602,7 +602,7 @@ public function acceptInvite(string $token = ''): DataResponse true ); if ($updateResult == false) { - $this->logger->error("Failed to handle /accept-invite (invitation with token '$token' could not be updated).", ['app' => InvitationApp::APP_NAME]); + $this->logger->error("Failed to handle /accept-invite (invitation with token '$token' could not be updated).", ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -621,7 +621,7 @@ public function acceptInvite(string $token = ''): DataResponse Http::STATUS_OK ); } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app]' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app]' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -725,7 +725,7 @@ public function declineInvite(string $token = ''): DataResponse Http::STATUS_NOT_FOUND, ); } catch (NotFoundException $e) { - $this->logger->error("declineInvite: invitation not found for token '$token'", ['app' => InvitationApp::APP_NAME]); + $this->logger->error("declineInvite: invitation not found for token '$token'", ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -734,7 +734,7 @@ public function declineInvite(string $token = ''): DataResponse Http::STATUS_NOT_FOUND, ); } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app]' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app]' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -758,12 +758,12 @@ private function removeInvitationNotification(string $token): void $manager = \OC::$server->getNotificationManager(); $notification = $manager->createNotification(); $notification - ->setApp(InvitationApp::APP_NAME) + ->setApp(CollaborationApp::APP_NAME) ->setUser(\OC::$server->getUserSession()->getUser()->getUID()) ->setObject(MeshRegistryService::PARAM_NAME_TOKEN, $token); $manager->markProcessed($notification); } catch (Exception $e) { - $this->logger->error('Remove notification failed: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Remove notification failed: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw $e; } } @@ -798,7 +798,7 @@ private function verifiedInviteAcceptedResponse(array $response): bool public function find(int $id = null): DataResponse { if (!isset($id)) { - $this->logger->error("find() - missing parameter 'id'.", ['app' => InvitationApp::APP_NAME]); + $this->logger->error("find() - missing parameter 'id'.", ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -816,7 +816,7 @@ public function find(int $id = null): DataResponse ] ); } catch (NotFoundException $e) { - $this->logger->error("invitation not found for id $id. Error: " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("invitation not found for id $id. Error: " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -828,7 +828,7 @@ public function find(int $id = null): DataResponse } /** - * example url: https://rd-1.nl/apps/invitation/find-all-invitations?fields=[{"status":"open"},{"status":"accepted"}] + * example url: https://rd-1.nl/apps/collaboration/find-all-invitations?fields=[{"status":"open"},{"status":"accepted"}] * * @NoAdminRequired * @NoCSRFRequired @@ -836,7 +836,7 @@ public function find(int $id = null): DataResponse public function findAll(string $fields = null): DataResponse { if (!isset($fields)) { - $this->logger->error("findAll() - missing parameter 'fields'.", ['app' => InvitationApp::APP_NAME]); + $this->logger->error("findAll() - missing parameter 'fields'.", ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -856,7 +856,7 @@ public function findAll(string $fields = null): DataResponse Http::STATUS_OK ); } catch (Exception $e) { - $this->logger->error('invitations not found for fields: ' . print_r($fields, true) . 'Error: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('invitations not found for fields: ' . print_r($fields, true) . 'Error: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -874,7 +874,7 @@ public function findAll(string $fields = null): DataResponse public function findByToken(string $token = null): DataResponse { if (!isset($token)) { - $this->logger->error("findByToken() - missing parameter 'token'.", ['app' => InvitationApp::APP_NAME]); + $this->logger->error("findByToken() - missing parameter 'token'.", ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -893,7 +893,7 @@ public function findByToken(string $token = null): DataResponse Http::STATUS_OK, ); } catch (NotFoundException $e) { - $this->logger->error("invitation not found for token '$token'. Error: " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("invitation not found for token '$token'. Error: " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -902,7 +902,7 @@ public function findByToken(string $token = null): DataResponse Http::STATUS_NOT_FOUND, ); } catch (Exception $e) { - $this->logger->error("invitation not found for token '$token'. Error: " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("invitation not found for token '$token'. Error: " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, diff --git a/lib/Controller/MeshRegistryController.php b/lib/Controller/MeshRegistryController.php index 820fbd5..85b713a 100644 --- a/lib/Controller/MeshRegistryController.php +++ b/lib/Controller/MeshRegistryController.php @@ -5,18 +5,18 @@ * */ -namespace OCA\Invitation\Controller; +namespace OCA\Collaboration\Controller; use Exception; -use OCA\Invitation\AppInfo\AppError; -use OCA\Invitation\AppInfo\InvitationApp; -use OCA\Invitation\Db\Schema; -use OCA\Invitation\Federation\InvitationServiceProvider; -use OCA\Invitation\HttpClient; -use OCA\Invitation\Service\ApplicationConfigurationException; -use OCA\Invitation\Service\MeshRegistry\MeshRegistryService; -use OCA\Invitation\Service\NotFoundException; -use OCA\Invitation\Service\ServiceException; +use OCA\Collaboration\AppInfo\AppError; +use OCA\Collaboration\AppInfo\CollaborationApp; +use OCA\Collaboration\Db\Schema; +use OCA\Collaboration\Federation\InvitationServiceProvider; +use OCA\Collaboration\HttpClient; +use OCA\Collaboration\Service\ApplicationConfigurationException; +use OCA\Collaboration\Service\MeshRegistry\MeshRegistryService; +use OCA\Collaboration\Service\NotFoundException; +use OCA\Collaboration\Service\ServiceException; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; @@ -54,10 +54,10 @@ public function forwardInvite(string $token = '', string $providerEndpoint = '') $urlGenerator = \OC::$server->getURLGenerator(); if ($token == '') { - \OC::$server->getLogger()->error('Invite is missing the token.', ['app' => InvitationApp::APP_NAME]); + \OC::$server->getLogger()->error('Invite is missing the token.', ['app' => CollaborationApp::APP_NAME]); return new RedirectResponse( $urlGenerator->linkToRoute( - InvitationApp::APP_NAME . '.error.invitation', + CollaborationApp::APP_NAME . '.error.invitation', [ 'message' => AppError::HANDLE_INVITATION_MISSING_TOKEN ] @@ -65,10 +65,10 @@ public function forwardInvite(string $token = '', string $providerEndpoint = '') ); } if ($providerEndpoint == '') { - \OC::$server->getLogger()->error('Invite is missing the invitation service provider endpoint.', ['app' => InvitationApp::APP_NAME]); + \OC::$server->getLogger()->error('Invite is missing the invitation service provider endpoint.', ['app' => CollaborationApp::APP_NAME]); return new RedirectResponse( $urlGenerator->linkToRoute( - InvitationApp::APP_NAME . '.error.invitation', + CollaborationApp::APP_NAME . '.error.invitation', [ 'message' => AppError::HANDLE_INVITATION_MISSING_PROVIDER_ENDPOINT ] @@ -76,10 +76,10 @@ public function forwardInvite(string $token = '', string $providerEndpoint = '') ); } if (!$this->meshRegistryService->isKnowInvitationServiceProvider($providerEndpoint)) { - \OC::$server->getLogger()->error("Invitation service provider endpoint '$providerEndpoint' is unknown.", ['app' => InvitationApp::APP_NAME]); + \OC::$server->getLogger()->error("Invitation service provider endpoint '$providerEndpoint' is unknown.", ['app' => CollaborationApp::APP_NAME]); return new RedirectResponse( $urlGenerator->linkToRoute( - InvitationApp::APP_NAME . '.error.invitation', + CollaborationApp::APP_NAME . '.error.invitation', [ 'message' => AppError::HANDLE_INVITATION_PROVIDER_UNKNOWN ] @@ -116,7 +116,7 @@ public function invitationServiceProvider(): DataResponse Http::STATUS_OK, ); } catch (NotFoundException $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -153,7 +153,7 @@ public function updateInvitationServiceProvider(string $endpoint, string $name): $httpClient = new HttpClient(); $response = $httpClient->curlGet($url); if ($response['success'] == false) { - $this->logger->error('Failed to call ' . MeshRegistryService::ENDPOINT_INVITATION_SERVICE_PROVIDER . " on endpoint '$endpoint'. Response: " . print_r($response, true), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Failed to call ' . MeshRegistryService::ENDPOINT_INVITATION_SERVICE_PROVIDER . " on endpoint '$endpoint'. Response: " . print_r($response, true), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException("Failed to call endpoint '$endpoint'"); } @@ -167,7 +167,7 @@ public function updateInvitationServiceProvider(string $endpoint, string $name): Http::STATUS_OK, ); } catch (Exception $e) { - $this->logger->error($e->getMessage() . " Trace: " . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . " Trace: " . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -197,7 +197,7 @@ public function invitationServiceProviders(): DataResponse Http::STATUS_OK, ); } catch (ServiceException $e) { - $this->logger->error($e, ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e, ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -256,7 +256,7 @@ public function addInvitationServiceProvider(string $endpoint): DataResponse $httpClient = new HttpClient(); $response = $httpClient->curlGet($url); if ($response['success'] == false) { - $this->logger->error('Failed to call ' . MeshRegistryService::ENDPOINT_INVITATION_SERVICE_PROVIDER . " on endpoint '$endpoint'. Response: " . print_r($response, true), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Failed to call ' . MeshRegistryService::ENDPOINT_INVITATION_SERVICE_PROVIDER . " on endpoint '$endpoint'. Response: " . print_r($response, true), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException("Failed to call endpoint '$endpoint'"); } @@ -281,7 +281,7 @@ public function addInvitationServiceProvider(string $endpoint): DataResponse throw new ServiceException(AppError::MESH_REGISTRY_ENDPOINT_INVITATION_SERVICE_PROVIDER_RESPONSE_INVALID); } catch (ServiceException $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); // try to delete the previously inserted new provider $this->meshRegistryService->deleteInvitationServiceProvider($endpoint); return new DataResponse( @@ -292,7 +292,7 @@ public function addInvitationServiceProvider(string $endpoint): DataResponse Http::STATUS_NOT_FOUND, ); } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); // final effort trying to delete the previously inserted new provider $this->meshRegistryService->deleteInvitationServiceProvider($endpoint); return new DataResponse( @@ -321,7 +321,7 @@ private function verifyInvitationServiceProviderResponse(array $params): bool ) { return true; } - $this->logger->error('Could not validate the response fields. Fields: ' . print_r($params, true), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Could not validate the response fields. Fields: ' . print_r($params, true), ['app' => CollaborationApp::APP_NAME]); return false; } @@ -344,7 +344,7 @@ public function deleteInvitationServiceProvider(string $endpoint): DataResponse Http::STATUS_OK, ); } catch (ServiceException $e) { - $this->logger->error($e, ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e, ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -375,7 +375,7 @@ public function setAllowSharingWithInvitedUsersOnly(bool $allow): DataResponse Http::STATUS_OK ); } catch (Exception $e) { - $this->logger->error("Unable to set 'allow_sharing_with_invited_users_only' config param. " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("Unable to set 'allow_sharing_with_invited_users_only' config param. " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -436,7 +436,7 @@ public function setEndpoint(string $endpoint): DataResponse Http::STATUS_OK, ); } catch (ServiceException $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -497,7 +497,7 @@ public function setName(string $name): DataResponse Http::STATUS_OK, ); } catch (ServiceException $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -527,7 +527,7 @@ public function getAllowSharingWithInvitedUsersOnly(): DataResponse Http::STATUS_OK ); } catch (Exception $e) { - $this->logger->error("Unable to get 'allow_sharing_with_invited_users_only' config param. " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("Unable to get 'allow_sharing_with_invited_users_only' config param. " . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, diff --git a/lib/Controller/OcmController.php b/lib/Controller/OcmController.php index 71ad67a..ddf8bb3 100644 --- a/lib/Controller/OcmController.php +++ b/lib/Controller/OcmController.php @@ -4,15 +4,15 @@ * OCM controller */ -namespace OCA\Invitation\Controller; +namespace OCA\Collaboration\Controller; -use OCA\Invitation\AppInfo\InvitationApp; -use OCA\Invitation\AppInfo\AppError; -use OCA\Invitation\Db\Schema; -use OCA\Invitation\Federation\Invitation; -use OCA\Invitation\Service\InvitationService; -use OCA\Invitation\Service\NotFoundException; -use OCA\Invitation\Service\ServiceException; +use OCA\Collaboration\AppInfo\CollaborationApp; +use OCA\Collaboration\AppInfo\AppError; +use OCA\Collaboration\Db\Schema; +use OCA\Collaboration\Federation\Invitation; +use OCA\Collaboration\Service\InvitationService; +use OCA\Collaboration\Service\NotFoundException; +use OCA\Collaboration\Service\ServiceException; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; @@ -108,7 +108,7 @@ public function inviteAccepted( try { $invitation = $this->invitationService->findByToken($token, false); } catch (NotFoundException $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -117,7 +117,7 @@ public function inviteAccepted( Http::STATUS_NOT_FOUND ); } catch (ServiceException $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, @@ -142,7 +142,7 @@ public function inviteAccepted( $existingInvitations = array_merge($existingInvitationsSent, $existingInvitationsReceived); if (count($existingInvitations) > 0) { foreach ($existingInvitations as $existingInvitation) { - $this->logger->debug("A previous established invitation relation exists. Withdrawing that one.", ['app' => InvitationApp::APP_NAME]); + $this->logger->debug("A previous established invitation relation exists. Withdrawing that one.", ['app' => CollaborationApp::APP_NAME]); $updateResult = $this->invitationService->update([ Schema::INVITATION_TOKEN => $existingInvitation->getToken(), Schema::INVITATION_STATUS => Invitation::STATUS_WITHDRAWN, @@ -169,7 +169,7 @@ public function inviteAccepted( Schema::VINVITATION_STATUS => Invitation::STATUS_ACCEPTED, ], false); if ($updateResult == false) { - $this->logger->error("Update failed for invitation with token '$token'", ['app' => InvitationApp::APP_NAME]); + $this->logger->error("Update failed for invitation with token '$token'", ['app' => CollaborationApp::APP_NAME]); return new DataResponse( [ 'success' => false, diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index e9860b6..6fa0813 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -4,13 +4,13 @@ * Page controller */ -namespace OCA\Invitation\Controller; +namespace OCA\Collaboration\Controller; use Exception; -use OCA\Invitation\AppInfo\AppError; -use OCA\Invitation\AppInfo\InvitationApp; -use OCA\Invitation\Service\MeshRegistry\MeshRegistryService; -use OCA\Invitation\Service\ServiceException; +use OCA\Collaboration\AppInfo\AppError; +use OCA\Collaboration\AppInfo\CollaborationApp; +use OCA\Collaboration\Service\MeshRegistry\MeshRegistryService; +use OCA\Collaboration\Service\ServiceException; use OCP\AppFramework\Controller; use OCP\ILogger; use OCP\IRequest; @@ -44,16 +44,16 @@ public function wayf(string $token, string $providerEndpoint): void if (sizeof($wayfItems) == 0) { throw new ServiceException(AppError::WAYF_NO_PROVIDERS_FOUND); } - $l = \OC::$server->getL10NFactory()->findLanguage(InvitationApp::APP_NAME); - $tmpl = new Template('invitation', "wayf/wayf", '', false, $l); + $l = \OC::$server->getL10NFactory()->findLanguage(CollaborationApp::APP_NAME); + $tmpl = new Template('collaboration', "wayf/wayf", '', false, $l); $tmpl->assign('wayfItems', $wayfItems); echo $tmpl->fetchPage(); } catch (ServiceException $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); $html = '
' . $e->getMessage() . '
'; echo $html; } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); $html = '
' . AppError::WAYF_ERROR . '
'; echo $html; } @@ -103,7 +103,7 @@ private function getWayfItems(string $token, string $providerEndpoint): array } return $wayfItems; } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException(AppError::WAYF_ERROR); } } diff --git a/lib/Controller/RemoteUserController.php b/lib/Controller/RemoteUserController.php index 83f2026..2aeeea6 100644 --- a/lib/Controller/RemoteUserController.php +++ b/lib/Controller/RemoteUserController.php @@ -5,11 +5,11 @@ * */ -namespace OCA\Invitation\Controller; +namespace OCA\Collaboration\Controller; use Exception; -use OCA\Invitation\Service\NotFoundException; -use OCA\Invitation\Service\RemoteUserService; +use OCA\Collaboration\Service\NotFoundException; +use OCA\Collaboration\Service\RemoteUserService; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; diff --git a/lib/Db/Schema.php b/lib/Db/Schema.php index 1dd589a..840d3a4 100644 --- a/lib/Db/Schema.php +++ b/lib/Db/Schema.php @@ -4,14 +4,14 @@ * Database schema table names. */ -namespace OCA\Invitation\Db; +namespace OCA\Collaboration\Db; class Schema { public const ID = 'id'; /* Invitations table */ - public const TABLE_INVITATIONS = 'invitation_invitations'; + public const TABLE_INVITATIONS = 'collaboration_invitations'; public const INVITATION_USER_CLOUD_ID = 'user_cloud_id'; public const INVITATION_TOKEN = 'token'; @@ -27,7 +27,7 @@ class Schema public const INVITATION_STATUS = 'status'; /* Invitations view */ - public const VIEW_INVITATIONS = 'invitation_view_invitations'; + public const VIEW_INVITATIONS = 'collaboration_view_invitations'; public const VINVITATION_TOKEN = 'token'; public const VINVITATION_TIMESTAMP = 'timestamp'; @@ -49,7 +49,7 @@ class Schema public const VINVITATION_REMOTE_USER_PROVIDER_NAME = 'remote_user_provider_name'; /* Remote Users view */ - public const VIEW_REMOTEUSERS = 'invitation_view_remote_users'; + public const VIEW_REMOTEUSERS = 'collaboration_view_remote_users'; public const REMOTEUSER_INVITATION_ID = 'invitation_id'; public const REMOTEUSER_USER_CLOUD_ID = 'user_cloud_id'; @@ -61,7 +61,7 @@ class Schema public const REMOTEUSER_REMOTE_USER_PROVIDER_NAME = 'remote_user_provider_name'; /* Invitation service providers table */ - public const TABLE_INVITATION_SERVICE_PROVIDERS = 'invitation_invitation_service_providers'; + public const TABLE_INVITATION_SERVICE_PROVIDERS = 'collaboration_invitation_service_providers'; public const INVITATION_SERVICE_PROVIDER_DOMAIN = 'domain'; public const INVITATION_SERVICE_PROVIDER_ENDPOINT = 'endpoint'; diff --git a/lib/Federation/Invitation.php b/lib/Federation/Invitation.php index 8eb9cf4..265b2c4 100644 --- a/lib/Federation/Invitation.php +++ b/lib/Federation/Invitation.php @@ -5,10 +5,10 @@ * */ -namespace OCA\Invitation\Federation; +namespace OCA\Collaboration\Federation; use JsonSerializable; -use OCA\Invitation\Db\Schema; +use OCA\Collaboration\Db\Schema; use OCP\AppFramework\Db\Entity; /** diff --git a/lib/Federation/InvitationMapper.php b/lib/Federation/InvitationMapper.php index 10c25e0..ca727d8 100644 --- a/lib/Federation/InvitationMapper.php +++ b/lib/Federation/InvitationMapper.php @@ -1,13 +1,13 @@ getVInvitation($result); } } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new NotFoundException($e->getMessage()); } throw new NotFoundException("Invitation not found for token $token"); @@ -155,7 +155,7 @@ public function updateInvitation(array $fieldsAndValues, string $userCloudID = ' } } } catch (Exception $e) { - $this->logger->error('updateInvitation failed with error: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('updateInvitation failed with error: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); } return false; } @@ -176,7 +176,7 @@ public function deleteForStatus(array $statuses): void $qb->setParameter(Schema::INVITATION_STATUS, $statuses, IQueryBuilder::PARAM_STR_ARRAY); $qb->execute(); } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new Exception('An error occurred trying to delete invitations.'); } } @@ -198,7 +198,7 @@ public function deleteExpiredOpenInvitation(int $expirationPeriod) $qb->setParameter('time', $time, IQueryBuilder::PARAM_INT); $qb->execute(); } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new Exception('An error occurred trying to delete open invitations.'); } } @@ -234,7 +234,7 @@ private function getVInvitation(array $associativeArray): VInvitation $invitation->setRemoteUserProviderName($associativeArray[Schema::VINVITATION_REMOTE_USER_PROVIDER_NAME]); return $invitation; } - $this->logger->error('Unable to create a new Invitation from associative array: ' . print_r($associativeArray, true), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Unable to create a new Invitation from associative array: ' . print_r($associativeArray, true), ['app' => CollaborationApp::APP_NAME]); return null; } diff --git a/lib/Federation/InvitationServiceProvider.php b/lib/Federation/InvitationServiceProvider.php index 0ef803a..b154d2a 100644 --- a/lib/Federation/InvitationServiceProvider.php +++ b/lib/Federation/InvitationServiceProvider.php @@ -5,10 +5,10 @@ * */ -namespace OCA\Invitation\Federation; +namespace OCA\Collaboration\Federation; use JsonSerializable; -use OCA\Invitation\Db\Schema; +use OCA\Collaboration\Db\Schema; use OCP\AppFramework\Db\Entity; /** diff --git a/lib/Federation/InvitationServiceProviderMapper.php b/lib/Federation/InvitationServiceProviderMapper.php index 648134f..0f01dfb 100644 --- a/lib/Federation/InvitationServiceProviderMapper.php +++ b/lib/Federation/InvitationServiceProviderMapper.php @@ -4,12 +4,12 @@ * The invitation service provider mapper. */ -namespace OCA\Invitation\Federation; +namespace OCA\Collaboration\Federation; use Exception; -use OCA\Invitation\AppInfo\InvitationApp; -use OCA\Invitation\Db\Schema; -use OCA\Invitation\Service\NotFoundException; +use OCA\Collaboration\AppInfo\CollaborationApp; +use OCA\Collaboration\Db\Schema; +use OCA\Collaboration\Service\NotFoundException; use OCP\AppFramework\Db\Mapper; use OCP\IDBConnection; use OCP\ILogger; @@ -44,7 +44,7 @@ public function getInvitationServiceProvider(string $endpoint): InvitationServic } throw new NotFoundException("Error retrieving the invitation service provider with endpoint '$endpoint'"); } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new NotFoundException("Error retrieving the endpoint provider with endpoint '$endpoint'"); } } @@ -63,7 +63,7 @@ public function allInvitationServiceProviders(): array ->from(Schema::TABLE_INVITATION_SERVICE_PROVIDERS, 'dp'); return $this->createInvitationServiceProviders($qb->execute()->fetchAllAssociative()); } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new NotFoundException('Error retrieving all invitation service providers'); } } @@ -83,7 +83,7 @@ private function createInvitationServiceProvider(array $associativeArray): Invit $invitationServiceProvider->setName($associativeArray[Schema::INVITATION_SERVICE_PROVIDER_NAME]); return $invitationServiceProvider; } - $this->logger->error('Unable to create a new InvitationServiceProvider from associative array: ' . print_r($associativeArray, true), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Unable to create a new InvitationServiceProvider from associative array: ' . print_r($associativeArray, true), ['app' => CollaborationApp::APP_NAME]); return null; } diff --git a/lib/Federation/RemoteUser.php b/lib/Federation/RemoteUser.php index ee28c9f..e4eac23 100644 --- a/lib/Federation/RemoteUser.php +++ b/lib/Federation/RemoteUser.php @@ -5,10 +5,10 @@ * */ -namespace OCA\Invitation\Federation; +namespace OCA\Collaboration\Federation; use JsonSerializable; -use OCA\Invitation\Db\Schema; +use OCA\Collaboration\Db\Schema; use OCP\AppFramework\Db\Entity; /** diff --git a/lib/Federation/RemoteUserMapper.php b/lib/Federation/RemoteUserMapper.php index faf38ce..b85e54f 100644 --- a/lib/Federation/RemoteUserMapper.php +++ b/lib/Federation/RemoteUserMapper.php @@ -4,12 +4,12 @@ * Mapper for remote users. */ -namespace OCA\Invitation\Federation; +namespace OCA\Collaboration\Federation; use Exception; -use OCA\Invitation\AppInfo\InvitationApp; -use OCA\Invitation\Db\Schema; -use OCA\Invitation\Service\NotFoundException; +use OCA\Collaboration\AppInfo\CollaborationApp; +use OCA\Collaboration\Db\Schema; +use OCA\Collaboration\Service\NotFoundException; use OCP\AppFramework\Db\Mapper; use OCP\IDBConnection; use OCP\ILogger; @@ -52,7 +52,7 @@ public function search(string $search): array try { $remoteUsers = $this->createRemoteUsers($query->execute()->fetchAllAssociative()); } catch (Exception $e) { - $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new Exception("Error searching for remote users with search string '$search'"); } return $remoteUsers; @@ -85,7 +85,7 @@ public function getRemoteUser(string $cloudID): RemoteUser } return $remoteUser; } catch (Exception $e) { - $this->logger->error("Could not retrieve remote user with cloudID '$cloudID'. Stack trace: " . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("Could not retrieve remote user with cloudID '$cloudID'. Stack trace: " . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw $e; } } diff --git a/lib/Federation/VInvitation.php b/lib/Federation/VInvitation.php index ba3178a..d5841a6 100644 --- a/lib/Federation/VInvitation.php +++ b/lib/Federation/VInvitation.php @@ -5,10 +5,10 @@ * */ -namespace OCA\Invitation\Federation; +namespace OCA\Collaboration\Federation; use JsonSerializable; -use OCA\Invitation\Db\Schema; +use OCA\Collaboration\Db\Schema; use OCP\AppFramework\Db\Entity; /** diff --git a/lib/HttpClient.php b/lib/HttpClient.php index 97b3e2f..fc67163 100644 --- a/lib/HttpClient.php +++ b/lib/HttpClient.php @@ -1,9 +1,9 @@ invitationService->deleteExpiredOpenInvitation(2592000); } catch (ServiceException $e) { - $this->logger->error($e->getMessage(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage(), ['app' => CollaborationApp::APP_NAME]); } } } diff --git a/lib/Service/ApplicationConfigurationException.php b/lib/Service/ApplicationConfigurationException.php index 44b7e1c..935a569 100644 --- a/lib/Service/ApplicationConfigurationException.php +++ b/lib/Service/ApplicationConfigurationException.php @@ -1,6 +1,6 @@ getApp() != InvitationApp::APP_NAME) { + if ($notification->getApp() != CollaborationApp::APP_NAME) { $this->logger->error("Notification has been given the wrong app name '" . $notification->getApp() . "'"); throw new \InvalidArgumentException("Wrong app"); } switch ($notification->getSubject()) { - case 'invitation': + case 'collaboration': $notification->setParsedSubject( (string) $this->il10n->t( "notification", diff --git a/lib/Service/InvitationService.php b/lib/Service/InvitationService.php index 55fb93a..0aebbc1 100644 --- a/lib/Service/InvitationService.php +++ b/lib/Service/InvitationService.php @@ -1,13 +1,13 @@ getUserSession()->getUser()->getCloudId() === $invitation->getUserCloudID()) { return $invitation; } - $this->logger->debug("User with cloud id '" . \OC::$server->getUserSession()->getUser()->getCloudId() . "' is not authorized to access invitation with id '$id'.", ['app' => InvitationApp::APP_NAME]); + $this->logger->debug("User with cloud id '" . \OC::$server->getUserSession()->getUser()->getCloudId() . "' is not authorized to access invitation with id '$id'.", ['app' => CollaborationApp::APP_NAME]); throw new NotFoundException("Invitation with id=$id not found."); } catch (NotFoundException $e) { - $this->logger->debug($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->debug($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new NotFoundException("Invitation with id=$id not found."); } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new NotFoundException("Invitation with id=$id not found."); } } @@ -65,7 +65,7 @@ public function findByToken(string $token, bool $loginRequired = true): VInvitat try { $invitation = $this->mapper->findByToken($token); } catch (NotFoundException $e) { - $this->logger->error("Invitation not found for token '$token'.", ['app' => InvitationApp::APP_NAME]); + $this->logger->error("Invitation not found for token '$token'.", ['app' => CollaborationApp::APP_NAME]); throw new NotFoundException("An exception occurred trying to retrieve the invitation with token '$token'."); } if ($loginRequired == true && \OC::$server->getUserSession()->getUser() == null) { @@ -97,7 +97,7 @@ public function findAll(array $criteria, bool $loginRequired = true): array } return $this->mapper->findAll($criteria); } catch (Exception $e) { - $this->logger->error('findAll failed with error: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('findAll failed with error: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException('Failed to find all invitations for the specified criteria.'); } } @@ -114,7 +114,7 @@ public function insert(Invitation $invitation): Invitation try { return $this->mapper->insert($invitation); } catch (Exception $e) { - $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException('Error inserting the invitation.'); } } @@ -130,7 +130,7 @@ public function update(array $fieldsAndValues, bool $loginRequired = true): bool { if ($loginRequired === true) { if (\OC::$server->getUserSession()->getUser() == null) { - $this->logger->debug('Unable to update invitation, unauthenticated.', ['app' => InvitationApp::APP_NAME]); + $this->logger->debug('Unable to update invitation, unauthenticated.', ['app' => CollaborationApp::APP_NAME]); return false; } return $this->mapper->updateInvitation($fieldsAndValues, \OC::$server->getUserSession()->getUser()->getCloudId()); diff --git a/lib/Service/MeshRegistry/MeshRegistryService.php b/lib/Service/MeshRegistry/MeshRegistryService.php index 35a36d8..ad50abf 100644 --- a/lib/Service/MeshRegistry/MeshRegistryService.php +++ b/lib/Service/MeshRegistry/MeshRegistryService.php @@ -5,17 +5,17 @@ * */ -namespace OCA\Invitation\Service\MeshRegistry; +namespace OCA\Collaboration\Service\MeshRegistry; use Exception; -use OCA\Invitation\AppInfo\InvitationApp; -use OCA\Invitation\Db\Schema; -use OCA\Invitation\Federation\InvitationServiceProvider; -use OCA\Invitation\Federation\InvitationServiceProviderMapper; -use OCA\Invitation\Service\ApplicationConfigurationException; -use OCA\Invitation\Service\InvitationService; -use OCA\Invitation\Service\NotFoundException; -use OCA\Invitation\Service\ServiceException; +use OCA\Collaboration\AppInfo\CollaborationApp; +use OCA\Collaboration\Db\Schema; +use OCA\Collaboration\Federation\InvitationServiceProvider; +use OCA\Collaboration\Federation\InvitationServiceProviderMapper; +use OCA\Collaboration\Service\ApplicationConfigurationException; +use OCA\Collaboration\Service\InvitationService; +use OCA\Collaboration\Service\NotFoundException; +use OCA\Collaboration\Service\ServiceException; use OCP\IConfig; use OCP\ILogger; @@ -71,7 +71,7 @@ public function getFullForwardInviteEndpoint() $forwardInviteEndpoint = trim(self::ENDPOINT_FORWARD_INVITE, "/"); return "$invitationServiceEndpoint/$forwardInviteEndpoint"; } catch (ServiceException $e) { - $this->logger->error("getFullForwardInviteEndpoint failed with error: " . $e->getMessage() . " Trace: " . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("getFullForwardInviteEndpoint failed with error: " . $e->getMessage() . " Trace: " . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException("Could not retrieve full '/forward-invite' endpoint."); } } @@ -99,7 +99,7 @@ public function getFullAcceptInviteEndpointURL(): string $acceptInviteEndpoint = trim(self::ENDPOINT_ACCEPT_INVITE, "/"); return "$invitationServiceEndpoint/$acceptInviteEndpoint"; } catch (ServiceException $e) { - $this->logger->error("getFullAcceptInviteEndpointURL failed with error: " . $e->getMessage() . " Trace: " . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("getFullAcceptInviteEndpointURL failed with error: " . $e->getMessage() . " Trace: " . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException("Could not retrieve full '/accept-invite' endpoint."); } } @@ -187,9 +187,9 @@ public function setEndpoint(string $endpoint): string $invitationServiceProvider->setEndpoint($endpoint); $invitationServiceProvider = $this->invitationServiceProviderMapper->update($invitationServiceProvider); } catch (NotFoundException $e) { - $this->logger->info("A local invitation service provider does not exist (yet). Setting the endpoint to '$endpoint'", ['app' => InvitationApp::APP_NAME]); + $this->logger->info("A local invitation service provider does not exist (yet). Setting the endpoint to '$endpoint'", ['app' => CollaborationApp::APP_NAME]); } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Stack: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Stack: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException("Unable to set the endpoint to '$endpoint'."); } $this->setAppValue('endpoint', $endpoint); @@ -239,7 +239,7 @@ public function addInvitationServiceProvider(InvitationServiceProvider $provider try { $invitationServiceProvider = $this->findInvitationServiceProvider($provider->getEndpoint()); } catch (NotFoundException $e) { - $this->logger->info("Creating invitation service provider with endpoint " . $provider->getEndpoint(), ['app' => InvitationApp::APP_NAME]); + $this->logger->info("Creating invitation service provider with endpoint " . $provider->getEndpoint(), ['app' => CollaborationApp::APP_NAME]); } if (isset($invitationServiceProvider)) { return $invitationServiceProvider; @@ -247,7 +247,7 @@ public function addInvitationServiceProvider(InvitationServiceProvider $provider try { return $this->invitationServiceProviderMapper->insert($provider); } catch (Exception $e) { - $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException('Error inserting the invitation service provider.'); } } @@ -323,7 +323,7 @@ public function updateInvitationServiceProvider($endpoint, $fields): InvitationS $this->setAppValue('endpoint', $newEndpoint); return $invitationServiceProvider; } catch (Exception $e) { - $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException("Error updating invitation service provider with endpoint '$endpoint'"); } } @@ -345,10 +345,10 @@ public function deleteInvitationServiceProvider(string $endpoint): InvitationSer } return $deletedEntity; } catch (NotFoundException $e) { - $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException('Error deleting the invitation service provider: Not found.'); } catch (Exception $e) { - $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException('Error deleting the invitation service provider.'); } } @@ -392,7 +392,7 @@ public function allInvitationServiceProviders(): array try { return $this->invitationServiceProviderMapper->allInvitationServiceProviders(); } catch (NotFoundException $e) { - $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException('Error retrieving all invitation service providers.'); } } @@ -427,10 +427,10 @@ public function setName(string $name): string $invitationServiceProvider = $this->invitationServiceProviderMapper->update($invitationServiceProvider); return $invitationServiceProvider->getName(); } catch (NotFoundException $e) { - $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException("Error updating invitation service provider: Not found"); } catch (Exception $e) { - $this->logger->error($e->getMessage() . ' Stack: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error($e->getMessage() . ' Stack: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException("Could not set name to '$name'."); } } @@ -455,8 +455,8 @@ public function getName(): string */ public function setAllowSharingWithInvitedUsersOnly(bool $allow): bool { - $this->setAppValue(InvitationApp::CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY, $allow ? 'yes' : 'no'); - return $this->getAppValue(InvitationApp::CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY) === 'yes'; + $this->setAppValue(CollaborationApp::CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY, $allow ? 'yes' : 'no'); + return $this->getAppValue(CollaborationApp::CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY) === 'yes'; } /** @@ -466,7 +466,7 @@ public function setAllowSharingWithInvitedUsersOnly(bool $allow): bool */ public function getAllowSharingWithInvitedUsersOnly(): bool { - return strtolower($this->getAppValue(InvitationApp::CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY)) === 'yes'; + return strtolower($this->getAppValue(CollaborationApp::CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY)) === 'yes'; } /** diff --git a/lib/Service/NotFoundException.php b/lib/Service/NotFoundException.php index ed28c2a..ebee402 100644 --- a/lib/Service/NotFoundException.php +++ b/lib/Service/NotFoundException.php @@ -1,6 +1,6 @@ config->getSystemValue('invitation.opencloudmeshRemoteShareesSearch', '\OCA\OpenCloudMesh\ShareeSearchPlugin'); if (class_exists($pluginClass)) { - $this->logger->debug(" - opencloudmesh app is installed, found remote sharees search implementation: $pluginClass", ['app' => InvitationApp::APP_NAME]); + $this->logger->debug(" - opencloudmesh app is installed, found remote sharees search implementation: $pluginClass", ['app' => CollaborationApp::APP_NAME]); try { $plugin = \OC::$server->query($pluginClass); $opencloudmeshResult = $plugin->search($search); @@ -78,10 +78,10 @@ public function search($search): array $opencloudmeshResult = array_values($opencloudmeshResult); } } catch (Exception $e) { - $this->logger->error("Error retrieving opencloudmesh sharee search results: " . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error("Error retrieving opencloudmesh sharee search results: " . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); } } else { - $this->logger->debug(" - skipping opencloudmesh remote sharees search, opemcloudmesh remote sharees search implementation not found: $pluginClass", ['app' => InvitationApp::APP_NAME]); + $this->logger->debug(" - skipping opencloudmesh remote sharees search, opemcloudmesh remote sharees search implementation not found: $pluginClass", ['app' => CollaborationApp::APP_NAME]); } $remoteUsers = $this->remoteUserMapper->search($search); @@ -114,7 +114,7 @@ public function search($search): array ] ]; if ( - Util::isTrue($this->config->getAppValue(InvitationApp::APP_NAME, InvitationApp::CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY)) === false + Util::isTrue($this->config->getAppValue(CollaborationApp::APP_NAME, CollaborationApp::CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY)) === false && strpos($search, '@') !== false && count($remoteUsers) < 1 ) { @@ -124,7 +124,7 @@ public function search($search): array // and merge and return the results return array_merge($result, $opencloudmeshResult); } catch (Exception $e) { - $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException('Error searching for remote users.'); } } @@ -143,7 +143,7 @@ public function getRemoteUser(string $cloudID): RemoteUser } catch (NotFoundException $e) { throw $e; } catch (Exception $e) { - $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]); + $this->logger->error('Message: ' . $e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => CollaborationApp::APP_NAME]); throw new ServiceException('Error retrieving remote user.'); } } diff --git a/lib/Service/ServiceException.php b/lib/Service/ServiceException.php index ab6fcb0..9740d5f 100644 --- a/lib/Service/ServiceException.php +++ b/lib/Service/ServiceException.php @@ -1,6 +1,6 @@ meshRegistryService->getInvitationServiceProvider(); $template->assign('endpoint', $invitationServiceProvider->getEndpoint()); @@ -38,7 +38,7 @@ public function getPanel() $template->assign('endpoint', ''); $template->assign('name', ''); } - $template->assign(InvitationApp::CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY, $this->meshRegistryService->getAllowSharingWithInvitedUsersOnly()); + $template->assign(CollaborationApp::CONFIG_ALLOW_SHARING_WITH_INVITED_USERS_ONLY, $this->meshRegistryService->getAllowSharingWithInvitedUsersOnly()); return $template; } diff --git a/lib/Util.php b/lib/Util.php index 6b53911..6fa2166 100644 --- a/lib/Util.php +++ b/lib/Util.php @@ -1,6 +1,6 @@ getURLGenerator(); ?> diff --git a/templates/invitation.index.php b/templates/invitation.index.php index 62d32e4..7df2c01 100644 --- a/templates/invitation.index.php +++ b/templates/invitation.index.php @@ -1,20 +1,20 @@ -
- +
+
- +
diff --git a/templates/settings/admin.php b/templates/settings/admin.php index 270e55f..e632eaa 100644 --- a/templates/settings/admin.php +++ b/templates/settings/admin.php @@ -1,14 +1,14 @@ +style($appName, 'collaboration'); ?>

Invitation Service

diff --git a/templates/wayf/wayf.php b/templates/wayf/wayf.php index 4da98e5..1b3699e 100644 --- a/templates/wayf/wayf.php +++ b/templates/wayf/wayf.php @@ -2,8 +2,8 @@ <?php p($l->t("Select your institution to log in")); ?> - - + + diff --git a/tests/docker/docker-compose-local.yaml b/tests/docker/docker-compose-local.yaml index 39545d9..255e7f7 100644 --- a/tests/docker/docker-compose-local.yaml +++ b/tests/docker/docker-compose-local.yaml @@ -178,9 +178,6 @@ services: context: . dockerfile: nginx-proxy-1-2/Dockerfile container_name: nginx-proxy-1-2 - volumes: - - ~/projects/rd-mesh-app/tests/docker/oc-1/oc-1.nl/certs:/etc/nginx/certs/oc-1 - - ~/projects/rd-mesh-app/tests/docker/oc-2/oc-2.nl/certs:/etc/nginx/certs/oc-2 depends_on: - oc-1 - oc-2 diff --git a/tests/docker/integration-tests/Dockerfile b/tests/docker/integration-tests/Dockerfile index f6067a5..a0fec9b 100644 --- a/tests/docker/integration-tests/Dockerfile +++ b/tests/docker/integration-tests/Dockerfile @@ -32,8 +32,8 @@ WORKDIR / # - fixed paths because it's unclear to me what the correct user (context) is. # - we give OC some time to setup the database -# RUN mkdir -p /tmp/apps/invitation/tests \ -# && touch /tmp/apps/invitation/tests/run-test.sh \ -# && echo '#!/bin/sh' >> /tmp/apps/invitation/tests/run-test.sh \ -# && sed -i -e '$a echo sleeping 20s ... giving oc the time to setup db && sleep 20 && curl -vv https://oc-1.nl' /tmp/apps/invitation/tests/run-test.sh -# # && sed -i -e '$a curl -vv https://oc-1.nl/apps/invitation/registry/invitation-service-provider' /tmp/apps/invitation/tests/run-test.sh +# RUN mkdir -p /tmp/apps/collaboration/tests \ +# && touch /tmp/apps/collaboration/tests/run-test.sh \ +# && echo '#!/bin/sh' >> /tmp/apps/collaboration/tests/run-test.sh \ +# && sed -i -e '$a echo sleeping 20s ... giving oc the time to setup db && sleep 20 && curl -vv https://oc-1.nl' /tmp/apps/collaboration/tests/run-test.sh +# # && sed -i -e '$a curl -vv https://oc-1.nl/apps/collaboration/registry/invitation-service-provider' /tmp/apps/collaboration/tests/run-test.sh diff --git a/tests/docker/integration-tests/Version20231130125301.php b/tests/docker/integration-tests/Version20240718000001.php similarity index 59% rename from tests/docker/integration-tests/Version20231130125301.php rename to tests/docker/integration-tests/Version20240718000001.php index eedcf8c..b64bbec 100644 --- a/tests/docker/integration-tests/Version20231130125301.php +++ b/tests/docker/integration-tests/Version20240718000001.php @@ -1,6 +1,6 @@ execute(); diff --git a/tests/docker/integration-tests/Version20231130125302.php b/tests/docker/integration-tests/Version20240718000002.php similarity index 59% rename from tests/docker/integration-tests/Version20231130125302.php rename to tests/docker/integration-tests/Version20240718000002.php index 2b9309f..3d5b965 100644 --- a/tests/docker/integration-tests/Version20231130125302.php +++ b/tests/docker/integration-tests/Version20240718000002.php @@ -1,6 +1,6 @@ execute(); diff --git a/tests/docker/integration-tests/src/composer.json b/tests/docker/integration-tests/src/composer.json index 677c46f..023fa00 100644 --- a/tests/docker/integration-tests/src/composer.json +++ b/tests/docker/integration-tests/src/composer.json @@ -1,6 +1,6 @@ { "name": "surf/oc-invitation-tests", - "description": "Testing the Invitation app", + "description": "Testing the Collaboration app", "type": "project", "license": "MIT", "config": { diff --git a/tests/docker/integration-tests/src/tests/ExternalApiRoute.php b/tests/docker/integration-tests/src/tests/ExternalApiRoute.php index 5fb2dce..2d605e8 100644 --- a/tests/docker/integration-tests/src/tests/ExternalApiRoute.php +++ b/tests/docker/integration-tests/src/tests/ExternalApiRoute.php @@ -1,8 +1,8 @@ getRequest()->getParams(); return new \OC\OCS\Result(call_user_func_array([$this->controller, $this->apiCall], $params)->getData()); }, - InvitationApp::APP_NAME + CollaborationApp::APP_NAME ); } @@ -58,7 +58,7 @@ function ($urlParameters) { $params = \OC::$server->getRequest()->getParams(); return new \OC\OCS\Result(call_user_func_array([$this->controller, $this->apiCall], $params)->getStatus()); }, - InvitationApp::APP_NAME + CollaborationApp::APP_NAME ); } } diff --git a/tests/docker/integration-tests/src/tests/integration/InvitationServiceProviderTest.php b/tests/docker/integration-tests/src/tests/integration/InvitationServiceProviderTest.php index 56705c9..36b6c58 100644 --- a/tests/docker/integration-tests/src/tests/integration/InvitationServiceProviderTest.php +++ b/tests/docker/integration-tests/src/tests/integration/InvitationServiceProviderTest.php @@ -9,9 +9,8 @@ class InvitationServiceProviderTest extends TestCase { - private const OC_1_PROTECTED_ENDPOINT = "https://admin:admin@oc-1.nl/ocs/v1.php/apps/invitation"; - private const OC_1_UNPROTECTED_ENDPOINT = "https://oc-1.nl/apps/invitation"; - private const OC_2_UNPROTECTED_ENDPOINT = "https://oc-2.nl/apps/invitation"; + private const OC_1_UNPROTECTED_ENDPOINT = "https://oc-1.nl/apps/collaboration"; + private const OC_2_UNPROTECTED_ENDPOINT = "https://oc-2.nl/apps/collaboration"; public function setUp(): void { @@ -45,7 +44,7 @@ public function testInvitationServiceProviderProperties() public function testInvitationServiceProviderName() { - // defined by the test data from Version20231130125301.php + // defined by the test data from Version20240718000001.php try { $invitationServiceProviderName = "OC 1 University"; $endpoint = self::OC_1_UNPROTECTED_ENDPOINT . "/registry/name"; diff --git a/tests/docker/integration-tests/src/tests/integration/InvitationTest.php b/tests/docker/integration-tests/src/tests/integration/InvitationTest.php index e08abc8..c3ef223 100644 --- a/tests/docker/integration-tests/src/tests/integration/InvitationTest.php +++ b/tests/docker/integration-tests/src/tests/integration/InvitationTest.php @@ -3,7 +3,6 @@ namespace tests\integration; use Exception; -use OCA\Invitation\Service\MeshRegistry\MeshRegistryService; use PHPUnit\Framework\TestCase; use Ramsey\Uuid\Uuid; use tests\util\AppError; @@ -12,9 +11,9 @@ class InvitationTest extends TestCase { - private const OC_1_ENDPOINT = "https://admin:admin@oc-1.nl/ocs/v1.php/apps/invitation"; - private const OC_1_INVITATION_SERVICE_ENDPOINT = "https://oc-1.nl/apps/invitation"; - private const OC_2_ENDPOINT = "https://admin:admin@oc-2.nl/ocs/v1.php/apps/invitation"; + private const OC_1_ENDPOINT = "https://admin:admin@oc-1.nl/ocs/v1.php/apps/collaboration"; + private const OC_1_INVITATION_SERVICE_ENDPOINT = "https://oc-1.nl/apps/collaboration"; + private const OC_2_ENDPOINT = "https://admin:admin@oc-2.nl/ocs/v1.php/apps/collaboration"; private const PARAM_NAME_EMAIL = "email"; private const PARAM_NAME_NAME = "name"; private const PARAM_NAME_SENDER_NAME = "senderName"; diff --git a/tests/docker/integration-tests/src/tests/routes.php b/tests/docker/integration-tests/src/tests/routes.php index 6bed893..9c0242a 100644 --- a/tests/docker/integration-tests/src/tests/routes.php +++ b/tests/docker/integration-tests/src/tests/routes.php @@ -7,21 +7,21 @@ * and renaming the original routes file to routes-main.php */ -use OCA\Invitation\AppInfo\InvitationApp; -use OCA\Invitation\Controller\InvitationController; -use OCA\Invitation\Controller\MeshRegistryController; -use OCA\Invitation\ExternalApiRoute; +use OCA\Collaboration\AppInfo\CollaborationApp; +use OCA\Collaboration\Controller\InvitationController; +use OCA\Collaboration\Controller\MeshRegistryController; +use OCA\Collaboration\ExternalApiRoute; -$meshRegistryService = \OC::$server->getAppContainer(InvitationApp::APP_NAME)->query('MeshRegistryService'); +$meshRegistryService = \OC::$server->getAppContainer(CollaborationApp::APP_NAME)->query('MeshRegistryService'); $meshRegistryController = new MeshRegistryController( - InvitationApp::APP_NAME, + CollaborationApp::APP_NAME, \OC::$server->getRequest(), $meshRegistryService ); -$invitationService = \OC::$server->getAppContainer(InvitationApp::APP_NAME)->query('InvitationService'); -$l10nService = \OC::$server->getAppContainer(InvitationApp::APP_NAME)->query('L10N'); +$invitationService = \OC::$server->getAppContainer(CollaborationApp::APP_NAME)->query('InvitationService'); +$l10nService = \OC::$server->getAppContainer(CollaborationApp::APP_NAME)->query('L10N'); $invitationController = new InvitationController( - InvitationApp::APP_NAME, + CollaborationApp::APP_NAME, \OC::$server->getRequest(), $meshRegistryService, $invitationService, @@ -31,40 +31,40 @@ new ExternalApiRoute( 'GET', - '/apps/invitation/registry/name', + '/apps/collaboration/registry/name', 'getName', $meshRegistryController ); new ExternalApiRoute( 'GET', - '/apps/invitation/registry/endpoint', + '/apps/collaboration/registry/endpoint', 'getEndpoint', $meshRegistryController ); new ExternalApiRoute( 'POST', - '/apps/invitation/generate-invite', + '/apps/collaboration/generate-invite', 'generateInvite', $invitationController ); new ExternalApiRoute( 'GET', - '/apps/invitation/find-invitation-by-token', + '/apps/collaboration/find-invitation-by-token', 'findByToken', $invitationController ); new ExternalApiRoute( 'GET', - '/apps/invitation/handle-invite', + '/apps/collaboration/handle-invite', 'handleInvite', $invitationController, true ); new ExternalApiRoute( 'GET', - '/apps/invitation/find-invitation-by-token', + '/apps/collaboration/find-invitation-by-token', 'findByToken', $invitationController ); diff --git a/tests/docker/integration-tests/tests.sh b/tests/docker/integration-tests/tests.sh index 7efa8f1..873a5ea 100644 --- a/tests/docker/integration-tests/tests.sh +++ b/tests/docker/integration-tests/tests.sh @@ -1,8 +1,8 @@ #!/bin/sh # start the actual tests -echo Start Invitation app integration tests -echo waiting for 60s ... giving owncloud time to startup && sleep 60 && +echo Start Collaboration app integration tests +echo waiting for 60s ... giving owncloud time to startup && sleep 20 && echo echo "Starting integration unit tests" cd /tmp/tests/src diff --git a/tests/docker/oc-1/10-collaboration-app.sh b/tests/docker/oc-1/10-collaboration-app.sh new file mode 100644 index 0000000..3862134 --- /dev/null +++ b/tests/docker/oc-1/10-collaboration-app.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# This script triggers installation of the Collaboration app right before server startup + +echo 'Install Collaboration app' +occ app:enable collaboration diff --git a/tests/docker/oc-1/10-invitation-app.sh b/tests/docker/oc-1/10-invitation-app.sh deleted file mode 100644 index 50def1f..0000000 --- a/tests/docker/oc-1/10-invitation-app.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -# This script triggers installation of the Invitation app right before server startup - -echo 'Install Invitation app' -occ app:enable invitation diff --git a/tests/docker/oc-1/Dockerfile-github b/tests/docker/oc-1/Dockerfile-github index 01557ef..c5c13eb 100644 --- a/tests/docker/oc-1/Dockerfile-github +++ b/tests/docker/oc-1/Dockerfile-github @@ -13,26 +13,26 @@ RUN echo 'rd-mesh/oc-1.pem' >> /etc/ca-certificates.conf \ && update-ca-certificates \ && export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt -# Add the Invitation app from branch, includes using the make buildapp-test target to simulate an actual release version +# Add the Collaboration app from branch, includes using the make buildapp-test target to simulate an actual release version # And install the data migration file required for the tests # And install the pre start server script that activates the app -RUN mkdir -p /tmp/invitation \ - && git clone -b ${BRANCH} https://github.com/sara-nl/oc-invitation.git /tmp/invitation +RUN mkdir -p /tmp/collaboration \ + && git clone -b ${BRANCH} https://github.com/sara-nl/oc-invitation.git /tmp/collaboration -RUN cd /tmp/invitation \ +RUN cd /tmp/collaboration \ && make -e version=test buildapp-tests \ - && tar -xvf /tmp/invitation/build/artifacts/app/invitation_test.tar.gz -C /var/www/owncloud/apps \ - && cd /var/www/owncloud/apps/invitation \ + && tar -xvf /tmp/collaboration/build/artifacts/app/collaboration_test.tar.gz -C /var/www/owncloud/apps \ + && cd /var/www/owncloud/apps/collaboration \ && composer install \ - && cp /var/www/owncloud/apps/invitation/tests/docker/integration-tests/Version20231130125301.php /var/www/owncloud/apps/invitation/appinfo/Migrations \ - && cp /var/www/owncloud/apps/invitation/tests/docker/oc-1/10-invitation-app.sh /etc/pre_server.d \ - && mv /var/www/owncloud/apps/invitation/appinfo/routes.php /var/www/owncloud/apps/invitation/appinfo/routes-main.php \ - && cp /var/www/owncloud/apps/invitation/tests/docker/integration-tests/src/tests/routes.php /var/www/owncloud/apps/invitation/appinfo/routes.php \ - && cp /var/www/owncloud/apps/invitation/tests/docker/integration-tests/src/tests/ExternalApiRoute.php /var/www/owncloud/apps/invitation/lib/ExternalApiRoute.php - -# RUN chown -R www-data:root /var/www/owncloud/apps/invitation \ -# RUN cp /var/www/owncloud/apps/invitation/tests/docker/oc-1/10-invitation-app.sh /etc/pre_server.d \ -# && cp /var/www/owncloud/apps/invitation/tests/docker/oc-1/InvitationApp.php /var/www/owncloud/apps/invitation/lib/AppInfo/InvitationApp.php + && cp /var/www/owncloud/apps/collaboration/tests/docker/integration-tests/Version20240718000001.php /var/www/owncloud/apps/collaboration/appinfo/Migrations \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/oc-1/10-collaboration-app.sh /etc/pre_server.d \ + && mv /var/www/owncloud/apps/collaboration/appinfo/routes.php /var/www/owncloud/apps/collaboration/appinfo/routes-main.php \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/integration-tests/src/tests/routes.php /var/www/owncloud/apps/collaboration/appinfo/routes.php \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/integration-tests/src/tests/ExternalApiRoute.php /var/www/owncloud/apps/collaboration/lib/ExternalApiRoute.php + +# RUN chown -R www-data:root /var/www/owncloud/apps/collaboration \ +# RUN cp /var/www/owncloud/apps/collaboration/tests/docker/oc-1/10-collaboration-app.sh /etc/pre_server.d \ +# && cp /var/www/owncloud/apps/collaboration/tests/docker/oc-1/CollaborationApp.php /var/www/owncloud/apps/collaboration/lib/AppInfo/CollaborationApp.php # && chown -R www-data:root /etc/pre_server.d ENV DEBUG=true diff --git a/tests/docker/oc-1/Dockerfile-local b/tests/docker/oc-1/Dockerfile-local index 9149899..2a613bd 100644 --- a/tests/docker/oc-1/Dockerfile-local +++ b/tests/docker/oc-1/Dockerfile-local @@ -12,20 +12,20 @@ RUN echo 'rd-mesh/oc-1.pem' >> /etc/ca-certificates.conf \ && update-ca-certificates \ && export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt -# Add the Invitation app from local source, includes using the make buildapp-test target to simulate an actual release version +# Add the Collaboration app from local source, includes using the make buildapp-test target to simulate an actual release version # Install the data migration file required for the tests # Install the pre start server script that activates the app # Install integration tests' requirements -RUN mkdir -p /tmp/invitation -COPY . /tmp/invitation +RUN mkdir -p /tmp/collaboration +COPY . /tmp/collaboration RUN mkdir -p /var/www/owncloud/apps \ - && cd /tmp/invitation \ - && make -e version=test buildapp-tests \ - && tar xvf /tmp/invitation/build/artifacts/app/invitation_test.tar.gz -C /var/www/owncloud/apps \ - && cp /var/www/owncloud/apps/invitation/tests/docker/integration-tests/Version20231130125301.php /var/www/owncloud/apps/invitation/appinfo/Migrations \ - && cp /var/www/owncloud/apps/invitation/tests/docker/oc-1/10-invitation-app.sh /etc/pre_server.d \ - && mv /var/www/owncloud/apps/invitation/appinfo/routes.php /var/www/owncloud/apps/invitation/appinfo/routes-main.php \ - && cp /var/www/owncloud/apps/invitation/tests/docker/integration-tests/src/tests/routes.php /var/www/owncloud/apps/invitation/appinfo/routes.php \ - && cp /var/www/owncloud/apps/invitation/tests/docker/integration-tests/src/tests/ExternalApiRoute.php /var/www/owncloud/apps/invitation/lib/ExternalApiRoute.php + && cd /tmp/collaboration \ + && make -e version=test buildapp-tests\ + && tar xvf /tmp/collaboration/build/artifacts/app/collaboration_test.tar.gz -C /var/www/owncloud/apps \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/integration-tests/Version20240718000001.php /var/www/owncloud/apps/collaboration/appinfo/Migrations \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/oc-1/10-collaboration-app.sh /etc/pre_server.d \ + && mv /var/www/owncloud/apps/collaboration/appinfo/routes.php /var/www/owncloud/apps/collaboration/appinfo/routes-main.php \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/integration-tests/src/tests/routes.php /var/www/owncloud/apps/collaboration/appinfo/routes.php \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/integration-tests/src/tests/ExternalApiRoute.php /var/www/owncloud/apps/collaboration/lib/ExternalApiRoute.php ENV DEBUG=true diff --git a/tests/docker/oc-2/10-collaboration-app.sh b/tests/docker/oc-2/10-collaboration-app.sh new file mode 100644 index 0000000..3862134 --- /dev/null +++ b/tests/docker/oc-2/10-collaboration-app.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# This script triggers installation of the Collaboration app right before server startup + +echo 'Install Collaboration app' +occ app:enable collaboration diff --git a/tests/docker/oc-2/10-invitation-app.sh b/tests/docker/oc-2/10-invitation-app.sh deleted file mode 100644 index 50def1f..0000000 --- a/tests/docker/oc-2/10-invitation-app.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -# This script triggers installation of the Invitation app right before server startup - -echo 'Install Invitation app' -occ app:enable invitation diff --git a/tests/docker/oc-2/Dockerfile-github b/tests/docker/oc-2/Dockerfile-github index 5391af8..ab80542 100644 --- a/tests/docker/oc-2/Dockerfile-github +++ b/tests/docker/oc-2/Dockerfile-github @@ -13,26 +13,26 @@ RUN echo 'rd-mesh/oc-1.pem' >> /etc/ca-certificates.conf \ && update-ca-certificates \ && export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt -# Add the Invitation app from branch, includes using the make buildapp-test target to simulate an actual release version +# Add the Collaboration app from branch, includes using the make buildapp-test target to simulate an actual release version # And install the data migration file required for the tests # And install the pre start server script that activates the app -RUN mkdir -p /tmp/invitation \ - && git clone -b ${BRANCH} https://github.com/sara-nl/oc-invitation.git /tmp/invitation +RUN mkdir -p /tmp/collaboration \ + && git clone -b ${BRANCH} https://github.com/sara-nl/oc-invitation.git /tmp/collaboration -RUN cd /tmp/invitation \ +RUN cd /tmp/collaboration \ && make -e version=test buildapp-tests \ - && tar -xvf /tmp/invitation/build/artifacts/app/invitation_test.tar.gz -C /var/www/owncloud/apps \ - && cd /var/www/owncloud/apps/invitation \ + && tar -xvf /tmp/collaboration/build/artifacts/app/collaboration_test.tar.gz -C /var/www/owncloud/apps \ + && cd /var/www/owncloud/apps/collaboration \ && composer install \ - && cp /var/www/owncloud/apps/invitation/tests/docker/integration-tests/Version20231130125302.php /var/www/owncloud/apps/invitation/appinfo/Migrations \ - && cp /var/www/owncloud/apps/invitation/tests/docker/oc-1/10-invitation-app.sh /etc/pre_server.d \ - && mv /var/www/owncloud/apps/invitation/appinfo/routes.php /var/www/owncloud/apps/invitation/appinfo/routes-main.php \ - && cp /var/www/owncloud/apps/invitation/tests/docker/integration-tests/src/tests/routes.php /var/www/owncloud/apps/invitation/appinfo/routes.php \ - && cp /var/www/owncloud/apps/invitation/tests/docker/integration-tests/src/tests/ExternalApiRoute.php /var/www/owncloud/apps/invitation/lib/ExternalApiRoute.php - -# RUN chown -R www-data:root /var/www/owncloud/apps/invitation \ -# RUN cp /var/www/owncloud/apps/invitation/tests/docker/oc-1/10-invitation-app.sh /etc/pre_server.d \ -# && cp /var/www/owncloud/apps/invitation/tests/docker/oc-1/InvitationApp.php /var/www/owncloud/apps/invitation/lib/AppInfo/InvitationApp.php + && cp /var/www/owncloud/apps/collaboration/tests/docker/integration-tests/Version20240718000002.php /var/www/owncloud/apps/collaboration/appinfo/Migrations \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/oc-1/10-collaboration-app.sh /etc/pre_server.d \ + && mv /var/www/owncloud/apps/collaboration/appinfo/routes.php /var/www/owncloud/apps/collaboration/appinfo/routes-main.php \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/integration-tests/src/tests/routes.php /var/www/owncloud/apps/collaboration/appinfo/routes.php \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/integration-tests/src/tests/ExternalApiRoute.php /var/www/owncloud/apps/collaboration/lib/ExternalApiRoute.php + +# RUN chown -R www-data:root /var/www/owncloud/apps/collaboration \ +# RUN cp /var/www/owncloud/apps/collaboration/tests/docker/oc-1/10-collaboration-app.sh /etc/pre_server.d \ +# && cp /var/www/owncloud/apps/collaboration/tests/docker/oc-1/CollaborationApp.php /var/www/owncloud/apps/collaboration/lib/AppInfo/CollaborationApp.php # && chown -R www-data:root /etc/pre_server.d ENV DEBUG=true diff --git a/tests/docker/oc-2/Dockerfile-local b/tests/docker/oc-2/Dockerfile-local index 2668324..ddca198 100644 --- a/tests/docker/oc-2/Dockerfile-local +++ b/tests/docker/oc-2/Dockerfile-local @@ -12,20 +12,20 @@ RUN echo 'rd-mesh/oc-1.pem' >> /etc/ca-certificates.conf \ && update-ca-certificates \ && export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt -# Add the Invitation app from local source, includes using the make buildapp-test target to simulate an actual release version +# Add the Collaboration app from local source, includes using the make buildapp-test target to simulate an actual release version # Install the data migration file required for the tests # Install the pre start server script that activates the app # Install integration tests' requirements -RUN mkdir -p /tmp/invitation -COPY . /tmp/invitation +RUN mkdir -p /tmp/collaboration +COPY . /tmp/collaboration RUN mkdir -p /var/www/owncloud/apps \ - && cd /tmp/invitation \ + && cd /tmp/collaboration \ && make -e version=test buildapp-tests \ - && tar xvf /tmp/invitation/build/artifacts/app/invitation_test.tar.gz -C /var/www/owncloud/apps \ - && cp /var/www/owncloud/apps/invitation/tests/docker/integration-tests/Version20231130125302.php /var/www/owncloud/apps/invitation/appinfo/Migrations \ - && cp /var/www/owncloud/apps/invitation/tests/docker/oc-1/10-invitation-app.sh /etc/pre_server.d \ - && mv /var/www/owncloud/apps/invitation/appinfo/routes.php /var/www/owncloud/apps/invitation/appinfo/routes-main.php \ - && cp /var/www/owncloud/apps/invitation/tests/docker/integration-tests/src/tests/routes.php /var/www/owncloud/apps/invitation/appinfo/routes.php \ - && cp /var/www/owncloud/apps/invitation/tests/docker/integration-tests/src/tests/ExternalApiRoute.php /var/www/owncloud/apps/invitation/lib/ExternalApiRoute.php + && tar xvf /tmp/collaboration/build/artifacts/app/collaboration_test.tar.gz -C /var/www/owncloud/apps \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/integration-tests/Version20240718000002.php /var/www/owncloud/apps/collaboration/appinfo/Migrations \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/oc-1/10-collaboration-app.sh /etc/pre_server.d \ + && mv /var/www/owncloud/apps/collaboration/appinfo/routes.php /var/www/owncloud/apps/collaboration/appinfo/routes-main.php \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/integration-tests/src/tests/routes.php /var/www/owncloud/apps/collaboration/appinfo/routes.php \ + && cp /var/www/owncloud/apps/collaboration/tests/docker/integration-tests/src/tests/ExternalApiRoute.php /var/www/owncloud/apps/collaboration/lib/ExternalApiRoute.php ENV DEBUG=true