mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 20:47:22 +00:00
fix: correct imports (#1630)
* fix: correct import for errors * fix: add missing translations * fix(eventstore): index * fix(eventstore): use table instead of index * fix(proto): correct info * fix(migrations): use eventstore
This commit is contained in:
parent
c223a9ed61
commit
c919fd6f13
@ -17,7 +17,7 @@ title: zitadel/policy.proto
|
||||
| Name | Number | Description |
|
||||
| ---- | ------ | ----------- |
|
||||
| MULTI_FACTOR_TYPE_UNSPECIFIED | 0 | - |
|
||||
| MULTI_FACTOR_TYPE_U2F_WITH_VERIFICATION | 1 | TODO: what does livio think after the weekend? :D |
|
||||
| MULTI_FACTOR_TYPE_U2F_WITH_VERIFICATION | 1 | - |
|
||||
|
||||
|
||||
|
||||
|
@ -7,13 +7,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/caos/logging"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
|
||||
"github.com/caos/zitadel/internal/authz/repository/eventsourcing/view"
|
||||
"github.com/caos/zitadel/internal/crypto"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1"
|
||||
v1 "github.com/caos/zitadel/internal/eventstore/v1"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk"
|
||||
features_view_model "github.com/caos/zitadel/internal/features/repository/view/model"
|
||||
@ -211,7 +209,7 @@ func (u *TokenVerifierRepo) getIAMByID(ctx context.Context) (*iam_model.IAM, err
|
||||
},
|
||||
}
|
||||
err = es_sdk.Filter(ctx, u.Eventstore.FilterEvents, iam.AppendEvents, query)
|
||||
if err != nil && errors.IsNotFound(err) && iam.Sequence == 0 {
|
||||
if err != nil && caos_errs.IsNotFound(err) && iam.Sequence == 0 {
|
||||
return nil, err
|
||||
}
|
||||
return iam_es_model.IAMToModel(iam), nil
|
||||
@ -219,14 +217,14 @@ func (u *TokenVerifierRepo) getIAMByID(ctx context.Context) (*iam_model.IAM, err
|
||||
|
||||
func (repo *TokenVerifierRepo) checkDefaultFeatures(ctx context.Context, requiredFeatures ...string) error {
|
||||
features, viewErr := repo.View.FeaturesByAggregateID(domain.IAMID)
|
||||
if viewErr != nil && !errors.IsNotFound(viewErr) {
|
||||
if viewErr != nil && !caos_errs.IsNotFound(viewErr) {
|
||||
return viewErr
|
||||
}
|
||||
if errors.IsNotFound(viewErr) {
|
||||
if caos_errs.IsNotFound(viewErr) {
|
||||
features = new(features_view_model.FeaturesView)
|
||||
}
|
||||
events, esErr := repo.getIAMEvents(ctx, features.Sequence)
|
||||
if errors.IsNotFound(viewErr) && len(events) == 0 {
|
||||
if caos_errs.IsNotFound(viewErr) && len(events) == 0 {
|
||||
return checkFeatures(features, requiredFeatures...)
|
||||
}
|
||||
if esErr != nil {
|
||||
|
@ -2,13 +2,13 @@ package eventstore
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1"
|
||||
|
||||
v1 "github.com/caos/zitadel/internal/eventstore/v1"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk"
|
||||
iam_model "github.com/caos/zitadel/internal/iam/model"
|
||||
iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model"
|
||||
iam_view "github.com/caos/zitadel/internal/iam/repository/view"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
|
||||
"github.com/caos/zitadel/internal/api/authz"
|
||||
"github.com/caos/zitadel/internal/authz/repository/eventsourcing/view"
|
||||
@ -134,7 +134,7 @@ func (u *UserGrantRepo) getIAMByID(ctx context.Context) (*iam_model.IAM, error)
|
||||
},
|
||||
}
|
||||
err = es_sdk.Filter(ctx, u.Eventstore.FilterEvents, iam.AppendEvents, query)
|
||||
if err != nil && errors.IsNotFound(err) && iam.Sequence == 0 {
|
||||
if err != nil && caos_errs.IsNotFound(err) && iam.Sequence == 0 {
|
||||
return nil, err
|
||||
}
|
||||
return iam_es_model.IAMToModel(iam), nil
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"github.com/lib/pq"
|
||||
"regexp"
|
||||
"strconv"
|
||||
|
||||
@ -12,6 +11,7 @@ import (
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/repository"
|
||||
"github.com/cockroachdb/cockroach-go/v2/crdb"
|
||||
"github.com/lib/pq"
|
||||
|
||||
//sql import for cockroach
|
||||
_ "github.com/lib/pq"
|
||||
|
@ -3,22 +3,19 @@ package eventstore
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1"
|
||||
es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk"
|
||||
iam_model "github.com/caos/zitadel/internal/iam/model"
|
||||
iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model"
|
||||
iam_view "github.com/caos/zitadel/internal/iam/repository/view"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/caos/logging"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
|
||||
"github.com/caos/zitadel/internal/api/authz"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
v1 "github.com/caos/zitadel/internal/eventstore/v1"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk"
|
||||
iam_model "github.com/caos/zitadel/internal/iam/model"
|
||||
iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model"
|
||||
iam_view "github.com/caos/zitadel/internal/iam/repository/view"
|
||||
key_model "github.com/caos/zitadel/internal/key/model"
|
||||
key_view_model "github.com/caos/zitadel/internal/key/repository/view/model"
|
||||
"github.com/caos/zitadel/internal/management/repository/eventsourcing/view"
|
||||
@ -28,6 +25,7 @@ import (
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
usr_view "github.com/caos/zitadel/internal/user/repository/view"
|
||||
usr_es_model "github.com/caos/zitadel/internal/user/repository/view/model"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
)
|
||||
|
||||
type ProjectRepo struct {
|
||||
@ -534,7 +532,7 @@ func (repo *ProjectRepo) userByID(ctx context.Context, id string) (*usr_model.Us
|
||||
user = new(usr_es_model.UserView)
|
||||
}
|
||||
events, esErr := repo.getUserEvents(ctx, id, user.Sequence)
|
||||
if errors.IsNotFound(viewErr) && len(events) == 0 {
|
||||
if caos_errs.IsNotFound(viewErr) && len(events) == 0 {
|
||||
return nil, caos_errs.ThrowNotFound(nil, "EVENT-4n8Fs", "Errors.User.NotFound")
|
||||
}
|
||||
if esErr != nil {
|
||||
@ -674,7 +672,7 @@ func (u *ProjectRepo) GetIAMByID(ctx context.Context) (*iam_model.IAM, error) {
|
||||
},
|
||||
}
|
||||
err = es_sdk.Filter(ctx, u.Eventstore.FilterEvents, iam.AppendEvents, query)
|
||||
if err != nil && errors.IsNotFound(err) && iam.Sequence == 0 {
|
||||
if err != nil && caos_errs.IsNotFound(err) && iam.Sequence == 0 {
|
||||
return nil, err
|
||||
}
|
||||
return iam_es_model.IAMToModel(iam), nil
|
||||
|
@ -2,27 +2,24 @@ package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1"
|
||||
|
||||
"github.com/caos/logging"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk"
|
||||
org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model"
|
||||
org_view "github.com/caos/zitadel/internal/org/repository/view"
|
||||
proj_view "github.com/caos/zitadel/internal/project/repository/view"
|
||||
"github.com/caos/zitadel/internal/user/repository/view"
|
||||
usr_view_model "github.com/caos/zitadel/internal/user/repository/view/model"
|
||||
|
||||
v1 "github.com/caos/zitadel/internal/eventstore/v1"
|
||||
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/query"
|
||||
es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/spooler"
|
||||
org_model "github.com/caos/zitadel/internal/org/model"
|
||||
org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model"
|
||||
org_view "github.com/caos/zitadel/internal/org/repository/view"
|
||||
proj_model "github.com/caos/zitadel/internal/project/model"
|
||||
proj_es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model"
|
||||
proj_view "github.com/caos/zitadel/internal/project/repository/view"
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
usr_es_model "github.com/caos/zitadel/internal/user/repository/eventsourcing/model"
|
||||
"github.com/caos/zitadel/internal/user/repository/view"
|
||||
usr_view_model "github.com/caos/zitadel/internal/user/repository/view/model"
|
||||
grant_es_model "github.com/caos/zitadel/internal/usergrant/repository/eventsourcing/model"
|
||||
view_model "github.com/caos/zitadel/internal/usergrant/repository/view/model"
|
||||
)
|
||||
@ -297,7 +294,7 @@ func (u *UserGrant) getProjectByID(ctx context.Context, projID string) (*proj_mo
|
||||
},
|
||||
}
|
||||
err = es_sdk.Filter(ctx, u.Eventstore().FilterEvents, esProject.AppendEvents, query)
|
||||
if err != nil && !errors.IsNotFound(err) {
|
||||
if err != nil && !caos_errs.IsNotFound(err) {
|
||||
return nil, err
|
||||
}
|
||||
if esProject.Sequence == 0 {
|
||||
|
@ -2,25 +2,21 @@ package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk"
|
||||
org_view "github.com/caos/zitadel/internal/org/repository/view"
|
||||
proj_model "github.com/caos/zitadel/internal/project/model"
|
||||
proj_view "github.com/caos/zitadel/internal/project/repository/view"
|
||||
|
||||
"github.com/caos/logging"
|
||||
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
v1 "github.com/caos/zitadel/internal/eventstore/v1"
|
||||
es_models "github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/query"
|
||||
es_sdk "github.com/caos/zitadel/internal/eventstore/v1/sdk"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/spooler"
|
||||
iam_es_model "github.com/caos/zitadel/internal/iam/repository/eventsourcing/model"
|
||||
org_model "github.com/caos/zitadel/internal/org/model"
|
||||
org_es_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model"
|
||||
org_view "github.com/caos/zitadel/internal/org/repository/view"
|
||||
proj_model "github.com/caos/zitadel/internal/project/model"
|
||||
proj_es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model"
|
||||
proj_view "github.com/caos/zitadel/internal/project/repository/view"
|
||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||
"github.com/caos/zitadel/internal/user/repository/eventsourcing/model"
|
||||
usr_es_model "github.com/caos/zitadel/internal/user/repository/view/model"
|
||||
@ -295,7 +291,7 @@ func (u *UserMembership) getProjectByID(ctx context.Context, projID string) (*pr
|
||||
},
|
||||
}
|
||||
err = es_sdk.Filter(ctx, u.Eventstore().FilterEvents, esProject.AppendEvents, query)
|
||||
if err != nil && !errors.IsNotFound(err) {
|
||||
if err != nil && !caos_errs.IsNotFound(err) {
|
||||
return nil, err
|
||||
}
|
||||
if esProject.Sequence == 0 {
|
||||
|
@ -316,6 +316,8 @@ Errors:
|
||||
AlreadyExists: Schritt gestartet existiert bereits
|
||||
Done:
|
||||
AlreadyExists: Schritt ausgeführt existiert bereits
|
||||
Features:
|
||||
NotChanged: Feature hat nicht geändert
|
||||
EventTypes:
|
||||
user:
|
||||
added: Benutzer hinzugefügt
|
||||
@ -556,6 +558,10 @@ EventTypes:
|
||||
added: Passwort Sperrungs Richtlinie hinzugefügt
|
||||
changed: Passwort Sperrungs Richtlinie geändert
|
||||
removed: Passwort Sperrungs Richtlinie gelöscht
|
||||
label:
|
||||
added: Label Richtline hinzugefügt
|
||||
changed: Label Richtline geändert
|
||||
removed: Label Richtline entfernt
|
||||
project:
|
||||
added: Projekt hinzugefügt
|
||||
changed: Project geändert
|
||||
|
@ -317,6 +317,8 @@ Errors:
|
||||
AlreadyExists: Step started already exists
|
||||
Done:
|
||||
AlreadyExists: Step done already exists
|
||||
Features:
|
||||
NotChanged: Feature hat nicht geändert
|
||||
EventTypes:
|
||||
user:
|
||||
added: User added
|
||||
@ -557,6 +559,10 @@ EventTypes:
|
||||
added: Password lockout policy added
|
||||
changed: Password lockout policy changed
|
||||
removed: Password lockout policy removed
|
||||
label:
|
||||
added: Label Policy added
|
||||
changed: Label Policy changed
|
||||
removed: Label Policy removed
|
||||
project:
|
||||
added: Project added
|
||||
changed: Project changed
|
||||
|
7
migrations/cockroach/V1.40__indexes.sql
Normal file
7
migrations/cockroach/V1.40__indexes.sql
Normal file
@ -0,0 +1,7 @@
|
||||
use auth;
|
||||
CREATE INDEX IF NOT EXISTS auth_code on auth.auth_requests (code);
|
||||
|
||||
use eventstore;
|
||||
CREATE INDEX IF NOT EXISTS default_event_query on eventstore.events (aggregate_type, aggregate_id, event_type, resource_owner);
|
||||
DROP INDEX IF EXISTS event_type;
|
||||
DROP INDEX IF EXISTS resource_owner;
|
@ -23,13 +23,14 @@ option go_package ="github.com/caos/zitadel/pkg/grpc/admin";
|
||||
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
||||
info: {
|
||||
title: "Administrator API for ZITADEL";
|
||||
description: "This API provides all functions to administrate ZITADEL.";
|
||||
title: "Administration API aka Admin";
|
||||
version: "1.0";
|
||||
contact: {
|
||||
name: "file an issue",
|
||||
url: "https://github.com/caos/zitadel";
|
||||
};
|
||||
description: "This API is intended to configure and manage the IAM itself.";
|
||||
contact:{
|
||||
name: "CAOS developers of ZITADEL"
|
||||
url: "https://zitadel.ch"
|
||||
email: "hi@zitadel.ch"
|
||||
}
|
||||
license: {
|
||||
name: "Apache 2.0",
|
||||
url: "https://github.com/caos/zitadel/blob/main/LICENSE";
|
||||
|
@ -18,10 +18,17 @@ option go_package ="github.com/caos/zitadel/pkg/grpc/auth";
|
||||
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
||||
info: {
|
||||
title: "auth service";
|
||||
title: "Authentication API aka Auth";
|
||||
version: "1.0";
|
||||
description: "The authentication API is used for all operations on the currently logged in user.";
|
||||
contact:{
|
||||
url: "https://github.com/caos/zitadel/api/auth" //TODO: should be swagger path
|
||||
name: "CAOS developers of ZITADEL"
|
||||
url: "https://zitadel.ch"
|
||||
email: "hi@zitadel.ch"
|
||||
}
|
||||
license: {
|
||||
name: "Apache License 2.0",
|
||||
url: "https://github.com/caos/zitadel/blob/main/LICENSE"
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -26,15 +26,14 @@ package zitadel.management.v1;
|
||||
option go_package ="github.com/caos/zitadel/pkg/grpc/management";
|
||||
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
||||
swagger: "2.0",
|
||||
info: {
|
||||
title: "management api of ZITADEL";
|
||||
title: "Management API";
|
||||
version: "1.0";
|
||||
description: "it's for managing organisation internal and extnernal objects.";
|
||||
description: "The management API is as the name states the interface where systems can mutate IAM objects like, organisations, projects, clients, users and so on if they have the necessary access rights.";
|
||||
contact:{
|
||||
name: "CAOS developers of ZITADEL"
|
||||
url: "https://zitadel.ch"
|
||||
email: "hi@caos.ch" //TODO: is there a zitadel@caos.ch?
|
||||
email: "hi@zitadel.ch"
|
||||
}
|
||||
license: {
|
||||
name: "Apache License 2.0",
|
||||
|
@ -87,7 +87,7 @@ enum SecondFactorType {
|
||||
|
||||
enum MultiFactorType {
|
||||
MULTI_FACTOR_TYPE_UNSPECIFIED = 0;
|
||||
MULTI_FACTOR_TYPE_U2F_WITH_VERIFICATION = 1; //TODO: what does livio think after the weekend? :D
|
||||
MULTI_FACTOR_TYPE_U2F_WITH_VERIFICATION = 1;
|
||||
}
|
||||
|
||||
enum PasswordlessType {
|
||||
|
@ -350,7 +350,6 @@ message WebAuthNVerification {
|
||||
description: "json representation of public key credential issued by the webauthn client";
|
||||
min_length: 55;
|
||||
max_length: 1048576; //1 mb
|
||||
//TODO: add example validate max
|
||||
}
|
||||
];
|
||||
string token_name = 2 [
|
||||
|
Loading…
x
Reference in New Issue
Block a user