Add comprehensive file management system with admin/user separation
Features added: - Admin interface with full CRUD operations and multi-file upload - User interface with read-only access and download functionality - Board-style table layout with pagination (10 items per page) - Category-specific file icons and attachment management - Drag & drop file upload with preview and individual file removal - Individual and bulk download with ZIP compression support - Offline mode with localStorage fallback for both interfaces - Responsive design with modern UI components Technical improvements: - Separated admin (/admin/) and user (/) interfaces - Enhanced file data structure with consistent naming - Improved error handling and user notifications - Multi-file upload processing with base64 encoding - File type detection and appropriate icon mapping - Download functionality with single/multiple file handling 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
39
storage-policies.sql
Normal file
39
storage-policies.sql
Normal file
@@ -0,0 +1,39 @@
|
||||
-- Storage 전용 정책 (Supabase Dashboard → Storage → Policies에서 실행)
|
||||
|
||||
-- 1. 파일 업로드 정책
|
||||
CREATE POLICY "Users can upload to own folder"
|
||||
ON storage.objects
|
||||
FOR INSERT
|
||||
WITH CHECK (
|
||||
bucket_id = 'files' AND
|
||||
auth.uid()::text = (storage.foldername(name))[1]
|
||||
);
|
||||
|
||||
-- 2. 파일 조회 정책
|
||||
CREATE POLICY "Users can view own files"
|
||||
ON storage.objects
|
||||
FOR SELECT
|
||||
USING (
|
||||
bucket_id = 'files' AND
|
||||
auth.uid()::text = (storage.foldername(name))[1]
|
||||
);
|
||||
|
||||
-- 3. 파일 업데이트 정책
|
||||
CREATE POLICY "Users can update own files"
|
||||
ON storage.objects
|
||||
FOR UPDATE
|
||||
USING (
|
||||
bucket_id = 'files' AND
|
||||
auth.uid()::text = (storage.foldername(name))[1]
|
||||
);
|
||||
|
||||
-- 4. 파일 삭제 정책
|
||||
CREATE POLICY "Users can delete own files"
|
||||
ON storage.objects
|
||||
FOR DELETE
|
||||
USING (
|
||||
bucket_id = 'files' AND
|
||||
auth.uid()::text = (storage.foldername(name))[1]
|
||||
);
|
||||
|
||||
-- 참고: storage.foldername(name)[1]은 'user_id/filename.txt'에서 'user_id' 부분을 추출합니다.
|
Reference in New Issue
Block a user