- 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.
20 lines
564 B
SQL
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);
|