feat: harden loose-offline sync for user JWT, schema, and console ops
Enable Binding-scoped agent push/pull, empty-table schema ensure, SyncPage inspect/drop-table, default module import, and agent-bound publish docs from the 宇恒联调意见. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1491,7 +1491,7 @@ func EnsurePlatformAdminUser(ctx context.Context, store Store) {
|
||||
if _, err := store.EnsurePlatformAdmin(ctx, "ljk_admin", "ljk_admin", "平台超级管理员"); err != nil {
|
||||
fmt.Printf("ensure platform admin ljk_admin: %v\n", err)
|
||||
}
|
||||
ensureDevPhone(ctx, store, "ljk_admin", "13800000000")
|
||||
ensureDevPhone(ctx, store, "ljk_admin", "13531041945")
|
||||
}
|
||||
|
||||
func ensureDevPhone(ctx context.Context, store Store, username, phone string) {
|
||||
@@ -1508,12 +1508,17 @@ func ensureDevPhone(ctx context.Context, store Store, username, phone string) {
|
||||
if err != nil || user == nil {
|
||||
return
|
||||
}
|
||||
if strings.TrimSpace(user.Phone) != "" {
|
||||
want, nerr := NormalizePhone(phone)
|
||||
if nerr != nil {
|
||||
fmt.Printf("ensure phone for %s: %v\n", username, nerr)
|
||||
return
|
||||
}
|
||||
if _, err := store.BindPhone(ctx, user.UserID, phone); err != nil {
|
||||
fmt.Printf("ensure phone for %s: %v\n", username, err)
|
||||
return
|
||||
cur := strings.TrimSpace(user.Phone)
|
||||
if cur != want {
|
||||
if _, err := store.BindPhone(ctx, user.UserID, want); err != nil {
|
||||
fmt.Printf("ensure phone for %s: %v\n", username, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
_, _ = store.SetUsernameLoginDisabled(ctx, user.UserID, true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user