Sync docs/Readme.gs

This commit is contained in:
2026-04-24 23:44:55 +00:00
parent 8301255dd6
commit 80f5e33f36
+92
View File
@@ -0,0 +1,92 @@
/**
* 📘 SCHOOLHUB LAUNCHER - PROJECT DOCUMENTATION
* =============================================================================
*
* 1. OVERVIEW
* -----------
* SchoolHub Launcher is a centralized portal designed for school environments.
* It allows administrators to manage a list of internal applications and
* control which users have access to which apps based on their roles.
*
* CORE STACK:
* - Backend: Google Apps Script (GAS)
* - Database: Google Sheets
* - Frontend: Alpine.js, Tailwind CSS, Framework7 (Mobile UI)
* - Auth: Google Account & WhatsApp OTP (via GoWhatsApp API)
*
* 2. QUICK START SETUP
* --------------------
* To get the application running for the first time:
*
* STEP 1: Spreadsheet Connection
* - Ensure the SPREADSHEET_ID in Code.gs matches your target Google Sheet ID.
*
* STEP 2: Database Initialization
* - In the Script Editor, select the function `setupDatabase` from the dropdown.
* - Click "Run". This creates all necessary tabs (Users, Access, Apps, etc.)
* and sets up the header rows.
*
* STEP 3: Deployment
* - Click "Deploy" -> "New Deployment".
* - Select "Web App".
* - Execute as: "Me".
* - Who has access: "Anyone" (The app handles its own internal authentication).
*
* STEP 4: First Admin
* - Open the Web App URL.
* - Since the system is empty, it will prompt you to register as the First Administrator.
*
* 3. DATABASE SCHEMA (Google Sheets)
* ----------------------------------
* The system relies on these specific tabs:
*
* | Tab Name | Purpose | Key Columns |
* |-------------|----------------------------------------------|-----------------------------------|
* | Users | Registered users and global admin status | email, name, status, isAdmin |
* | Access | App-specific permissions (RBAC) | email, appId, roles, active |
* | Apps | Registry of available applications | appId, appName, appUrl, sortOrder |
* | AuditLog | History of access and admin actions | timestamp, email, action, status |
* | OTP | Temporary storage for WhatsApp verification | phone, code, expiresAt |
* | Sessions | Active session tokens | sessionId, email, expiresAt |
* | SystemDocs | Global system documentation/settings | docType, content, updatedAt |
*
* 4. CONFIGURATION
* -----------------
* To modify system behavior, look for these constants in Code.gs:
*
* - SPREADSHEET_ID: The ID of the Google Sheet used as the DB.
* - GO_WHATSAPP_API_KEY: Your API key for the GoWhatsApp service.
* - GO_WHATSAPP_URL: The endpoint for sending WhatsApp messages.
*
* 5. PERMISSION LOGIC (RBAC)
* --------------------------
* - Global Admin: If a user has `isAdmin = TRUE` in the 'Users' sheet, they
* can see ALL apps and access the Admin Dashboard.
* - App Access: For non-admins, the system checks the 'Access' sheet.
* A user must have an 'active' row matching the `appId` to see that app.
* - Roles: Roles (viewer, editor, admin) are stored in the 'Access' sheet
* and can be passed to the target app to handle internal permissions.
*
* 6. MAINTENANCE & TROUBLESHOOTING
* --------------------------------
* - Cache Issues: The system uses CacheService for performance. If you
* manually edit the Sheet and don't see changes, wait 5 minutes or
* restart the browser.
* - OTP Failures: Ensure the phone number in the 'Users' sheet matches
* the number used during login (including country code).
* - Deployment: Whenever you change Code.gs, remember to create a
* "New Deployment" or update the "Active" deployment to see changes.
*
* 7. CHANGELOG
* -------------
* [2023-10-27] - v1.1.0
* - Fitur: Tambah sistem OTP WhatsApp.
* - Perbaikan: Fix bug pada filter kategori user.
* - Perubahan: Update UI Navbar menjadi lebih minimalis.
*
* [2023-10-20] - v1.0.0
* - Initial Release: Dashboard, User Management, App Launcher.
*
*
* =============================================================================
*/