feat: add Winter user groups
- user_groups (seeded with the guest and registered groups) and the users_groups pivot, folded from the PHP v1.1.1 and v2.8.0 migrations into migration 202610020001_create_user_groups - models.UserGroup and a User.Groups relation that is never serialized - classes.UserGroupCodes and classes.HasGroupCode for server-side checks such as the site-admin group code admin - additive only: no route, payload or existing column changes; the user payload still answers "groups":[]
This commit is contained in:
@@ -47,7 +47,8 @@ func TestExtendUsersMigration(t *testing.T) {
|
||||
if !row.HasSelfSetPassword || row.IsActivated || row.MarketingConsent || row.IsOnboarded {
|
||||
t.Fatalf("defaults = %+v", row)
|
||||
}
|
||||
for range 3 {
|
||||
// user groups, jwt blacklist, throttle, then extend-users.
|
||||
for range 4 {
|
||||
if err := m.RollbackLast(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -86,11 +87,11 @@ func TestCreateUserThrottleMigration(t *testing.T) {
|
||||
t.Fatalf("missing column %s", col)
|
||||
}
|
||||
}
|
||||
if err := m.RollbackLast(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := m.RollbackLast(); err != nil {
|
||||
t.Fatal(err)
|
||||
// user groups, jwt blacklist, then throttle.
|
||||
for range 3 {
|
||||
if err := m.RollbackLast(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
if gdb.Migrator().HasTable("user_throttle") {
|
||||
t.Fatal("user_throttle survived rollback")
|
||||
@@ -118,8 +119,11 @@ func TestCreateJwtBlacklistMigration(t *testing.T) {
|
||||
t.Fatalf("missing column %s", col)
|
||||
}
|
||||
}
|
||||
if err := m.RollbackLast(); err != nil {
|
||||
t.Fatal(err)
|
||||
// user groups, then jwt blacklist.
|
||||
for range 2 {
|
||||
if err := m.RollbackLast(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
if gdb.Migrator().HasTable("jwt_blacklist") {
|
||||
t.Fatal("jwt_blacklist survived rollback")
|
||||
|
||||
Reference in New Issue
Block a user