Add comprehensive human-readable comments to all Go files
- Comments explain what each function does and why - Fixed unused strconv import in queue.go - Better documentation for SMTP email service - Explained journalctl log parsing in logs.go - Clarified queue operations in queue.go
This commit is contained in:
parent
3e3620a24f
commit
68285d861a
9 changed files with 728 additions and 203 deletions
|
|
@ -1,18 +1,23 @@
|
|||
package auth
|
||||
|
||||
// Role represents a user's role in the system.
|
||||
type Role string
|
||||
|
||||
// Predefined roles.
|
||||
const (
|
||||
RoleAdmin Role = "admin"
|
||||
RoleUser Role = "user"
|
||||
RoleAdmin Role = "admin" // Full access to all features
|
||||
RoleUser Role = "user" // Limited access (not currently used)
|
||||
)
|
||||
|
||||
// Context holds the authenticated user's information.
|
||||
// This is stored in the request context during authentication.
|
||||
type Context struct {
|
||||
UserID uint
|
||||
Username string
|
||||
Role Role
|
||||
UserID uint // The user's database ID
|
||||
Username string // The user's username for display
|
||||
Role Role // The user's role (admin or user)
|
||||
}
|
||||
|
||||
// IsAdmin checks if the user has admin privileges.
|
||||
func (c *Context) IsAdmin() bool {
|
||||
return c.Role == RoleAdmin
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue