refactor(migration): remove is_system field update and clean up imports in permission sync
This commit is contained in:
@@ -224,7 +224,6 @@ func ensureBootstrapAdmin(tx *gorm.DB, superAdminRole *models.Role) error {
|
|||||||
if err := repositories.UserRepository.Updates(tx, user.ID, map[string]any{
|
if err := repositories.UserRepository.Updates(tx, user.ID, map[string]any{
|
||||||
"nickname": nickname,
|
"nickname": nickname,
|
||||||
"status": enums.StatusOk,
|
"status": enums.StatusOk,
|
||||||
"is_system": true,
|
|
||||||
"update_user_id": constants.SystemAuditUserID,
|
"update_user_id": constants.SystemAuditUserID,
|
||||||
"update_user_name": constants.SystemAuditUserName,
|
"update_user_name": constants.SystemAuditUserName,
|
||||||
"updated_at": now,
|
"updated_at": now,
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
package migration
|
package migration
|
||||||
|
|
||||||
import (
|
import "github.com/mlogclub/simple/sqls"
|
||||||
"cs-agent/internal/pkg/constants"
|
|
||||||
|
|
||||||
"github.com/mlogclub/simple/sqls"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
register(4, "sync ai agent permissions", func() error {
|
register(4, "sync ai agent permissions", func() error {
|
||||||
@@ -19,11 +15,7 @@ func init() {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = ensureRolePermissions(ctx.Tx, roles, permissions); err != nil {
|
return ensureRolePermissions(ctx.Tx, roles, permissions)
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return ensureBootstrapAdmin(ctx.Tx, roles[constants.RoleCodeSuperAdmin])
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user