feat: implement list ownership and access control
- Modified createList to assign ownerId to authenticated user - Updated getLists to filter by user access (owner or collaborator) - Added ownership checks to updateList (owner or editor can update) - Added ownership checks to deleteList (only owner can delete) - Implemented access control for all item operations (create, update, delete, toggle) - Updated getItem, searchItems, and getItemsByFilter to enforce access control - Added dynamic rendering to pages that use authentication - Cascade deletion already handled by database schema (onDelete: Cascade) Requirements: 4.1, 4.2, 4.3, 4.5
This commit is contained in:
@@ -4,6 +4,8 @@ import ItemForm from '@/components/ItemForm'
|
||||
import Link from 'next/link'
|
||||
import { ArrowLeft } from 'lucide-react'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
interface PageProps {
|
||||
params: {
|
||||
id: string
|
||||
|
||||
@@ -6,6 +6,8 @@ import { ArrowLeft, Edit } from 'lucide-react'
|
||||
import DeleteItemButton from '@/components/DeleteItemButton'
|
||||
import ToggleItemButton from '@/components/ToggleItemButton'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
interface PageProps {
|
||||
params: {
|
||||
id: string
|
||||
|
||||
@@ -5,6 +5,8 @@ import { ArrowLeft } from 'lucide-react'
|
||||
import InlineItemCreate from '@/components/InlineItemCreate'
|
||||
import ListDetailView from '@/components/ListDetailView'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
export default async function ListDetailPage({ params }: { params: { id: string } }) {
|
||||
const list = await getListWithItems(params.id)
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import NewListButton from '@/components/NewListButton'
|
||||
import GlobalSearch from '@/components/GlobalSearch'
|
||||
import EmptyState from '@/components/EmptyState'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
export default async function Home() {
|
||||
const lists = await getLists()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user