mirror of
https://github.com/paralus/paralus.git
synced 2026-05-20 07:12:54 +00:00
Merge pull request #122 from RafayLabs/synchronizer-omit-trashed
[synchronizer] Omit trash oidc providers in synchronizing
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/cloudflare/cfssl/log"
|
||||
"github.com/google/uuid"
|
||||
"github.com/uptrace/bun"
|
||||
"github.com/uptrace/bun/dialect/pgdialect"
|
||||
"github.com/uptrace/bun/driver/pgdriver"
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
Id uuid.UUID `bun:"id,type:uuid"`
|
||||
Id string `bun:"name"`
|
||||
Provider string `bun:"provider_name,notnull"`
|
||||
MapperURL string `bun:"mapper_url" yaml:"mapper_url"`
|
||||
ClientId string `bun:"client_id,notnull" yaml:"client_id"`
|
||||
@@ -43,7 +42,7 @@ type Config struct {
|
||||
var ProvidersDB []Provider
|
||||
|
||||
func sync(ctx context.Context, db *bun.DB, path string) error {
|
||||
err := db.NewSelect().Model(&ProvidersDB).ModelTableExpr("authsrv_oidc_provider AS provider").Scan(ctx)
|
||||
err := db.NewSelect().Model(&ProvidersDB).ModelTableExpr("authsrv_oidc_provider AS provider").Where("trash = 'f'").Scan(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to fetch providers from DB: %s", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user