Skip to content

Commit

Permalink
fix: permission bug fixes, apply additional frontend filters
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp Hempel <Philipp.Hempel1@web.de>
  • Loading branch information
Hephi2 committed Jul 27, 2023
1 parent dab3f20 commit 453f23d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
19 changes: 19 additions & 0 deletions lib/Service/PermissionsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,31 @@ public function canUpdateRowsByViewId(int $viewId, ?string $userId = null): bool
return $this->checkPermissionById($viewId, 'view', 'update', $userId);
}

/**
* @param int $tableId
* @param string|null $userId
* @return bool
*/
public function canUpdateRowsByTableId(int $tableId, ?string $userId = null): bool {
return $this->checkPermissionById($tableId, 'table', 'manage', $userId);
}


/**
* @param int $tableId
* @param string|null $userId
* @return bool
*/
public function canDeleteRowsByViewId(int $viewId, ?string $userId = null): bool {
return $this->checkPermissionById($tableId, 'table', 'manage', $userId);
}

/**
* @param int $tableId
* @param string|null $userId
* @return bool
*/
public function canDeleteRowsByTableId(int $viewId, ?string $userId = null): bool {
return $this->checkPermissionById($viewId, 'view', 'delete', $userId);
}

Expand Down
16 changes: 12 additions & 4 deletions src/shared/components/ncTable/partials/TableHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,23 @@ export default {
data.data.columns = JSON.stringify(this.columns.map(col => col.id))
}
if (this.viewSetting.sorting) {
data.data.sort = JSON.stringify([this.viewSetting.sorting[0]])
data.data.sort = JSON.stringify([...this.view.sort, this.viewSetting.sorting[0]])
}
if (this.viewSetting.filter && this.viewSetting.filter.length !== 0) {
const filteringRules = [this.viewSetting.filter.map(fil => ({
const filteringRules = this.viewSetting.filter.map(fil => ({
columnId: fil.columnId,
operator: fil.operator.id,
value: fil.value,
}))]
data.data.filter = JSON.stringify(filteringRules)
}))
const newFilter = []
if (this.view.filter && this.view.filter.length !== 0) {
this.view.filter.forEach(filterGroup => {
newFilter.push([...filterGroup, ...filteringRules])
})
} else {
newFilter[0] = filteringRules
}
data.data.filter = JSON.stringify(newFilter)
}
return data
},
Expand Down

0 comments on commit 453f23d

Please sign in to comment.