完善角色权限与数据隔离
This commit is contained in:
@@ -19,10 +19,11 @@ func main() {
|
||||
}
|
||||
|
||||
func seed() {
|
||||
// 默认后台管理员:kefu_admin / kefu_admin123(其它种子账号同密码)
|
||||
hash, _ := bcrypt.GenerateFromPassword([]byte("kefu_admin123"), bcrypt.DefaultCost)
|
||||
pwd := string(hash)
|
||||
|
||||
model.EnsurePermissions()
|
||||
|
||||
// Plans
|
||||
plans := []model.Plan{
|
||||
{Name: "基础版", PriceMonthly: 299, Seats: 2, StorageDays: 30, KBLimit: 50, Status: "active", Features: `{"stats":"basic","api":false,"channels":["web"],"brand":false}`},
|
||||
@@ -42,6 +43,11 @@ func seed() {
|
||||
}
|
||||
model.DB.Create(&tenants)
|
||||
|
||||
// 为每个租户创建内置角色及默认权限
|
||||
for _, t := range tenants {
|
||||
model.EnsureBuiltinRoles(t.ID)
|
||||
}
|
||||
|
||||
// Platform admin
|
||||
model.DB.Create(&model.User{
|
||||
TenantID: 0, Role: "platform_admin", Username: "platform_admin", PasswordHash: pwd, Nickname: "平台管理员", Status: "online",
|
||||
|
||||
Reference in New Issue
Block a user