hazo_auth 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/SETUP_CHECKLIST.md +65 -1
  2. package/package.json +1 -1
@@ -306,8 +306,14 @@ sqlite3 data/hazo_auth.sqlite ".tables"
306
306
 
307
307
  Run this SQL script in your PostgreSQL database:
308
308
 
309
+ **Important:** Run the entire script in order. The enum type must be created before the table that uses it.
310
+
309
311
  ```sql
310
- -- Create enum type
312
+ -- Ensure we're in the public schema (or your target schema)
313
+ SET search_path TO public;
314
+
315
+ -- Create enum type (drop first if it exists to avoid conflicts)
316
+ DROP TYPE IF EXISTS hazo_enum_profile_source_enum CASCADE;
311
317
  CREATE TYPE hazo_enum_profile_source_enum AS ENUM ('gravatar', 'custom', 'predefined');
312
318
 
313
319
  -- Create users table
@@ -387,6 +393,64 @@ SELECT table_name FROM information_schema.tables WHERE table_name LIKE 'hazo_%';
387
393
  -- Expected: 6 tables listed
388
394
  ```
389
395
 
396
+ **Grant access to admin user:**
397
+
398
+ After creating the tables, grant appropriate permissions to your admin database user. Replace `your_admin_user` with your actual PostgreSQL username:
399
+
400
+ ```sql
401
+ -- Grant usage on schema (usually 'public')
402
+ GRANT USAGE ON SCHEMA public TO your_admin_user;
403
+
404
+ -- Grant all privileges on all hazo_* tables
405
+ GRANT ALL PRIVILEGES ON TABLE hazo_users TO your_admin_user;
406
+ GRANT ALL PRIVILEGES ON TABLE hazo_refresh_tokens TO your_admin_user;
407
+ GRANT ALL PRIVILEGES ON TABLE hazo_permissions TO your_admin_user;
408
+ GRANT ALL PRIVILEGES ON TABLE hazo_roles TO your_admin_user;
409
+ GRANT ALL PRIVILEGES ON TABLE hazo_role_permissions TO your_admin_user;
410
+ GRANT ALL PRIVILEGES ON TABLE hazo_user_roles TO your_admin_user;
411
+
412
+ -- Grant usage on the enum type
413
+ GRANT USAGE ON TYPE hazo_enum_profile_source_enum TO your_admin_user;
414
+
415
+ -- Grant privileges on sequences (if using SERIAL instead of UUID, though not needed for UUID)
416
+ -- GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO your_admin_user;
417
+
418
+ -- Optional: Grant privileges on future tables (if you plan to add more hazo_* tables)
419
+ ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO your_admin_user;
420
+ ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON SEQUENCES TO your_admin_user;
421
+ ```
422
+
423
+ **For PostgREST/API access (if using PostgREST):**
424
+
425
+ If you're using PostgREST, you'll typically use an `anon` role for unauthenticated access and an `authenticated` role for authenticated users. Grant appropriate permissions:
426
+
427
+ ```sql
428
+ -- Create roles if they don't exist
429
+ -- CREATE ROLE anon;
430
+ -- CREATE ROLE authenticated;
431
+
432
+ -- Grant usage on schema
433
+ GRANT USAGE ON SCHEMA public TO anon, authenticated;
434
+
435
+ -- Grant select on tables for anon (public read access)
436
+ GRANT SELECT ON TABLE hazo_users TO anon;
437
+ GRANT SELECT ON TABLE hazo_permissions TO anon;
438
+ GRANT SELECT ON TABLE hazo_roles TO anon;
439
+ GRANT SELECT ON TABLE hazo_role_permissions TO anon;
440
+ GRANT SELECT ON TABLE hazo_user_roles TO anon;
441
+
442
+ -- Grant full access to authenticated users (adjust based on your RLS policies)
443
+ GRANT ALL PRIVILEGES ON TABLE hazo_users TO authenticated;
444
+ GRANT ALL PRIVILEGES ON TABLE hazo_refresh_tokens TO authenticated;
445
+ GRANT ALL PRIVILEGES ON TABLE hazo_permissions TO authenticated;
446
+ GRANT ALL PRIVILEGES ON TABLE hazo_roles TO authenticated;
447
+ GRANT ALL PRIVILEGES ON TABLE hazo_role_permissions TO authenticated;
448
+ GRANT ALL PRIVILEGES ON TABLE hazo_user_roles TO authenticated;
449
+
450
+ -- Grant usage on enum type
451
+ GRANT USAGE ON TYPE hazo_enum_profile_source_enum TO anon, authenticated;
452
+ ```
453
+
390
454
  **Checklist:**
391
455
  - [ ] Database created (SQLite file or PostgreSQL)
392
456
  - [ ] All 6 tables exist: `hazo_users`, `hazo_refresh_tokens`, `hazo_permissions`, `hazo_roles`, `hazo_role_permissions`, `hazo_user_roles`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hazo_auth",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",