-
Notifications
You must be signed in to change notification settings - Fork 82
IBX-9737: Collaborative editing - configuration for v5.0 #2930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
05e109d
176a1df
97e5fe3
9017928
9aaddfe
6b42795
7aa922d
9617111
18d900c
15f39f4
3f71630
b3bdbba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
CREATE TABLE ibexa_collaboration | ||
( | ||
id INT AUTO_INCREMENT NOT NULL, | ||
owner_id INT NOT NULL, | ||
token VARCHAR(160) NOT NULL, | ||
discriminator VARCHAR(190) NOT NULL, | ||
is_active TINYINT(1) NOT NULL, | ||
has_public_link TINYINT(1) NOT NULL, | ||
created_at DATETIME NOT NULL COMMENT '(DC2Type:datetimetz_immutable)', | ||
updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetimetz_immutable)', | ||
UNIQUE INDEX ibexa_collaboration_token_idx (token), | ||
INDEX ibexa_collaboration_owner_idx (owner_id), | ||
UNIQUE INDEX ibexa_collaboration_token_uc (token), | ||
PRIMARY KEY (id) | ||
) DEFAULT CHARACTER SET utf8mb4 | ||
COLLATE `utf8mb4_unicode_520_ci` | ||
ENGINE = InnoDB; | ||
CREATE TABLE ibexa_collaboration_participant | ||
( | ||
id INT AUTO_INCREMENT NOT NULL, | ||
session_id INT NOT NULL, | ||
discriminator VARCHAR(190) NOT NULL, | ||
scope VARCHAR(255) DEFAULT NULL, | ||
token VARCHAR(255) DEFAULT NULL, | ||
created_at DATETIME NOT NULL COMMENT '(DC2Type:datetimetz_immutable)', | ||
updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetimetz_immutable)', | ||
INDEX IDX_9C5C6401613FECDF (session_id), | ||
UNIQUE INDEX ibexa_collaboration_participant_token_idx (token), | ||
PRIMARY KEY (id) | ||
) DEFAULT CHARACTER SET utf8mb4 | ||
COLLATE `utf8mb4_unicode_520_ci` | ||
ENGINE = InnoDB; | ||
CREATE TABLE ibexa_collaboration_participant_internal | ||
( | ||
id INT NOT NULL, | ||
user_id INT NOT NULL, | ||
INDEX IDX_E838B79AA76ED395 (user_id), | ||
PRIMARY KEY (id) | ||
) DEFAULT CHARACTER SET utf8mb4 | ||
COLLATE `utf8mb4_unicode_520_ci` | ||
ENGINE = InnoDB; | ||
CREATE TABLE ibexa_collaboration_participant_external | ||
( | ||
id INT NOT NULL, | ||
email VARCHAR(255) NOT NULL, | ||
PRIMARY KEY (id) | ||
) DEFAULT CHARACTER SET utf8mb4 | ||
COLLATE `utf8mb4_unicode_520_ci` | ||
ENGINE = InnoDB; | ||
CREATE TABLE ibexa_collaboration_invitation | ||
( | ||
id INT AUTO_INCREMENT NOT NULL, | ||
session_id INT NOT NULL, | ||
participant_id INT NOT NULL, | ||
sender_id INT NOT NULL, | ||
status VARCHAR(64) NOT NULL, | ||
context LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', | ||
created_at DATETIME NOT NULL COMMENT '(DC2Type:datetimetz_immutable)', | ||
updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetimetz_immutable)', | ||
INDEX IDX_36C63687613FECDF (session_id), | ||
INDEX IDX_36C636879D1C3019 (participant_id), | ||
INDEX IDX_36C63687F624B39D (sender_id), | ||
PRIMARY KEY (id) | ||
) DEFAULT CHARACTER SET utf8mb4 | ||
COLLATE `utf8mb4_unicode_520_ci` | ||
ENGINE = InnoDB; | ||
ALTER TABLE ibexa_collaboration | ||
ADD CONSTRAINT ibexa_collaboration_owner_id_fk FOREIGN KEY (owner_id) REFERENCES ezuser (contentobject_id) ON DELETE RESTRICT; | ||
ALTER TABLE ibexa_collaboration_participant | ||
ADD CONSTRAINT ibexa_collaboration_participant_session_id_fk FOREIGN KEY (session_id) REFERENCES ibexa_collaboration (id) ON UPDATE CASCADE ON DELETE CASCADE; | ||
ALTER TABLE ibexa_collaboration_participant_internal | ||
ADD CONSTRAINT ibexa_collaboration_participant_internal_pk FOREIGN KEY (id) REFERENCES ibexa_collaboration_participant (id) ON UPDATE CASCADE ON DELETE CASCADE; | ||
ALTER TABLE ibexa_collaboration_participant_internal | ||
ADD CONSTRAINT ibexa_collaboration_participant_internal_user_id_fk FOREIGN KEY (user_id) REFERENCES ezuser (contentobject_id) ON DELETE RESTRICT; | ||
julitafalcondusza marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
ALTER TABLE ibexa_collaboration_participant_external | ||
ADD CONSTRAINT ibexa_collaboration_participant_external_pk FOREIGN KEY (id) REFERENCES ibexa_collaboration_participant (id) ON UPDATE CASCADE ON DELETE CASCADE; | ||
ALTER TABLE ibexa_collaboration_invitation | ||
ADD CONSTRAINT ibexa_collaboration_invitation_session_id_fk FOREIGN KEY (session_id) REFERENCES ibexa_collaboration (id) ON UPDATE CASCADE ON DELETE CASCADE; | ||
ALTER TABLE ibexa_collaboration_invitation | ||
ADD CONSTRAINT ibexa_collaboration_invitation_participant_id_fk FOREIGN KEY (participant_id) REFERENCES ibexa_collaboration_participant (id) ON UPDATE CASCADE ON DELETE CASCADE; | ||
ALTER TABLE ibexa_collaboration_invitation | ||
ADD CONSTRAINT ibexa_collaboration_invitation_sender_id_fk FOREIGN KEY (sender_id) REFERENCES ezuser (contentobject_id) ON DELETE RESTRICT; | ||
julitafalcondusza marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
CREATE TABLE ibexa_collaboration | ||
( | ||
id SERIAL NOT NULL, | ||
owner_id INT NOT NULL, | ||
token VARCHAR(160) NOT NULL, | ||
discriminator VARCHAR(190) NOT NULL, | ||
is_active BOOLEAN NOT NULL, | ||
has_public_link BOOLEAN NOT NULL, | ||
created_at TIMESTAMP(0) WITH TIME ZONE NOT NULL, | ||
updated_at TIMESTAMP(0) WITH TIME ZONE NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
CREATE UNIQUE INDEX ibexa_collaboration_token_idx ON ibexa_collaboration (token); | ||
CREATE INDEX ibexa_collaboration_owner_idx ON ibexa_collaboration (owner_id); | ||
CREATE UNIQUE INDEX ibexa_collaboration_token_uc ON ibexa_collaboration (token); | ||
COMMENT | ||
ON COLUMN ibexa_collaboration.created_at IS '(DC2Type:datetimetz_immutable)'; | ||
COMMENT | ||
ON COLUMN ibexa_collaboration.updated_at IS '(DC2Type:datetimetz_immutable)'; | ||
CREATE TABLE ibexa_collaboration_participant | ||
( | ||
id SERIAL NOT NULL, | ||
session_id INT NOT NULL, | ||
discriminator VARCHAR(190) NOT NULL, | ||
scope VARCHAR(255) DEFAULT NULL, | ||
token VARCHAR(255) DEFAULT NULL, | ||
created_at TIMESTAMP(0) WITH TIME ZONE NOT NULL, | ||
updated_at TIMESTAMP(0) WITH TIME ZONE NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
CREATE INDEX ibexa_collaboration_participant_idx ON ibexa_collaboration_participant (session_id); | ||
CREATE UNIQUE INDEX ibexa_collaboration_participant_token_idx ON ibexa_collaboration_participant (token); | ||
COMMENT | ||
ON COLUMN ibexa_collaboration_participant.created_at IS '(DC2Type:datetimetz_immutable)'; | ||
COMMENT | ||
ON COLUMN ibexa_collaboration_participant.updated_at IS '(DC2Type:datetimetz_immutable)'; | ||
CREATE TABLE ibexa_collaboration_participant_internal | ||
( | ||
id INT NOT NULL, | ||
user_id INT NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
CREATE INDEX ibexa_collaboration_participant_internal_idx ON ibexa_collaboration_participant_internal (user_id); | ||
CREATE TABLE ibexa_collaboration_participant_external | ||
( | ||
id INT NOT NULL, | ||
email VARCHAR(255) NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
CREATE TABLE ibexa_collaboration_invitation | ||
( | ||
id SERIAL NOT NULL, | ||
session_id INT NOT NULL, | ||
participant_id INT NOT NULL, | ||
sender_id INT NOT NULL, | ||
status VARCHAR(64) NOT NULL, | ||
context JSON DEFAULT NULL, | ||
created_at TIMESTAMP(0) WITH TIME ZONE NOT NULL, | ||
updated_at TIMESTAMP(0) WITH TIME ZONE NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
CREATE INDEX ibexa_collaboration_invitation_idx ON ibexa_collaboration_invitation (session_id); | ||
CREATE INDEX ibexa_collaboration_invitation_idx ON ibexa_collaboration_invitation (participant_id); | ||
CREATE INDEX ibexa_collaboration_invitation_idx ON ibexa_collaboration_invitation (sender_id); | ||
COMMENT | ||
ON COLUMN ibexa_collaboration_invitation.created_at IS '(DC2Type:datetimetz_immutable)'; | ||
COMMENT | ||
ON COLUMN ibexa_collaboration_invitation.updated_at IS '(DC2Type:datetimetz_immutable)'; | ||
ALTER TABLE ibexa_collaboration | ||
ADD CONSTRAINT ibexa_collaboration_owner_id_fk FOREIGN KEY (owner_id) REFERENCES ezuser (contentobject_id) ON DELETE RESTRICT NOT DEFERRABLE INITIALLY IMMEDIATE; | ||
julitafalcondusza marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
ALTER TABLE ibexa_collaboration_participant | ||
ADD CONSTRAINT ibexa_collaboration_participant_session_id_fk FOREIGN KEY (session_id) REFERENCES ibexa_collaboration (id) ON UPDATE CASCADE ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE; | ||
ALTER TABLE ibexa_collaboration_participant_internal | ||
ADD CONSTRAINT ibexa_collaboration_participant_internal_pk FOREIGN KEY (id) REFERENCES ibexa_collaboration_participant (id) ON UPDATE CASCADE ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE; | ||
ALTER TABLE ibexa_collaboration_participant_internal | ||
ADD CONSTRAINT ibexa_collaboration_participant_internal_user_id_fk FOREIGN KEY (user_id) REFERENCES ezuser (contentobject_id) ON DELETE RESTRICT NOT DEFERRABLE INITIALLY IMMEDIATE; | ||
julitafalcondusza marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
ALTER TABLE ibexa_collaboration_participant_external | ||
ADD CONSTRAINT ibexa_collaboration_participant_external_pk FOREIGN KEY (id) REFERENCES ibexa_collaboration_participant (id) ON UPDATE CASCADE ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE; | ||
ALTER TABLE ibexa_collaboration_invitation | ||
ADD CONSTRAINT ibexa_collaboration_invitation_session_id_fk FOREIGN KEY (session_id) REFERENCES ibexa_collaboration (id) ON UPDATE CASCADE ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE; | ||
ALTER TABLE ibexa_collaboration_invitation | ||
ADD CONSTRAINT ibexa_collaboration_invitation_participant_id_fk FOREIGN KEY (participant_id) REFERENCES ibexa_collaboration_participant (id) ON UPDATE CASCADE ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE; | ||
ALTER TABLE ibexa_collaboration_invitation | ||
ADD CONSTRAINT ibexa_collaboration_invitation_sender_id_fk FOREIGN KEY (sender_id) REFERENCES ezuser (contentobject_id) ON DELETE RESTRICT NOT DEFERRABLE INITIALLY IMMEDIATE; | ||
julitafalcondusza marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace App\Command; | ||
|
||
use Ibexa\Contracts\Collaboration\Invitation\InvitationCreateStruct; | ||
use Ibexa\Contracts\Collaboration\Invitation\InvitationQuery; | ||
use Ibexa\Contracts\Collaboration\Invitation\InvitationStatus; | ||
use Ibexa\Contracts\Collaboration\Invitation\InvitationUpdateStruct; | ||
use Ibexa\Contracts\Collaboration\Invitation\Query\Criterion\Session; | ||
use Ibexa\Contracts\Collaboration\InvitationServiceInterface; | ||
use Ibexa\Contracts\Collaboration\Participant\ExternalParticipantCreateStruct; | ||
use Ibexa\Contracts\Collaboration\Participant\InternalParticipantCreateStruct; | ||
use Ibexa\Contracts\Collaboration\Participant\InternalParticipantUpdateStruct; | ||
use Ibexa\Contracts\Collaboration\Session\Query\Criterion\Token; | ||
use Ibexa\Contracts\Collaboration\Session\SessionQuery; | ||
use Ibexa\Contracts\Collaboration\SessionServiceInterface; | ||
use Ibexa\Contracts\Core\Repository\ContentService; | ||
use Ibexa\Contracts\Core\Repository\PermissionResolver; | ||
use Ibexa\Contracts\Core\Repository\UserService; | ||
use Ibexa\Contracts\Share\Collaboration\ContentSessionCreateStruct; | ||
use Ibexa\Contracts\Share\Collaboration\ContentSessionScope; | ||
use Ibexa\Contracts\Share\Collaboration\ContentSessionUpdateStruct; | ||
use Symfony\Component\Console\Attribute\AsCommand; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
#[AsCommand(name: 'app:manage-sessions')] | ||
final class ManageSessionsCommand extends Command | ||
{ | ||
public function __construct( | ||
private readonly InvitationServiceInterface $invitationService, | ||
private readonly SessionServiceInterface $sessionService, | ||
private readonly ContentService $contentService, | ||
private readonly UserService $userService, | ||
private readonly PermissionResolver $permissionResolver | ||
) { | ||
parent::__construct(); | ||
} | ||
|
||
public function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$this->permissionResolver->setCurrentUserReference( | ||
$this->userService->loadUserByLogin('admin') | ||
); | ||
|
||
// Create a sharing session for Content | ||
$versionInfo = $this->contentService->loadContent(52)->getVersionInfo(); | ||
$createStruct = new ContentSessionCreateStruct( | ||
$versionInfo, | ||
$versionInfo->getInitialLanguage() | ||
); | ||
$createStruct->setHasPublicLink(false); | ||
|
||
$token = 'my-secret-token-12345'; | ||
$createStruct->setToken($token); | ||
|
||
$sessionId = $this->sessionService->createSession($createStruct)->getId(); | ||
|
||
// Get a session by ID or token | ||
$session = $this->sessionService->getSession($sessionId); | ||
$session = $this->sessionService->getSessionByToken($token); | ||
|
||
// Find sessions | ||
$sessionQuery = new SessionQuery(new Token($token)); | ||
$session = $this->sessionService->findSessions($sessionQuery)->getFirst(); | ||
|
||
// Update a session | ||
$updateStruct = new ContentSessionUpdateStruct(); | ||
$updateStruct->setHasPublicLink(true); | ||
|
||
$this->sessionService->updateSession($session, $updateStruct); | ||
|
||
// Deactivate a session | ||
$updateStruct = new ContentSessionUpdateStruct(); | ||
$updateStruct->setIsActive(false); | ||
|
||
$this->sessionService->updateSession($session, $updateStruct); | ||
|
||
// Manage participants | ||
$user = $this->userService->loadUserByLogin('another_user'); | ||
$internalParticipantCreateStruct = new InternalParticipantCreateStruct( | ||
$user, | ||
ContentSessionScope::VIEW | ||
); | ||
$externalParticipantCreateStruct = new ExternalParticipantCreateStruct( | ||
'[email protected]', | ||
ContentSessionScope::VIEW, | ||
'personal-secret-token-12345' | ||
); | ||
|
||
$internalParticipant = $this->sessionService->addParticipant($session, $internalParticipantCreateStruct); | ||
$externalParticipant = $this->sessionService->addParticipant($session, $externalParticipantCreateStruct); | ||
|
||
// Get and update participants | ||
$participant = $this->sessionService | ||
->getSession($session->getId()) | ||
->getParticipants() | ||
->getByEmail($user->email); | ||
|
||
$internalParticipantUpdateStruct = new InternalParticipantUpdateStruct(ContentSessionScope::EDIT); | ||
$this->sessionService->updateParticipant($session, $participant, $internalParticipantUpdateStruct); | ||
|
||
// Remove participant | ||
$this->sessionService->removeParticipant($session, $externalParticipant); | ||
|
||
// Check ownerships. If no user is provided, current user is used. | ||
$this->sessionService->isSessionOwner( | ||
$session, | ||
$this->userService->loadUserByLogin('another_user') | ||
); | ||
|
||
// Check participation | ||
$this->sessionService->isSessionParticipant( | ||
$session, | ||
$this->permissionResolver->getCurrentUserReference() | ||
); | ||
|
||
// Manage invitations | ||
$invitationQuery = new InvitationQuery(new Session($session)); | ||
$invitations = $this->invitationService->findInvitations($invitationQuery)->getInvitations(); | ||
|
||
foreach ($invitations as $invitation) { | ||
$output->writeln('Invitation ID: ' . $invitation->getId() . ' Status: ' . $invitation->getStatus()); | ||
} | ||
|
||
$invitation = $this->invitationService->getInvitationByParticipant($participant); | ||
|
||
// Create invitation - use when auto-inviting participants is not enabled | ||
$invitationCreateStruct = new InvitationCreateStruct( | ||
$session, | ||
$internalParticipant | ||
); | ||
|
||
$this->invitationService->createInvitation($invitationCreateStruct); | ||
|
||
// Update invitation | ||
$invitationUpdateStruct = new InvitationUpdateStruct(); | ||
$invitationUpdateStruct->setStatus(InvitationStatus::STATUS_REJECTED); | ||
|
||
$this->invitationService->updateInvitation($invitation, $invitationUpdateStruct); | ||
|
||
// Delete invitation | ||
$invitation = $this->invitationService->getInvitation(2); | ||
$this->invitationService->deleteInvitation($invitation); | ||
|
||
// Delete a session | ||
$this->sessionService->deleteSession($session); | ||
|
||
return Command::SUCCESS; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
Check warning on line 1 in docs/content_management/collaborative_editing/collaborative_editing.md
|
||
description: Collaborative editing enables multiple users to work on the same content simultaneously. | ||
page_type: landing_page | ||
month_change: true | ||
--- | ||
|
||
# Collaborative editing | ||
|
||
With Collaborative editing feature multiple users can work on the same content created in [[= product_name =]] simultaneously, streamlining the content creation and review process. | ||
|
||
Users can invite both internal and external collaborators to a session, giving them access for editing or previewing. | ||
|
||
Additionaly, they can collaborate using a Real-time collaboration, an advanced part of the collaboration feature, to write and review content in a live mode thanks to CKEditor. | ||
Check warning on line 13 in docs/content_management/collaborative_editing/collaborative_editing.md
|
||
Real-time collaboration syncs changes instantly and shows user avatars and colored tags to indicate who is editing specific part of the Rich Text field. | ||
|
||
This feature also introduces new dashboard tabs for managing shared drafts and joining collaboration sessions easily. | ||
Check warning on line 16 in docs/content_management/collaborative_editing/collaborative_editing.md
|
||
|
||
[[= cards([ | ||
"content_management/collaborative_editing/collaborative_editing_guide", | ||
"content_management/collaborative_editing/configure_collaborative_editing", | ||
"content_management/collaborative_editing/collaborative_editing_api" | ||
], columns=3) =]] |
Uh oh!
There was an error while loading. Please reload this page.