ultisuite-backend/migrations/000012_admin_user_lifecycle.up.sql
R3D347HR4Y e10e60fc9e Implement comprehensive user management and admin RBAC features
- Introduced CRUD operations for user management, including create, invite, update, disable, and reactivate functionalities.
- Enhanced user listing with filtering options based on status and search queries.
- Implemented multi-service quota management for users, allowing specification of mail, drive, and photos storage limits.
- Added audit log export functionality with validation for format and limit parameters.
- Established strict RBAC for admin routes, ensuring proper permission checks for read and write operations.
- Updated validation logic for user-related requests and improved error handling across the user management API.
- Revised database schema to support new user status and quota fields, along with necessary migrations.
- Updated project checklist to reflect the completion of user management and admin RBAC enhancements.
2026-05-22 22:41:58 +02:00

20 lines
564 B
SQL

ALTER TABLE users
ADD COLUMN IF NOT EXISTS status TEXT NOT NULL DEFAULT 'active',
ADD COLUMN IF NOT EXISTS invited_at TIMESTAMPTZ NULL,
ADD COLUMN IF NOT EXISTS disabled_at TIMESTAMPTZ NULL;
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1
FROM pg_constraint
WHERE conname = 'users_status_valid_chk'
) THEN
ALTER TABLE users
ADD CONSTRAINT users_status_valid_chk
CHECK (status IN ('active', 'disabled', 'invited'));
END IF;
END $$;
CREATE INDEX IF NOT EXISTS idx_users_status ON users(status);