diff --git a/cypress/e2e/ToDo list.json b/cypress/e2e/ToDo list.json index a9d37a099..54e9b5642 100644 --- a/cypress/e2e/ToDo list.json +++ b/cypress/e2e/ToDo list.json @@ -1 +1 @@ -{"title":"ToDo list","emoji":"\u2705","columns":[{"id":491,"tableId":132,"title":"Task","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"line","mandatory":true,"description":"","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"showUserStatus":false},{"id":492,"tableId":132,"title":"Description","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"rich","mandatory":false,"description":"Title or short description","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"showUserStatus":false},{"id":493,"tableId":132,"title":"Target","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"rich","mandatory":false,"description":"Date, time or whatever","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"showUserStatus":false},{"id":494,"tableId":132,"title":"Progress","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"number","subtype":"progress","mandatory":false,"description":"","numberDefault":0,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"showUserStatus":false},{"id":495,"tableId":132,"title":"Comments","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"rich","mandatory":false,"description":"","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"showUserStatus":false},{"id":496,"tableId":132,"title":"Proofed","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"selection","subtype":"check","mandatory":false,"description":"","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"showUserStatus":false}],"views":[],"description":"","tablesVersion":"0.8.0-beta.2"} \ No newline at end of file +{"title":"ToDo list","emoji":"\u2705","columns":[{"id":491,"tableId":132,"title":"Task","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"line","mandatory":true,"description":"","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"usergroupSelectTeams":false,"showUserStatus":false},{"id":492,"tableId":132,"title":"Description","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"rich","mandatory":false,"description":"Title or short description","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"usergroupSelectTeams":false,"showUserStatus":false},{"id":493,"tableId":132,"title":"Target","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"rich","mandatory":false,"description":"Date, time or whatever","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"usergroupSelectTeams":false,"showUserStatus":false},{"id":494,"tableId":132,"title":"Progress","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"number","subtype":"progress","mandatory":false,"description":"","numberDefault":0,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"usergroupSelectTeams":false,"showUserStatus":false},{"id":495,"tableId":132,"title":"Comments","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"text","subtype":"rich","mandatory":false,"description":"","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"usergroupSelectTeams":false,"showUserStatus":false},{"id":496,"tableId":132,"title":"Proofed","createdBy":"admin","createdByDisplayName":"admin","createdAt":"2024-08-26 12:58:43","lastEditBy":"admin","lastEditByDisplayName":"admin","lastEditAt":"2024-08-26 12:58:43","type":"selection","subtype":"check","mandatory":false,"description":"","numberDefault":null,"numberMin":null,"numberMax":null,"numberDecimals":0,"numberPrefix":"","numberSuffix":"","textDefault":"","textAllowedPattern":"","textMaxLength":-1,"selectionOptions":[],"selectionDefault":"","datetimeDefault":"","usergroupDefault":[],"usergroupMultipleItems":false,"usergroupSelectUsers":false,"usergroupSelectGroups":false,"usergroupSelectTeams":false, "showUserStatus":false}],"views":[],"description":"","tablesVersion":"0.8.0-beta.2"} \ No newline at end of file diff --git a/cypress/e2e/column-usergroup.cy.js b/cypress/e2e/column-usergroup.cy.js index 9a2db2a8c..18282aa3c 100644 --- a/cypress/e2e/column-usergroup.cy.js +++ b/cypress/e2e/column-usergroup.cy.js @@ -31,7 +31,7 @@ describe('Test column ' + columnTitle, () => { it('Create column and rows with default values', () => { cy.createTable(tableTitle) cy.loadTable(tableTitle) - cy.createUsergroupColumn(columnTitle, true, true, true, [localUser.userId, nonLocalUser.userId], true) + cy.createUsergroupColumn(columnTitle, true, true, true, true, [localUser.userId, nonLocalUser.userId], true) cy.get('button').contains('Create row').click() cy.get('[data-cy="createRowSaveButton"]').click() cy.get('[data-cy="ncTable"] table tr td .user-bubble__name').contains(localUser.userId).should('be.visible') @@ -41,7 +41,7 @@ describe('Test column ' + columnTitle, () => { it('Create column and rows without default values', () => { cy.createTable(tableTitle) cy.loadTable(tableTitle) - cy.createUsergroupColumn(columnTitle, true, false, false, [], true) + cy.createUsergroupColumn(columnTitle, true, false, false, false, [], true) cy.get('button').contains('Create row').click() cy.get('[data-cy="usergroupRowSelect"] input').type(nonLocalUser.userId) @@ -53,7 +53,7 @@ describe('Test column ' + columnTitle, () => { it('Create and edit rows', () => { cy.createTable(tableTitle) cy.loadTable(tableTitle) - cy.createUsergroupColumn(columnTitle, true, true, true, [localUser.userId], true) + cy.createUsergroupColumn(columnTitle, true, true, true, true, [localUser.userId], true) cy.get('button').contains('Create row').click() cy.get('[data-cy="createRowSaveButton"]').click() cy.get('[data-cy="ncTable"] table tr td .user-bubble__name').contains(localUser.userId).should('be.visible') diff --git a/cypress/support/commands.js b/cypress/support/commands.js index eb67e7048..a124571db 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -118,7 +118,7 @@ Cypress.Commands.add('unifiedSearch', (term) => { cy.get('.unified-search__results .unified-search__result-line-one span').contains(term, { matchCase: false }).should('exist') }) -Cypress.Commands.add('createUsergroupColumn', (title, selectUsers, selectGroups, hasMultipleValues, defaultValue, isFirstColumn) => { +Cypress.Commands.add('createUsergroupColumn', (title, selectUsers, selectGroups, selectTeams, hasMultipleValues, defaultValue, isFirstColumn) => { cy.openCreateColumnModal(isFirstColumn) cy.get('[data-cy="columnTypeFormInput"]').clear().type(title) cy.get('.columnTypeSelection .vs__open-indicator').click({ force: true }) @@ -128,12 +128,15 @@ Cypress.Commands.add('createUsergroupColumn', (title, selectUsers, selectGroups, cy.get('[data-cy="usergroupMultipleSwitch"] .checkbox-content').click({ force: true }) } - if (selectUsers && selectGroups) { - cy.get('[data-cy="userAndGroupSwitch"] .checkbox-content').click() - } else if (selectUsers) { - cy.get('[data-cy="userSwitch"] .checkbox-content').click() - } else if (selectGroups) { - cy.get('[data-cy="groupSwitch"] .checkbox-content').click() + if (selectGroups) { + cy.get('[data-cy="groupsSwitch"] input').click({ force: true }) + } + if (selectTeams) { + cy.get('[data-cy="teamsSwitch"] input').click({ force: true }) + } + // Users is always checked by default, and we can only disable it if some other option is already enabled + if (!selectUsers & (selectGroups || selectTeams)) { + cy.get('[data-cy="usersSwitch"] input').click({ force: true }) } defaultValue.forEach((value) => { diff --git a/lib/Controller/Api1Controller.php b/lib/Controller/Api1Controller.php index 8d86aef18..bf1e3c540 100644 --- a/lib/Controller/Api1Controller.php +++ b/lib/Controller/Api1Controller.php @@ -766,6 +766,7 @@ public function indexViewColumns(int $viewId): DataResponse { * @param bool|null $usergroupMultipleItems Can select multiple users or/and groups, if column is usergroup * @param bool|null $usergroupSelectUsers Can select users, if column type is usergroup * @param bool|null $usergroupSelectGroups Can select groups, if column type is usergroup + * @param bool|null $usergroupSelectTeams Can select teams, if column type is usergroup * @param bool|null $usergroupShowUserStatus Whether to show the user's status, if column type is usergroup * @param int[]|null $selectedViewIds View IDs where this column should be added to be presented * @@ -806,6 +807,7 @@ public function createColumn( ?bool $usergroupMultipleItems = null, ?bool $usergroupSelectUsers = null, ?bool $usergroupSelectGroups = null, + ?bool $usergroupSelectTeams = null, ?bool $usergroupShowUserStatus = null, ?array $selectedViewIds = [] @@ -837,6 +839,7 @@ public function createColumn( usergroupMultipleItems: $usergroupMultipleItems, usergroupSelectUsers: $usergroupSelectUsers, usergroupSelectGroups: $usergroupSelectGroups, + usergroupSelectTeams: $usergroupSelectTeams, showUserStatus: $usergroupShowUserStatus ), $selectedViewIds @@ -880,6 +883,7 @@ public function createColumn( * @param bool|null $usergroupMultipleItems Can select multiple users or/and groups, if column is usergroup * @param bool|null $usergroupSelectUsers Can select users, if column type is usergroup * @param bool|null $usergroupSelectGroups Can select groups, if column type is usergroup + * @param bool|null $usergroupSelectTeams Can select teams, if column type is usergroup * @param bool|null $usergroupShowUserStatus Whether to show the user's status, if column type is usergroup * * @return DataResponse|DataResponse @@ -916,6 +920,7 @@ public function updateColumn( ?bool $usergroupMultipleItems, ?bool $usergroupSelectUsers, ?bool $usergroupSelectGroups, + ?bool $usergroupSelectTeams, ?bool $usergroupShowUserStatus, ): DataResponse { @@ -945,6 +950,7 @@ public function updateColumn( usergroupMultipleItems: $usergroupMultipleItems, usergroupSelectUsers: $usergroupSelectUsers, usergroupSelectGroups: $usergroupSelectGroups, + usergroupSelectTeams: $usergroupSelectTeams, showUserStatus: $usergroupShowUserStatus ) ); @@ -1472,6 +1478,7 @@ public function createTableShare(int $tableId, string $receiver, string $receive * @param bool|null $usergroupMultipleItems Can select multiple users or/and groups, if column is usergroup * @param bool|null $usergroupSelectUsers Can select users, if column type is usergroup * @param bool|null $usergroupSelectGroups Can select groups, if column type is usergroup + * @param bool|null $usergroupSelectTeams Can select teams, if column type is usergroup * @param bool|null $usergroupShowUserStatus Whether to show the user's status, if column type is usergroup * @param int[]|null $selectedViewIds View IDs where this column should be added to be presented * @@ -1513,6 +1520,7 @@ public function createTableColumn( ?bool $usergroupMultipleItems = null, ?bool $usergroupSelectUsers = null, ?bool $usergroupSelectGroups = null, + ?bool $usergroupSelectTeams = null, ?bool $usergroupShowUserStatus = null, ?array $selectedViewIds = [] ): DataResponse { @@ -1543,6 +1551,7 @@ public function createTableColumn( usergroupMultipleItems: $usergroupMultipleItems, usergroupSelectUsers: $usergroupSelectUsers, usergroupSelectGroups: $usergroupSelectGroups, + usergroupSelectTeams: $usergroupSelectTeams, showUserStatus: $usergroupShowUserStatus ), $selectedViewIds diff --git a/lib/Controller/ApiColumnsController.php b/lib/Controller/ApiColumnsController.php index 9560dbd26..c4b6fda94 100644 --- a/lib/Controller/ApiColumnsController.php +++ b/lib/Controller/ApiColumnsController.php @@ -295,6 +295,7 @@ public function createDatetimeColumn(int $baseNodeId, string $title, ?string $da * @param boolean $usergroupMultipleItems Whether you can select multiple users or/and groups * @param boolean $usergroupSelectUsers Whether you can select users * @param boolean $usergroupSelectGroups Whether you can select groups + * @param boolean $usergroupSelectTeams Whether you can select teams * @param boolean $showUserStatus Whether to show the user's status * @param string|null $description Description * @param int[]|null $selectedViewIds View IDs where this columns should be added @@ -311,7 +312,7 @@ public function createDatetimeColumn(int $baseNodeId, string $title, ?string $da */ #[NoAdminRequired] #[RequirePermission(permission: Application::PERMISSION_MANAGE, typeParam: 'baseNodeType', idParam: 'baseNodeId')] - public function createUsergroupColumn(int $baseNodeId, string $title, ?string $usergroupDefault, bool $usergroupMultipleItems = null, bool $usergroupSelectUsers = null, bool $usergroupSelectGroups = null, bool $showUserStatus = null, string $description = null, ?array $selectedViewIds = [], bool $mandatory = false, string $baseNodeType = 'table'): DataResponse { + public function createUsergroupColumn(int $baseNodeId, string $title, ?string $usergroupDefault, bool $usergroupMultipleItems = null, bool $usergroupSelectUsers = null, bool $usergroupSelectGroups = null, bool $usergroupSelectTeams = null, bool $showUserStatus = null, string $description = null, ?array $selectedViewIds = [], bool $mandatory = false, string $baseNodeType = 'table'): DataResponse { $tableId = $baseNodeType === 'table' ? $baseNodeId : null; $viewId = $baseNodeType === 'view' ? $baseNodeId : null; $column = $this->service->create( @@ -327,6 +328,7 @@ public function createUsergroupColumn(int $baseNodeId, string $title, ?string $u usergroupMultipleItems: $usergroupMultipleItems, usergroupSelectUsers: $usergroupSelectUsers, usergroupSelectGroups: $usergroupSelectGroups, + usergroupSelectTeams: $usergroupSelectTeams, showUserStatus: $showUserStatus ), $selectedViewIds diff --git a/lib/Controller/ApiTablesController.php b/lib/Controller/ApiTablesController.php index 383bb90da..773067f0e 100644 --- a/lib/Controller/ApiTablesController.php +++ b/lib/Controller/ApiTablesController.php @@ -165,6 +165,7 @@ public function createFromScheme(string $title, string $emoji, string $descripti usergroupMultipleItems: $column['usergroupMultipleItems'], usergroupSelectUsers: $column['usergroupSelectUsers'], usergroupSelectGroups: $column['usergroupSelectGroups'], + usergroupSelectTeams: $column['usergroupSelectTeams'], showUserStatus: $column['showUserStatus'], ) ); diff --git a/lib/Controller/ColumnController.php b/lib/Controller/ColumnController.php index df1a9509d..e70f8517e 100644 --- a/lib/Controller/ColumnController.php +++ b/lib/Controller/ColumnController.php @@ -96,6 +96,7 @@ public function create( ?bool $usergroupMultipleItems, ?bool $usergroupSelectUsers, ?bool $usergroupSelectGroups, + ?bool $usergroupSelectTeams, ?bool $showUserStatus, ?array $selectedViewIds @@ -129,6 +130,7 @@ public function create( $usergroupMultipleItems, $usergroupSelectUsers, $usergroupSelectGroups, + $usergroupSelectTeams, $showUserStatus, $selectedViewIds) { @@ -158,6 +160,7 @@ public function create( usergroupMultipleItems: $usergroupMultipleItems, usergroupSelectUsers: $usergroupSelectUsers, usergroupSelectGroups: $usergroupSelectGroups, + usergroupSelectTeams: $usergroupSelectTeams, showUserStatus: $showUserStatus ), $selectedViewIds @@ -195,6 +198,7 @@ public function update( ?bool $usergroupMultipleItems, ?bool $usergroupSelectUsers, ?bool $usergroupSelectGroups, + ?bool $usergroupSelectTeams, ?bool $showUserStatus ): DataResponse { return $this->handleError(function () use ( @@ -226,6 +230,7 @@ public function update( $usergroupMultipleItems, $usergroupSelectUsers, $usergroupSelectGroups, + $usergroupSelectTeams, $showUserStatus ) { return $this->service->update( @@ -254,6 +259,7 @@ public function update( usergroupMultipleItems: $usergroupMultipleItems, usergroupSelectUsers: $usergroupSelectUsers, usergroupSelectGroups: $usergroupSelectGroups, + usergroupSelectTeams: $usergroupSelectTeams, showUserStatus: $showUserStatus ) ); diff --git a/lib/Db/Column.php b/lib/Db/Column.php index 04d1f65a6..3f42a66a1 100644 --- a/lib/Db/Column.php +++ b/lib/Db/Column.php @@ -74,6 +74,8 @@ * @method setUsergroupSelectUsers(?bool $usergroupSelectUsers) * @method getUsergroupSelectGroups(): bool * @method setUsergroupSelectGroups(?bool $usergroupSelectGroups) + * @method getUsergroupSelectTeams(): bool + * @method setUsergroupSelectTeams(?bool $usergroupSelectTeams) * @method getShowUserStatus(): bool * @method setShowUserStatus(?bool $showUserStatus) */ @@ -130,6 +132,7 @@ class Column extends Entity implements JsonSerializable { protected ?bool $usergroupMultipleItems = null; protected ?bool $usergroupSelectUsers = null; protected ?bool $usergroupSelectGroups = null; + protected ?bool $usergroupSelectTeams = null; protected ?bool $showUserStatus = null; public function __construct() { @@ -150,6 +153,7 @@ public function __construct() { $this->addType('usergroupMultipleItems', 'boolean'); $this->addType('usergroupSelectUsers', 'boolean'); $this->addType('usergroupSelectGroups', 'boolean'); + $this->addType('usergroupSelectTeams', 'boolean'); $this->addType('showUserStatus', 'boolean'); } @@ -176,6 +180,7 @@ public static function fromDto(ColumnDto $data): self { $column->setUsergroupMultipleItems($data->getUsergroupMultipleItems()); $column->setUsergroupSelectUsers($data->getUsergroupSelectUsers()); $column->setUsergroupSelectGroups($data->getUsergroupSelectGroups()); + $column->setUsergroupSelectTeams($data->getUsergroupSelectTeams()); $column->setShowUserStatus($data->getShowUserStatus()); return $column; } @@ -252,6 +257,7 @@ public function jsonSerialize(): array { 'usergroupMultipleItems' => $this->usergroupMultipleItems, 'usergroupSelectUsers' => $this->usergroupSelectUsers, 'usergroupSelectGroups' => $this->usergroupSelectGroups, + 'usergroupSelectTeams' => $this->usergroupSelectTeams, 'showUserStatus' => $this->showUserStatus, ]; } diff --git a/lib/Dto/Column.php b/lib/Dto/Column.php index 1c240b4ec..bd3cb34e3 100644 --- a/lib/Dto/Column.php +++ b/lib/Dto/Column.php @@ -30,6 +30,7 @@ public function __construct( private ?bool $usergroupMultipleItems = null, private ?bool $usergroupSelectUsers = null, private ?bool $usergroupSelectGroups = null, + private ?bool $usergroupSelectTeams = null, private ?bool $showUserStatus = null, ) { } @@ -57,6 +58,7 @@ public static function createFromArray(array $data): self { $data['usergroupMultipleItems'] ?? null, $data['usergroupSelectUsers'] ?? null, $data['usergroupSelectGroups'] ?? null, + $data['usergroupSelectTeams'] ?? null, $data['showUserStatus'] ?? null, ); } @@ -145,6 +147,10 @@ public function getUsergroupSelectGroups(): ?bool { return $this->usergroupSelectGroups; } + public function getUsergroupSelectTeams(): ?bool { + return $this->usergroupSelectTeams; + } + public function getShowUserStatus(): ?bool { return $this->showUserStatus; } diff --git a/lib/Migration/Version000000Date20210921000000.php b/lib/Migration/Version000000Date20210921000000.php index a8f03734c..71935daaf 100644 --- a/lib/Migration/Version000000Date20210921000000.php +++ b/lib/Migration/Version000000Date20210921000000.php @@ -181,6 +181,10 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt 'notnull' => false, 'default' => 0, ]); + $table->addColumn('usergroup_select_teams', Types::BOOLEAN, [ + 'notnull' => false, + 'default' => 0, + ]); $table->addColumn('show_user_status', Types::BOOLEAN, [ 'notnull' => false, 'default' => 0, diff --git a/lib/Migration/Version000800Date20240712000000.php b/lib/Migration/Version000800Date20240712000000.php index 726d7929e..677903849 100644 --- a/lib/Migration/Version000800Date20240712000000.php +++ b/lib/Migration/Version000800Date20240712000000.php @@ -77,6 +77,12 @@ private function haveUserGroupColumnDefinitionFields(ISchemaWrapper $schema) { 'default' => 0, ]); } + if (!$table->hasColumn('usergroup_select_teams')) { + $table->addColumn('usergroup_select_teams', Types::BOOLEAN, [ + 'notnull' => false, + 'default' => 0, + ]); + } if (!$table->hasColumn('show_user_status')) { $table->addColumn('show_user_status', Types::BOOLEAN, [ 'notnull' => false, diff --git a/lib/Migration/Version000800Date20240828000000.php b/lib/Migration/Version000800Date20240828000000.php new file mode 100644 index 000000000..96ac21abc --- /dev/null +++ b/lib/Migration/Version000800Date20240828000000.php @@ -0,0 +1,45 @@ +hasTable('tables_columns')) { + if ($schema->hasTable('tables_row_cells_usergroup')) { + $table = $schema->getTable('tables_columns'); + if (!$table->hasColumn('usergroup_select_teams')) { + $table->addColumn('usergroup_select_teams', Types::BOOLEAN, [ + 'notnull' => false, + 'default' => 0, + ]); + } + } + return $schema; + } + return null; + } +} diff --git a/lib/ResponseDefinitions.php b/lib/ResponseDefinitions.php index 5e3826d02..f605e0cde 100644 --- a/lib/ResponseDefinitions.php +++ b/lib/ResponseDefinitions.php @@ -127,6 +127,7 @@ * usergroupMultipleItems: bool, * usergroupSelectUsers: bool, * usergroupSelectGroups: bool, + * usergroupSelectTeams: bool, * showUserStatus: bool, * } * diff --git a/openapi.json b/openapi.json index fddafc065..af842e33f 100644 --- a/openapi.json +++ b/openapi.json @@ -95,6 +95,7 @@ "usergroupMultipleItems", "usergroupSelectUsers", "usergroupSelectGroups", + "usergroupSelectTeams", "showUserStatus" ], "properties": { @@ -190,6 +191,9 @@ "usergroupSelectGroups": { "type": "boolean" }, + "usergroupSelectTeams": { + "type": "boolean" + }, "showUserStatus": { "type": "boolean" } @@ -2996,6 +3000,11 @@ "nullable": true, "description": "Can select groups, if column type is usergroup" }, + "usergroupSelectTeams": { + "type": "boolean", + "nullable": true, + "description": "Can select teams, if column type is usergroup" + }, "usergroupShowUserStatus": { "type": "boolean", "nullable": true, @@ -3345,6 +3354,11 @@ "nullable": true, "description": "Can select groups, if column type is usergroup" }, + "usergroupSelectTeams": { + "type": "boolean", + "nullable": true, + "description": "Can select teams, if column type is usergroup" + }, "usergroupShowUserStatus": { "type": "boolean", "nullable": true, @@ -3559,6 +3573,11 @@ "nullable": true, "description": "Can select groups, if column type is usergroup" }, + "usergroupSelectTeams": { + "type": "boolean", + "nullable": true, + "description": "Can select teams, if column type is usergroup" + }, "usergroupShowUserStatus": { "type": "boolean", "nullable": true, @@ -7913,6 +7932,10 @@ "type": "boolean", "description": "Whether you can select groups" }, + "usergroupSelectTeams": { + "type": "boolean", + "description": "Whether you can select teams" + }, "showUserStatus": { "type": "boolean", "description": "Whether to show the user's status" diff --git a/src/modules/modals/CreateColumn.vue b/src/modules/modals/CreateColumn.vue index 2c5a46c13..e3b0c6d0e 100644 --- a/src/modules/modals/CreateColumn.vue +++ b/src/modules/modals/CreateColumn.vue @@ -181,6 +181,7 @@ export default { usergroupMultipleItems: false, usergroupSelectUsers: true, usergroupSelectGroups: false, + usergroupSelectTeams: false, showUserStatus: false, }, textAppAvailable: !!window.OCA?.Text?.createEditor, @@ -334,6 +335,7 @@ export default { data.usergroupMultipleItems = this.column.usergroupMultipleItems data.usergroupSelectUsers = this.column.usergroupSelectUsers data.usergroupSelectGroups = this.column.usergroupSelectGroups + data.usergroupSelectTeams = this.column.usergroupSelectTeams data.showUserStatus = this.column.showUserStatus } else if (this.column.type === 'number') { data.numberDefault = this.column.numberDefault @@ -387,6 +389,7 @@ export default { usergroupMultipleItems: false, usergroupSelectUsers: true, usergroupSelectGroups: false, + usergroupSelectTeams: false, showUserStatus: false, } if (mainForm) { diff --git a/src/shared/components/ncTable/mixins/columnsTypes/usergroup.js b/src/shared/components/ncTable/mixins/columnsTypes/usergroup.js index aa075756a..3cd565dc8 100644 --- a/src/shared/components/ncTable/mixins/columnsTypes/usergroup.js +++ b/src/shared/components/ncTable/mixins/columnsTypes/usergroup.js @@ -14,6 +14,7 @@ export default class UsergroupColumn extends AbstractUsergroupColumn { this.usergroupMultipleItems = data.usergroupMultipleItems this.usergroupSelectUsers = data.usergroupSelectUsers this.usergroupSelectGroups = data.usergroupSelectGroups + this.usergroupSelectTeams = data.usergroupSelectTeams } getValueString(valueObject) { diff --git a/src/shared/components/ncTable/partials/TableCellUsergroup.vue b/src/shared/components/ncTable/partials/TableCellUsergroup.vue index e225b7fd6..c107556fd 100644 --- a/src/shared/components/ncTable/partials/TableCellUsergroup.vue +++ b/src/shared/components/ncTable/partials/TableCellUsergroup.vue @@ -6,7 +6,7 @@
- +
diff --git a/src/shared/components/ncTable/partials/columnTypePartials/forms/UsergroupForm.vue b/src/shared/components/ncTable/partials/columnTypePartials/forms/UsergroupForm.vue index 0de615f27..003f44057 100644 --- a/src/shared/components/ncTable/partials/columnTypePartials/forms/UsergroupForm.vue +++ b/src/shared/components/ncTable/partials/columnTypePartials/forms/UsergroupForm.vue @@ -6,17 +6,15 @@
- - {{ t('tables', 'Users') }} - - - {{ t('tables', 'Groups') }} - - - {{ t('tables', 'Users and groups') }} + + {{ t('tables', selectOptions[key]) }}
@@ -27,7 +25,7 @@