Browse Source

Add fallback

master
parent
commit
eaa503c8f3
Signed by: chris GPG Key ID: 3025DCBD46F81C0F
  1. 1
      cmd/server/main.go
  2. 2
      server/server.go

1
cmd/server/main.go

@ -59,6 +59,7 @@ func main() {
config.Database.Name, config.Database.Name,
config.Database.Port))) config.Database.Port)))
case "sqlite": case "sqlite":
fallthrough
default: default:
db, _ = gorm.Open(sqlite.Open(config.Database.File), &gorm.Config{}) db, _ = gorm.Open(sqlite.Open(config.Database.File), &gorm.Config{})
} }

2
server/server.go

@ -270,7 +270,7 @@ func (m *usersServer) SetRoles(ctx context.Context, in *proto.SetRolesRequest) (
var r models.Role var r models.Role
for _, x := range in.Roles { for _, x := range in.Roles {
if tx := m.db.First(&r, "id = ?", x.Id); tx.RowsAffected != 0 { if tx := m.db.First(&r, "id = ?", x.Id); tx.RowsAffected != 0 {
u.Roles = append(u.Roles, r)
u.Roles = append(u.Roles, &r)
} }
} }

Loading…
Cancel
Save