feat(auth): add Casbin RBAC and user activity tracking
Integrate Casbin for role-based access control with admin routes for role management. Add user activity logging service to track login and refresh events. Refactor audit service to use AI-based content moderation.
This commit is contained in:
22
internal/config/casbin.go
Normal file
22
internal/config/casbin.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package config
|
||||
|
||||
// CasbinConfig Casbin 配置
|
||||
type CasbinConfig struct {
|
||||
// ModelPath Casbin 模型文件路径
|
||||
ModelPath string `mapstructure:"model_path"`
|
||||
|
||||
// AutoSave 是否自动保存策略到数据库
|
||||
AutoSave bool `mapstructure:"auto_save"`
|
||||
|
||||
// AutoLoad 是否自动从数据库加载策略
|
||||
AutoLoad bool `mapstructure:"auto_load"`
|
||||
|
||||
// EnableCache 是否启用 Redis 缓存
|
||||
EnableCache bool `mapstructure:"enable_cache"`
|
||||
|
||||
// CacheTTL 缓存过期时间 (秒)
|
||||
CacheTTL int `mapstructure:"cache_ttl"`
|
||||
|
||||
// SkipRoutes 跳过权限检查的路由
|
||||
SkipRoutes []string `mapstructure:"skip_routes"`
|
||||
}
|
||||
Reference in New Issue
Block a user