Your workspace is ready
-diff --git a/src/core/auth/session.go b/src/core/auth/session.go
index fedf88a..b8de9bb 100644
--- a/src/core/auth/session.go
+++ b/src/core/auth/session.go
@@ -15,18 +15,19 @@ import (
type contextKey string
const (
- // ContextUserID is the key for the authenticated user's ID.
ContextUserID contextKey = "user_id"
+ ContextRole contextKey = "role"
)
// SessionStore manages user sessions backed by SQLite.
type SessionStore struct {
- db *sql.DB
+ db *sql.DB
+ roleDB *sql.DB // Optional: same DB, used for role lookups
}
// NewSessionStore creates a session store.
func NewSessionStore(db *sql.DB) *SessionStore {
- return &SessionStore{db: db}
+ return &SessionStore{db: db, roleDB: db}
}
// Session represents an authenticated user session.
@@ -120,7 +121,15 @@ func (s *SessionStore) SessionMiddleware(next http.Handler) http.Handler {
}
// Set user_id in context
+ // Set user_id and role in context
ctx := context.WithValue(r.Context(), ContextUserID, session.UserID)
+ // Look up role from database
+ var role string
+ s.roleDB.QueryRow("SELECT role FROM users WHERE username = ?", session.UserID).Scan(&role)
+ if role == "" {
+ role = "user"
+ }
+ ctx = context.WithValue(ctx, ContextRole, role)
next.ServeHTTP(w, r.WithContext(ctx))
})
}
diff --git a/src/core/ui/app-grid.templ b/src/core/ui/app-grid.templ
index 656aa34..0a1a1dd 100644
--- a/src/core/ui/app-grid.templ
+++ b/src/core/ui/app-grid.templ
@@ -1,107 +1,107 @@
package ui
-import "fmt"
-
-// AppTile represents an application card on the workspace launcher.
+// AppTile represents an app on the workspace launcher.
type AppTile struct {
Name string
Description string
URL string
- Icon string // Emoji or SVG
- Color string // Background color for icon
- Status string // "ready", "coming-soon", "beta"
+ Icon string // SVG inline
+ Color string // Background color
+ Status string // "ready" or "coming-soon"
+ AdminOnly bool // Only visible to admin role
}
-// DefaultApps returns the default set of workspace apps.
-// These are placeholder tiles until supervisor modules are built.
-func DefaultApps() []AppTile {
- return []AppTile{
+// DefaultApps returns apps filtered by user role.
+func DefaultApps(role string) []AppTile {
+ all := []AppTile{
{
- Name: "Admin Panel",
- Description: "Manage users, groups, and workspace settings",
- URL: "/admin",
- Icon: "⚙️",
- Color: "#1e293b",
- Status: "ready",
+ Name: "Admin Panel", Description: "Users, groups & settings",
+ URL: "/admin", Color: "#9333ea",
+ Icon: ``,
+ Status: "ready", AdminOnly: true,
},
{
- Name: "Files",
- Description: "Coming soon — File storage and sharing",
- URL: "#",
- Icon: "📁",
- Color: "#1e293b",
- Status: "coming-soon",
+ Name: "Files", Description: "Storage & sharing",
+ URL: "#", Color: "#2563eb",
+ Icon: ``,
+ Status: "coming-soon",
},
{
- Name: "Calendar",
- Description: "Coming soon — Schedule and events",
- URL: "#",
- Icon: "📅",
- Color: "#1e293b",
- Status: "coming-soon",
+ Name: "Mail", Description: "Email client",
+ URL: "#", Color: "#dc2626",
+ Icon: ``,
+ Status: "coming-soon",
},
{
- Name: "Mail",
- Description: "Coming soon — Email integration",
- URL: "#",
- Icon: "✉️",
- Color: "#1e293b",
- Status: "coming-soon",
+ Name: "Calendar", Description: "Schedule & events",
+ URL: "#", Color: "#059669",
+ Icon: ``,
+ Status: "coming-soon",
},
{
- Name: "Office",
- Description: "Coming soon — Documents and spreadsheets",
- URL: "#",
- Icon: "📝",
- Color: "#1e293b",
- Status: "coming-soon",
+ Name: "Office", Description: "Documents & sheets",
+ URL: "#", Color: "#0891b2",
+ Icon: ``,
+ Status: "coming-soon",
},
{
- Name: "Settings",
- Description: "Coming soon — Workspace preferences",
- URL: "#",
- Icon: "🔧",
- Color: "#1e293b",
- Status: "coming-soon",
+ Name: "Contacts", Description: "People & directory",
+ URL: "#", Color: "#d97706",
+ Icon: ``,
+ Status: "coming-soon",
+ },
+ {
+ Name: "Tasks", Description: "Project management",
+ URL: "#", Color: "#7c3aed",
+ Icon: ``,
+ Status: "coming-soon",
+ },
+ {
+ Name: "Chat", Description: "Team messaging",
+ URL: "#", Color: "#db2777",
+ Icon: ``,
+ Status: "coming-soon",
},
}
+
+ // Filter by role
+ filtered := make([]AppTile, 0, len(all))
+ for _, a := range all {
+ if a.AdminOnly && role != "admin" {
+ continue
+ }
+ filtered = append(filtered, a)
+ }
+ return filtered
}
templ AppGrid(apps []AppTile) {
-
- Applications
-
-