Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Share your tables and views with users and groups within your cloud.
Have a good time and manage whatever you want.

]]></description>
<version>2.0.0-alpha.1</version>
<version>2.0.0-alpha.2</version>
<licence>agpl</licence>
<author mail="florian.steffens@nextcloud.com">Florian Steffens</author>
<namespace>Tables</namespace>
Expand Down
61 changes: 61 additions & 0 deletions css/error.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
.tables-error-wrapper {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
}

.body-public-container {
--color-text-maxcontrast: var(
--color-text-maxcontrast-background-blur,
var(--color-main-text)
);
color: var(--color-main-text);
background-color: var(--color-main-background-blur);
padding: calc(3 * var(--default-grid-baseline));
border-radius: var(--border-radius-container);
box-shadow: 0 0 10px var(--color-box-shadow);
display: inline-block;
-webkit-backdrop-filter: var(--filter-background-blur);
backdrop-filter: var(--filter-background-blur);
display: flex;
flex-direction: column;
text-align: start;
word-wrap: break-word;
border-radius: 10px;
cursor: default;
-moz-user-select: text;
-webkit-user-select: text;
-ms-user-select: text;
user-select: text;
height: fit-content;
width: 100%;
max-width: 700px;
margin-block: 10vh auto;
}

.body-public-container .icon-big {
background-size: 70px;
height: 70px;
}

.body-public-container form {
width: initial;
}

.body-public-container p:not(:last-child) {
margin-bottom: 12px;
}

.infogroup {
margin: 8px 0;
}

.infogroup:last-child {
margin-bottom: 0;
}

.update {
width: calc(100% - 32px);
text-align: center;
}
65 changes: 65 additions & 0 deletions cypress/e2e/tables-sharing-link.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

describe('Public link sharing', () => {
let localUser
const tableTitle = 'Public Share Test Table'

before(() => {
cy.createRandomUser().then(user => {
localUser = user
cy.login(localUser)
})
})

beforeEach(() => {
cy.login(localUser)
cy.visit('apps/tables')
cy.get('[data-cy="navigationCreateTableIcon"]').click({ force: true })
cy.get('.modal__content input[type="text"]').clear().type(tableTitle)
cy.get('.tile').contains('ToDo').click({ force: true })
cy.get('[data-cy="createTableSubmitBtn"]').scrollIntoView().click()
cy.loadTable(tableTitle)
})

it('Create, access and delete a public link share', () => {

cy.get('[data-cy="customTableAction"] button').click()
cy.get('[data-cy="dataTableShareBtn"]').click()
cy.contains('Public links').should('be.visible')
cy.intercept('POST', '**/apps/tables/api/2/tables/*/share').as('createShare')
cy.get('[data-cy="sharingEntryLinkCreateButton"]').click()
cy.get('[data-cy="sharingEntryLinkCreateFormCreateButton"]').click()

cy.wait('@createShare').then((interception) => {
expect(interception.response.statusCode).to.eq(200)
const shareToken = interception.response.body.ocs.data.shareToken
expect(shareToken).to.be.a('string')

cy.clearCookies()
cy.visit(`apps/tables/s/${shareToken}`)
cy.get('[data-cy="publicTableElement"]').should('be.visible')
cy.clickOnTableThreeDotMenu('Export as CSV')

// Verify we cannot edit (simple check: no edit controls or just read-only mode)
// We can check that the "Add row" button is missing.
cy.get('[data-cy="addRowBtn"]').should('not.exist')

// Login again to delete share
cy.login(localUser)
cy.visit('apps/tables')
cy.loadTable(tableTitle)

cy.get('[data-cy="customTableAction"] button').click()
cy.get('[data-cy="dataTableShareBtn"]').click()

cy.get('[data-cy="sharingEntryLinkTitle"]').should('be.visible')
cy.get('[data-cy="sharingEntryLinkDeleteButton"]').click()

cy.get('[data-cy="sharingEntryLinkTitle"]').should('not.exist')
})
})
})

2 changes: 2 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use OCA\Tables\Listener\WhenTableTransferredAuditLogListener;
use OCA\Tables\Listener\WhenViewDeletedAuditLogListener;
use OCA\Tables\Middleware\PermissionMiddleware;
use OCA\Tables\Middleware\ShareControlMiddleware;
use OCA\Tables\Reference\ContentReferenceProvider;
use OCA\Tables\Reference\ReferenceProvider;
use OCA\Tables\Search\SearchTablesProvider;
Expand Down Expand Up @@ -92,6 +93,7 @@ public function register(IRegistrationContext $context): void {
$context->registerCapability(Capabilities::class);

$context->registerMiddleware(PermissionMiddleware::class);
$context->registerMiddleware(ShareControlMiddleware::class);
}

public function boot(IBootContext $context): void {
Expand Down
1 change: 1 addition & 0 deletions lib/Constants/ShareReceiverType.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ class ShareReceiverType {
public const USER = 'user';
public const GROUP = 'group';
public const CIRCLE = 'circle';
public const LINK = 'link';
}
35 changes: 35 additions & 0 deletions lib/Controller/ACommonColumnsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\Tables\Controller;

use OCA\Tables\Errors\BadRequestError;
use OCA\Tables\Errors\InternalError;
use OCA\Tables\Errors\NotFoundError;
use OCA\Tables\Errors\PermissionError;
use OCA\Tables\Service\ColumnService;

abstract class ACommonColumnsController extends AOCSController {
protected ColumnService $service;

/**
* @throws PermissionError
* @throws NotFoundError
* @throws InternalError
* @throws BadRequestError
*/
protected function getColumnsFromTableOrView(string $nodeType, int $nodeId, ?string $overriddenUserid = null): array {
if ($nodeType === 'table') {
return $this->service->findAllByTable($nodeId, $overriddenUserid);
}
if ($nodeType === 'view') {
return $this->service->findAllByView($nodeId, $overriddenUserid);
}
throw new BadRequestError('Invalid node type provided');
}
}
Loading
Loading