Skip to content

feat(tables): support team-owned tables - #3298

Open
stediefan wants to merge 1 commit into
mainfrom
feature/3221-team-ownership
Open

stediefan wants to merge 1 commit into
mainfrom
feature/3221-team-ownership

Conversation

@stediefan

@stediefan stediefan commented Nov 18, 2026 •

Copy link
Copy Markdown

Add the ability for teams to own tables. Introduces a teamId property on a table indicating that it belogs to a team instead of a single user.
This PR provides the technical foundation for teams to be able to own a table - the full integration with teams will be done in a separate task

Resolves #3221 partly. Still waiting on the interface to register as a team-app

🖼️ Screenshots

🏚️ Before 🏡 After
B A

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔙 Backport requests are created or not needed: /backport to stableX.X
  • [] 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@stediefan stediefan added the 3. to review Waiting for reviews label Nov 18, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in 👥 Teams Nov 18, 2026
@stediefan
stediefan force-pushed the feature/3221-team-ownership branch 2 times, most recently from 8bb4fa9 to c58d195 Compare November 18, 2026 07:33
@stediefan
stediefan marked this pull request as ready for review November 18, 2026 08:36
@stediefan stediefan moved this from Backlog to In review in 👥 Teams Nov 18, 2026
@blizzz
blizzz requested a review from samin-z November 19, 2026 08:59
@blizzz blizzz added the enhancement New feature or request label Nov 24, 2026
@enjeck

enjeck commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Still waiting on the interface to register as a team-app

Should I wait for this? Or is this ready to review now?

@stediefan

Copy link
Copy Markdown
Author

Still waiting on the interface to register as a team-app

Should I wait for this? Or is this ready to review now?

It's ready for review. This is just for the ability of teams to own tables. The integration into Teams as resources will be done in nextcloud/circles#3187.

Comment thread lib/Controller/ApiTablesController.php Resolved
Comment thread lib/Listener/UserDeletedListener.php Outdated
$this->tableService->delete($table->getId(), $userId);
}
} catch (InternalError|NotFoundError|PermissionError $e) {
$this->logger->error('Could not clean up a table for a deleted user', [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if table owner is deleted while the Circles app is disabled, the ownership transfer does not happen and the table stays owned by the deleted user. when Circles is enabled again the ownership should move to the next user in team, the same way it does when Circles is enabled at the time of deletion.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I handled it like this: circles is queried for an eligible successor. if circles is disabled/unavailable it leaves them untouched and has a background job running waiting for circles to be avaialbe again and then retrys the handover mechanism

throw new PermissionError('PermissionError: can not change table owner with table id ' . $id);
}
$previousOwnerUserId = $table->getOwnership();
$table->setOwnership($newOwnerUserId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i noticed something, if table's ownership is transferred to someone outside the team, team_id will stay set in the database, so if the team is deleted the table will be deleted too eventhough it has a new owner now.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prevented changing the ownership to someone outside the team all along. That should handle it as the Table is supposed to be owned by the team

$member = $event->getMember();
if ($member->getUserType() === Member::TYPE_USER && $member->isLocal()) {
try {
$this->tableService->handleTeamStewardDeparture($event->getCircle()->getSingleId(), $member->getUserId());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when a user is deleted this runs again after 'UserDeletedListener' already transferred the table. 'findAllByTeamId' finds nothing because the owner has changed, so the second run does nothing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second listener should handle the case where the circle has no eligible members to become successor. (eg. only non-local members) This is something i am not quite sure on how we should handle this.

Allow team members to create team-attached tables through the API. Keep the user owner and an ordinary team share, handing ownership over or cleaning up tables when the owner leaves or the team is deleted.

Assisted-by: Copilot:gpt-6.1-sol
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Stefan Dietrich <stefan.dietrich@dataport.de>
@stediefan
stediefan force-pushed the feature/3221-team-ownership branch from c58d195 to 9b7859d Compare November 30, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted enhancement New feature or request

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

Allow a team to own a table

5 participants