mirror of
https://github.com/zitadel/zitadel.git
synced 2025-05-01 13:11:07 +00:00
Changes (#195)
* Changes added * Reading of events for applications changed. * Proto changed * Tests added * Added more tests. * Struct for Data expanded with additional fields. * refactoring * Changes from review. * Merge in to Master * Changes from review. * fix: generate proto Co-authored-by: Fabiennne <fabienne.gerschwiler@gmail.com>
This commit is contained in:
parent
8dd6082b17
commit
1dd82ab1b7
@ -2,9 +2,10 @@ package eventstore
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/api/auth"
|
"github.com/caos/zitadel/internal/api/auth"
|
||||||
"github.com/caos/zitadel/internal/model"
|
"github.com/caos/zitadel/internal/model"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/errors"
|
"github.com/caos/zitadel/internal/errors"
|
||||||
mgmt_view "github.com/caos/zitadel/internal/management/repository/eventsourcing/view"
|
mgmt_view "github.com/caos/zitadel/internal/management/repository/eventsourcing/view"
|
||||||
@ -45,6 +46,14 @@ func (repo *OrgRepository) ReactivateOrg(ctx context.Context, id string) (*org_m
|
|||||||
return repo.OrgEventstore.ReactivateOrg(ctx, id)
|
return repo.OrgEventstore.ReactivateOrg(ctx, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *OrgRepository) OrgChanges(ctx context.Context, id string, lastSequence uint64, limit uint64) (*org_model.OrgChanges, error) {
|
||||||
|
changes, err := repo.OrgEventstore.OrgChanges(ctx, id, lastSequence, limit)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return changes, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (repo *OrgRepository) OrgMemberByID(ctx context.Context, orgID, userID string) (member *org_model.OrgMember, err error) {
|
func (repo *OrgRepository) OrgMemberByID(ctx context.Context, orgID, userID string) (member *org_model.OrgMember, err error) {
|
||||||
member = org_model.NewOrgMember(orgID, userID)
|
member = org_model.NewOrgMember(orgID, userID)
|
||||||
return repo.OrgEventstore.OrgMemberByIDs(ctx, member)
|
return repo.OrgEventstore.OrgMemberByIDs(ctx, member)
|
||||||
|
@ -2,9 +2,10 @@ package eventstore
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/api/auth"
|
"github.com/caos/zitadel/internal/api/auth"
|
||||||
global_model "github.com/caos/zitadel/internal/model"
|
global_model "github.com/caos/zitadel/internal/model"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/management/repository/eventsourcing/view"
|
"github.com/caos/zitadel/internal/management/repository/eventsourcing/view"
|
||||||
"github.com/caos/zitadel/internal/project/repository/view/model"
|
"github.com/caos/zitadel/internal/project/repository/view/model"
|
||||||
@ -129,6 +130,14 @@ func (repo *ProjectRepo) SearchProjectRoles(ctx context.Context, request *proj_m
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *ProjectRepo) ProjectChanges(ctx context.Context, id string, lastSequence uint64, limit uint64) (*proj_model.ProjectChanges, error) {
|
||||||
|
changes, err := repo.ProjectEvents.ProjectChanges(ctx, id, lastSequence, limit)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return changes, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (repo *ProjectRepo) ApplicationByID(ctx context.Context, projectID, appID string) (app *proj_model.Application, err error) {
|
func (repo *ProjectRepo) ApplicationByID(ctx context.Context, projectID, appID string) (app *proj_model.Application, err error) {
|
||||||
return repo.ProjectEvents.ApplicationByIDs(ctx, projectID, appID)
|
return repo.ProjectEvents.ApplicationByIDs(ctx, projectID, appID)
|
||||||
}
|
}
|
||||||
@ -168,6 +177,14 @@ func (repo *ProjectRepo) SearchApplications(ctx context.Context, request *proj_m
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *ProjectRepo) ApplicationChanges(ctx context.Context, id string, appId string, lastSequence uint64, limit uint64) (*proj_model.ApplicationChanges, error) {
|
||||||
|
changes, err := repo.ProjectEvents.ApplicationChanges(ctx, id, appId, lastSequence, limit)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return changes, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (repo *ProjectRepo) ChangeOIDCConfig(ctx context.Context, config *proj_model.OIDCConfig) (*proj_model.OIDCConfig, error) {
|
func (repo *ProjectRepo) ChangeOIDCConfig(ctx context.Context, config *proj_model.OIDCConfig) (*proj_model.OIDCConfig, error) {
|
||||||
return repo.ProjectEvents.ChangeOIDCConfig(ctx, config)
|
return repo.ProjectEvents.ChangeOIDCConfig(ctx, config)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package eventstore
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/api/auth"
|
"github.com/caos/zitadel/internal/api/auth"
|
||||||
"github.com/caos/zitadel/internal/management/repository/eventsourcing/view"
|
"github.com/caos/zitadel/internal/management/repository/eventsourcing/view"
|
||||||
policy_event "github.com/caos/zitadel/internal/policy/repository/eventsourcing"
|
policy_event "github.com/caos/zitadel/internal/policy/repository/eventsourcing"
|
||||||
@ -71,6 +72,14 @@ func (repo *UserRepo) SearchUsers(ctx context.Context, request *usr_model.UserSe
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *UserRepo) UserChanges(ctx context.Context, id string, lastSequence uint64, limit uint64) (*usr_model.UserChanges, error) {
|
||||||
|
changes, err := repo.UserEvents.UserChanges(ctx, id, lastSequence, limit)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return changes, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (repo *UserRepo) GetGlobalUserByEmail(ctx context.Context, email string) (*usr_model.UserView, error) {
|
func (repo *UserRepo) GetGlobalUserByEmail(ctx context.Context, email string) (*usr_model.UserView, error) {
|
||||||
user, err := repo.View.GetGlobalUserByEmail(email)
|
user, err := repo.View.GetGlobalUserByEmail(email)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -2,6 +2,7 @@ package eventsourcing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
es_iam "github.com/caos/zitadel/internal/iam/repository/eventsourcing"
|
es_iam "github.com/caos/zitadel/internal/iam/repository/eventsourcing"
|
||||||
|
|
||||||
sd "github.com/caos/zitadel/internal/config/systemdefaults"
|
sd "github.com/caos/zitadel/internal/config/systemdefaults"
|
||||||
@ -87,7 +88,6 @@ func Start(conf Config, systemDefaults sd.SystemDefaults, roles []string) (*EsRe
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
eventstoreRepos := handler.EventstoreRepos{ProjectEvents: project, UserEvents: user, OrgEvents: org}
|
eventstoreRepos := handler.EventstoreRepos{ProjectEvents: project, UserEvents: user, OrgEvents: org}
|
||||||
spool := spooler.StartSpooler(conf.Spooler, es, view, sqlClient, eventstoreRepos)
|
spool := spooler.StartSpooler(conf.Spooler, es, view, sqlClient, eventstoreRepos)
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ type OrgRepository interface {
|
|||||||
UpdateOrg(ctx context.Context, org *org_model.Org) (*org_model.Org, error)
|
UpdateOrg(ctx context.Context, org *org_model.Org) (*org_model.Org, error)
|
||||||
DeactivateOrg(ctx context.Context, id string) (*org_model.Org, error)
|
DeactivateOrg(ctx context.Context, id string) (*org_model.Org, error)
|
||||||
ReactivateOrg(ctx context.Context, id string) (*org_model.Org, error)
|
ReactivateOrg(ctx context.Context, id string) (*org_model.Org, error)
|
||||||
|
OrgChanges(ctx context.Context, id string, lastSequence uint64, limit uint64) (*org_model.OrgChanges, error)
|
||||||
|
|
||||||
SearchMyOrgMembers(ctx context.Context, request *org_model.OrgMemberSearchRequest) (*org_model.OrgMemberSearchResponse, error)
|
SearchMyOrgMembers(ctx context.Context, request *org_model.OrgMemberSearchRequest) (*org_model.OrgMemberSearchResponse, error)
|
||||||
AddMyOrgMember(ctx context.Context, member *org_model.OrgMember) (*org_model.OrgMember, error)
|
AddMyOrgMember(ctx context.Context, member *org_model.OrgMember) (*org_model.OrgMember, error)
|
||||||
|
@ -27,6 +27,7 @@ type ProjectRepository interface {
|
|||||||
ChangeProjectRole(ctx context.Context, role *model.ProjectRole) (*model.ProjectRole, error)
|
ChangeProjectRole(ctx context.Context, role *model.ProjectRole) (*model.ProjectRole, error)
|
||||||
RemoveProjectRole(ctx context.Context, projectID, key string) error
|
RemoveProjectRole(ctx context.Context, projectID, key string) error
|
||||||
SearchProjectRoles(ctx context.Context, request *model.ProjectRoleSearchRequest) (*model.ProjectRoleSearchResponse, error)
|
SearchProjectRoles(ctx context.Context, request *model.ProjectRoleSearchRequest) (*model.ProjectRoleSearchResponse, error)
|
||||||
|
ProjectChanges(ctx context.Context, id string, lastSequence uint64, limit uint64) (*model.ProjectChanges, error)
|
||||||
|
|
||||||
ApplicationByID(ctx context.Context, projectID, appID string) (*model.Application, error)
|
ApplicationByID(ctx context.Context, projectID, appID string) (*model.Application, error)
|
||||||
AddApplication(ctx context.Context, app *model.Application) (*model.Application, error)
|
AddApplication(ctx context.Context, app *model.Application) (*model.Application, error)
|
||||||
@ -37,6 +38,7 @@ type ProjectRepository interface {
|
|||||||
ChangeOIDCConfig(ctx context.Context, config *model.OIDCConfig) (*model.OIDCConfig, error)
|
ChangeOIDCConfig(ctx context.Context, config *model.OIDCConfig) (*model.OIDCConfig, error)
|
||||||
ChangeOIDConfigSecret(ctx context.Context, projectID, appID string) (*model.OIDCConfig, error)
|
ChangeOIDConfigSecret(ctx context.Context, projectID, appID string) (*model.OIDCConfig, error)
|
||||||
SearchApplications(ctx context.Context, request *model.ApplicationSearchRequest) (*model.ApplicationSearchResponse, error)
|
SearchApplications(ctx context.Context, request *model.ApplicationSearchRequest) (*model.ApplicationSearchResponse, error)
|
||||||
|
ApplicationChanges(ctx context.Context, id string, secId string, lastSequence uint64, limit uint64) (*model.ApplicationChanges, error)
|
||||||
|
|
||||||
ProjectGrantByID(ctx context.Context, projectID, grantID string) (*model.ProjectGrant, error)
|
ProjectGrantByID(ctx context.Context, projectID, grantID string) (*model.ProjectGrant, error)
|
||||||
AddProjectGrant(ctx context.Context, app *model.ProjectGrant) (*model.ProjectGrant, error)
|
AddProjectGrant(ctx context.Context, app *model.ProjectGrant) (*model.ProjectGrant, error)
|
||||||
|
@ -2,6 +2,7 @@ package repository
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/user/model"
|
"github.com/caos/zitadel/internal/user/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,6 +15,7 @@ type UserRepository interface {
|
|||||||
LockUser(ctx context.Context, id string) (*model.User, error)
|
LockUser(ctx context.Context, id string) (*model.User, error)
|
||||||
UnlockUser(ctx context.Context, id string) (*model.User, error)
|
UnlockUser(ctx context.Context, id string) (*model.User, error)
|
||||||
SearchUsers(ctx context.Context, request *model.UserSearchRequest) (*model.UserSearchResponse, error)
|
SearchUsers(ctx context.Context, request *model.UserSearchRequest) (*model.UserSearchResponse, error)
|
||||||
|
UserChanges(ctx context.Context, id string, lastSequence uint64, limit uint64) (*model.UserChanges, error)
|
||||||
GetGlobalUserByEmail(ctx context.Context, email string) (*model.UserView, error)
|
GetGlobalUserByEmail(ctx context.Context, email string) (*model.UserView, error)
|
||||||
IsUserUnique(ctx context.Context, userName, email string) (bool, error)
|
IsUserUnique(ctx context.Context, userName, email string) (bool, error)
|
||||||
UserMfas(ctx context.Context, userID string) ([]*model.MultiFactor, error)
|
UserMfas(ctx context.Context, userID string) ([]*model.MultiFactor, error)
|
||||||
|
@ -2,6 +2,7 @@ package model
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
||||||
|
"github.com/golang/protobuf/ptypes/timestamp"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Org struct {
|
type Org struct {
|
||||||
@ -13,6 +14,18 @@ type Org struct {
|
|||||||
|
|
||||||
Members []*OrgMember
|
Members []*OrgMember
|
||||||
}
|
}
|
||||||
|
type OrgChanges struct {
|
||||||
|
Changes []*OrgChange
|
||||||
|
LastSequence uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
type OrgChange struct {
|
||||||
|
ChangeDate *timestamp.Timestamp `json:"changeDate,omitempty"`
|
||||||
|
EventType string `json:"eventType,omitempty"`
|
||||||
|
Sequence uint64 `json:"sequence,omitempty"`
|
||||||
|
Modifier string `json:"modifierUser,omitempty"`
|
||||||
|
Data interface{} `json:"data,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type OrgState int32
|
type OrgState int32
|
||||||
|
|
||||||
|
@ -2,13 +2,19 @@ package eventsourcing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/caos/logging"
|
||||||
"github.com/caos/zitadel/internal/errors"
|
"github.com/caos/zitadel/internal/errors"
|
||||||
|
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||||
"github.com/caos/zitadel/internal/eventstore"
|
"github.com/caos/zitadel/internal/eventstore"
|
||||||
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
||||||
es_sdk "github.com/caos/zitadel/internal/eventstore/sdk"
|
es_sdk "github.com/caos/zitadel/internal/eventstore/sdk"
|
||||||
"github.com/caos/zitadel/internal/id"
|
"github.com/caos/zitadel/internal/id"
|
||||||
org_model "github.com/caos/zitadel/internal/org/model"
|
org_model "github.com/caos/zitadel/internal/org/model"
|
||||||
"github.com/caos/zitadel/internal/org/repository/eventsourcing/model"
|
"github.com/caos/zitadel/internal/org/repository/eventsourcing/model"
|
||||||
|
"github.com/golang/protobuf/ptypes"
|
||||||
)
|
)
|
||||||
|
|
||||||
type OrgEventstore struct {
|
type OrgEventstore struct {
|
||||||
@ -132,6 +138,60 @@ func (es *OrgEventstore) ReactivateOrg(ctx context.Context, orgID string) (*org_
|
|||||||
return model.OrgToModel(org), nil
|
return model.OrgToModel(org), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (es *OrgEventstore) OrgChanges(ctx context.Context, id string, lastSequence uint64, limit uint64) (*org_model.OrgChanges, error) {
|
||||||
|
query := ChangesQuery(id, lastSequence)
|
||||||
|
|
||||||
|
events, err := es.Eventstore.FilterEvents(context.Background(), query)
|
||||||
|
if err != nil {
|
||||||
|
logging.Log("EVENT-ZRffs").WithError(err).Warn("eventstore unavailable")
|
||||||
|
return nil, errors.ThrowInternal(err, "EVENT-328b1", "unable to get current user")
|
||||||
|
}
|
||||||
|
if len(events) == 0 {
|
||||||
|
return nil, caos_errs.ThrowNotFound(nil, "EVENT-FpQqK", "no objects found")
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make([]*org_model.OrgChange, 0)
|
||||||
|
|
||||||
|
for _, u := range events {
|
||||||
|
creationDate, err := ptypes.TimestampProto(u.CreationDate)
|
||||||
|
logging.Log("EVENT-qxIR7").OnError(err).Debug("unable to parse timestamp")
|
||||||
|
change := &org_model.OrgChange{
|
||||||
|
ChangeDate: creationDate,
|
||||||
|
EventType: u.Type.String(),
|
||||||
|
Modifier: u.EditorUser,
|
||||||
|
Sequence: u.Sequence,
|
||||||
|
}
|
||||||
|
|
||||||
|
orgDummy := model.Org{}
|
||||||
|
if u.Data != nil {
|
||||||
|
if err := json.Unmarshal(u.Data, &orgDummy); err != nil {
|
||||||
|
log.Println("Error getting data!", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
change.Data = orgDummy
|
||||||
|
|
||||||
|
result = append(result, change)
|
||||||
|
if lastSequence < u.Sequence {
|
||||||
|
lastSequence = u.Sequence
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
changes := &org_model.OrgChanges{
|
||||||
|
Changes: result,
|
||||||
|
LastSequence: lastSequence,
|
||||||
|
}
|
||||||
|
|
||||||
|
return changes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func ChangesQuery(orgID string, latestSequence uint64) *es_models.SearchQuery {
|
||||||
|
query := es_models.NewSearchQuery().
|
||||||
|
AggregateTypeFilter(model.OrgAggregate).
|
||||||
|
LatestSequenceFilter(latestSequence).
|
||||||
|
AggregateIDFilter(orgID)
|
||||||
|
return query
|
||||||
|
}
|
||||||
|
|
||||||
func (es *OrgEventstore) OrgMemberByIDs(ctx context.Context, member *org_model.OrgMember) (*org_model.OrgMember, error) {
|
func (es *OrgEventstore) OrgMemberByIDs(ctx context.Context, member *org_model.OrgMember) (*org_model.OrgMember, error) {
|
||||||
if member == nil || member.UserID == "" || member.AggregateID == "" {
|
if member == nil || member.UserID == "" || member.AggregateID == "" {
|
||||||
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-ld93d", "member not set")
|
return nil, errors.ThrowPreconditionFailed(nil, "EVENT-ld93d", "member not set")
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
package eventsourcing
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/caos/zitadel/internal/eventstore/mock"
|
||||||
|
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
||||||
|
"github.com/caos/zitadel/internal/org/repository/eventsourcing/model"
|
||||||
|
repo_model "github.com/caos/zitadel/internal/org/repository/eventsourcing/model"
|
||||||
|
"github.com/golang/mock/gomock"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetMockedEventstoreComplexity(ctrl *gomock.Controller, mockEs *mock.MockEventstore) *OrgEventstore {
|
||||||
|
return &OrgEventstore{
|
||||||
|
Eventstore: mockEs,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMockChangesOrgOK(ctrl *gomock.Controller) *OrgEventstore {
|
||||||
|
org := model.Org{
|
||||||
|
Name: "MusterOrg",
|
||||||
|
Domain: "myDomain",
|
||||||
|
}
|
||||||
|
data, err := json.Marshal(org)
|
||||||
|
if err != nil {
|
||||||
|
|
||||||
|
}
|
||||||
|
events := []*es_models.Event{
|
||||||
|
&es_models.Event{AggregateID: "AggregateIDApp", Sequence: 1, AggregateType: repo_model.OrgAggregate, Data: data},
|
||||||
|
}
|
||||||
|
mockEs := mock.NewMockEventstore(ctrl)
|
||||||
|
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||||
|
return GetMockedEventstoreComplexity(ctrl, mockEs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMockChangesOrgNoEvents(ctrl *gomock.Controller) *OrgEventstore {
|
||||||
|
events := []*es_models.Event{}
|
||||||
|
mockEs := mock.NewMockEventstore(ctrl)
|
||||||
|
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||||
|
return GetMockedEventstoreComplexity(ctrl, mockEs)
|
||||||
|
}
|
@ -2,12 +2,15 @@ package eventsourcing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/caos/zitadel/internal/org/repository/eventsourcing/model"
|
"encoding/json"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/caos/zitadel/internal/org/repository/eventsourcing/model"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/api/auth"
|
"github.com/caos/zitadel/internal/api/auth"
|
||||||
"github.com/caos/zitadel/internal/errors"
|
"github.com/caos/zitadel/internal/errors"
|
||||||
|
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||||
es_mock "github.com/caos/zitadel/internal/eventstore/mock"
|
es_mock "github.com/caos/zitadel/internal/eventstore/mock"
|
||||||
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
||||||
org_model "github.com/caos/zitadel/internal/org/model"
|
org_model "github.com/caos/zitadel/internal/org/model"
|
||||||
@ -1025,3 +1028,70 @@ func orgInactiveEvent() *es_models.Event {
|
|||||||
Type: model.OrgDeactivated,
|
Type: model.OrgDeactivated,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestChangesOrg(t *testing.T) {
|
||||||
|
ctrl := gomock.NewController(t)
|
||||||
|
type args struct {
|
||||||
|
es *OrgEventstore
|
||||||
|
id string
|
||||||
|
lastSequence uint64
|
||||||
|
limit uint64
|
||||||
|
}
|
||||||
|
type res struct {
|
||||||
|
changes *org_model.OrgChanges
|
||||||
|
org *model.Org
|
||||||
|
wantErr bool
|
||||||
|
errFunc func(err error) bool
|
||||||
|
}
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
args args
|
||||||
|
res res
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "changes from events, ok",
|
||||||
|
args: args{
|
||||||
|
es: GetMockChangesOrgOK(ctrl),
|
||||||
|
id: "1",
|
||||||
|
lastSequence: 0,
|
||||||
|
limit: 0,
|
||||||
|
},
|
||||||
|
res: res{
|
||||||
|
changes: &org_model.OrgChanges{Changes: []*org_model.OrgChange{&org_model.OrgChange{EventType: "", Sequence: 1, Modifier: ""}}, LastSequence: 1},
|
||||||
|
org: &model.Org{Name: "MusterOrg", Domain: "myDomain"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "changes from events, no events",
|
||||||
|
args: args{
|
||||||
|
es: GetMockChangesOrgNoEvents(ctrl),
|
||||||
|
id: "2",
|
||||||
|
lastSequence: 0,
|
||||||
|
limit: 0,
|
||||||
|
},
|
||||||
|
res: res{
|
||||||
|
wantErr: true,
|
||||||
|
errFunc: caos_errs.IsNotFound,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
result, err := tt.args.es.OrgChanges(nil, tt.args.id, tt.args.lastSequence, tt.args.limit)
|
||||||
|
|
||||||
|
org := &model.Org{}
|
||||||
|
if result != nil && len(result.Changes) > 0 {
|
||||||
|
b, err := json.Marshal(result.Changes[0].Data)
|
||||||
|
json.Unmarshal(b, org)
|
||||||
|
if err != nil {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !tt.res.wantErr && result.LastSequence != tt.res.changes.LastSequence && org.Name != tt.res.org.Name {
|
||||||
|
t.Errorf("got wrong result name: expected: %v, actual: %v ", tt.res.changes.LastSequence, result.LastSequence)
|
||||||
|
}
|
||||||
|
if tt.res.wantErr && !tt.res.errFunc(err) {
|
||||||
|
t.Errorf("got wrong err: %v ", err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@ package model
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
||||||
|
"github.com/golang/protobuf/ptypes/timestamp"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Application struct {
|
type Application struct {
|
||||||
@ -13,6 +14,18 @@ type Application struct {
|
|||||||
Type AppType
|
Type AppType
|
||||||
OIDCConfig *OIDCConfig
|
OIDCConfig *OIDCConfig
|
||||||
}
|
}
|
||||||
|
type ApplicationChanges struct {
|
||||||
|
Changes []*ApplicationChange
|
||||||
|
LastSequence uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
type ApplicationChange struct {
|
||||||
|
ChangeDate *timestamp.Timestamp `json:"changeDate,omitempty"`
|
||||||
|
EventType string `json:"eventType,omitempty"`
|
||||||
|
Sequence uint64 `json:"sequence,omitempty"`
|
||||||
|
Modifier string `json:"modifierUser,omitempty"`
|
||||||
|
Data interface{} `json:"data,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type AppState int32
|
type AppState int32
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package model
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
||||||
|
"github.com/golang/protobuf/ptypes/timestamp"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Project struct {
|
type Project struct {
|
||||||
@ -14,6 +15,18 @@ type Project struct {
|
|||||||
Applications []*Application
|
Applications []*Application
|
||||||
Grants []*ProjectGrant
|
Grants []*ProjectGrant
|
||||||
}
|
}
|
||||||
|
type ProjectChanges struct {
|
||||||
|
Changes []*ProjectChange
|
||||||
|
LastSequence uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProjectChange struct {
|
||||||
|
ChangeDate *timestamp.Timestamp `json:"changeDate,omitempty"`
|
||||||
|
EventType string `json:"eventType,omitempty"`
|
||||||
|
Sequence uint64 `json:"sequence,omitempty"`
|
||||||
|
Modifier string `json:"modifierUser,omitempty"`
|
||||||
|
Data interface{} `json:"data,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type ProjectState int32
|
type ProjectState int32
|
||||||
|
|
||||||
|
@ -2,11 +2,18 @@ package eventsourcing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"log"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/caos/logging"
|
||||||
"github.com/caos/zitadel/internal/api/auth"
|
"github.com/caos/zitadel/internal/api/auth"
|
||||||
"github.com/caos/zitadel/internal/cache/config"
|
"github.com/caos/zitadel/internal/cache/config"
|
||||||
sd "github.com/caos/zitadel/internal/config/systemdefaults"
|
sd "github.com/caos/zitadel/internal/config/systemdefaults"
|
||||||
|
"github.com/caos/zitadel/internal/errors"
|
||||||
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
||||||
"github.com/caos/zitadel/internal/project/repository/eventsourcing/model"
|
"github.com/caos/zitadel/internal/project/repository/eventsourcing/model"
|
||||||
|
"github.com/golang/protobuf/ptypes"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/crypto"
|
"github.com/caos/zitadel/internal/crypto"
|
||||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||||
@ -317,6 +324,70 @@ func (es *ProjectEventstore) RemoveProjectRole(ctx context.Context, role *proj_m
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (es *ProjectEventstore) ProjectChanges(ctx context.Context, id string, lastSequence uint64, limit uint64) (*proj_model.ProjectChanges, error) {
|
||||||
|
query := ChangesQuery(id, lastSequence)
|
||||||
|
|
||||||
|
events, err := es.Eventstore.FilterEvents(context.Background(), query)
|
||||||
|
if err != nil {
|
||||||
|
logging.Log("EVENT-ZRffs").WithError(err).Warn("eventstore unavailable")
|
||||||
|
return nil, errors.ThrowInternal(err, "EVENT-328b1", "unable to get current user")
|
||||||
|
}
|
||||||
|
if len(events) == 0 {
|
||||||
|
return nil, caos_errs.ThrowNotFound(nil, "EVENT-FpQqK", "no objects found")
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make([]*proj_model.ProjectChange, 0)
|
||||||
|
|
||||||
|
for _, u := range events {
|
||||||
|
creationDate, err := ptypes.TimestampProto(u.CreationDate)
|
||||||
|
logging.Log("EVENT-qxIR7").OnError(err).Debug("unable to parse timestamp")
|
||||||
|
change := &proj_model.ProjectChange{
|
||||||
|
ChangeDate: creationDate,
|
||||||
|
EventType: u.Type.String(),
|
||||||
|
Modifier: u.EditorUser,
|
||||||
|
Sequence: u.Sequence,
|
||||||
|
}
|
||||||
|
|
||||||
|
projectDummy := proj_model.Project{}
|
||||||
|
appDummy := model.Application{}
|
||||||
|
change.Data = projectDummy
|
||||||
|
if u.Data != nil {
|
||||||
|
if strings.Contains(change.EventType, "application") {
|
||||||
|
if err := json.Unmarshal(u.Data, &appDummy); err != nil {
|
||||||
|
log.Println("Error getting data!", err.Error())
|
||||||
|
}
|
||||||
|
change.Data = appDummy
|
||||||
|
} else {
|
||||||
|
if err := json.Unmarshal(u.Data, &projectDummy); err != nil {
|
||||||
|
log.Println("Error getting data!", err.Error())
|
||||||
|
}
|
||||||
|
change.Data = projectDummy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = append(result, change)
|
||||||
|
if lastSequence < u.Sequence {
|
||||||
|
lastSequence = u.Sequence
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
changes := &proj_model.ProjectChanges{
|
||||||
|
Changes: result,
|
||||||
|
LastSequence: lastSequence,
|
||||||
|
}
|
||||||
|
|
||||||
|
return changes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func ChangesQuery(projID string, latestSequence uint64) *es_models.SearchQuery {
|
||||||
|
query := es_models.NewSearchQuery().
|
||||||
|
AggregateTypeFilter(model.ProjectAggregate).
|
||||||
|
LatestSequenceFilter(latestSequence).
|
||||||
|
AggregateIDFilter(projID)
|
||||||
|
return query
|
||||||
|
}
|
||||||
|
|
||||||
func (es *ProjectEventstore) ApplicationByIDs(ctx context.Context, projectID, appID string) (*proj_model.Application, error) {
|
func (es *ProjectEventstore) ApplicationByIDs(ctx context.Context, projectID, appID string) (*proj_model.Application, error) {
|
||||||
if projectID == "" || appID == "" {
|
if projectID == "" || appID == "" {
|
||||||
return nil, caos_errs.ThrowPreconditionFailed(nil, "EVENT-ld93d", "project oder app AggregateID missing")
|
return nil, caos_errs.ThrowPreconditionFailed(nil, "EVENT-ld93d", "project oder app AggregateID missing")
|
||||||
@ -426,6 +497,69 @@ func (es *ProjectEventstore) RemoveApplication(ctx context.Context, app *proj_mo
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (es *ProjectEventstore) ApplicationChanges(ctx context.Context, id string, secId string, lastSequence uint64, limit uint64) (*proj_model.ApplicationChanges, error) {
|
||||||
|
query := ChangesQuery(id, lastSequence)
|
||||||
|
|
||||||
|
events, err := es.Eventstore.FilterEvents(context.Background(), query)
|
||||||
|
if err != nil {
|
||||||
|
logging.Log("EVENT-ZRffs").WithError(err).Warn("eventstore unavailable")
|
||||||
|
return nil, errors.ThrowInternal(err, "EVENT-sw6Ku", "unable to get current user")
|
||||||
|
}
|
||||||
|
if len(events) == 0 {
|
||||||
|
return nil, caos_errs.ThrowNotFound(nil, "EVENT-9IHLP", "no objects found")
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make([]*proj_model.ApplicationChange, 0)
|
||||||
|
|
||||||
|
for _, u := range events {
|
||||||
|
creationDate, err := ptypes.TimestampProto(u.CreationDate)
|
||||||
|
logging.Log("EVENT-MJzeN").OnError(err).Debug("unable to parse timestamp")
|
||||||
|
change := &proj_model.ApplicationChange{
|
||||||
|
ChangeDate: creationDate,
|
||||||
|
EventType: u.Type.String(),
|
||||||
|
Modifier: u.EditorUser,
|
||||||
|
Sequence: u.Sequence,
|
||||||
|
}
|
||||||
|
appendChanges := true
|
||||||
|
// if change.EventType == "project.application.added" ||
|
||||||
|
// change.EventType == "project.application.changed" ||
|
||||||
|
// change.EventType == "project.application.config.oidc.added" ||
|
||||||
|
// change.EventType == "project.application.config.oidc.changed" {
|
||||||
|
|
||||||
|
if change.EventType == model.ApplicationAdded.String() ||
|
||||||
|
change.EventType == model.ApplicationChanged.String() ||
|
||||||
|
change.EventType == model.OIDCConfigAdded.String() ||
|
||||||
|
change.EventType == model.OIDCConfigChanged.String() {
|
||||||
|
appDummy := model.Application{}
|
||||||
|
if u.Data != nil {
|
||||||
|
if err := json.Unmarshal(u.Data, &appDummy); err != nil {
|
||||||
|
log.Println("Error getting data!", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
change.Data = appDummy
|
||||||
|
if appDummy.AppID != secId {
|
||||||
|
appendChanges = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
appendChanges = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if appendChanges {
|
||||||
|
result = append(result, change)
|
||||||
|
if lastSequence < u.Sequence {
|
||||||
|
lastSequence = u.Sequence
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
changes := &proj_model.ApplicationChanges{
|
||||||
|
Changes: result,
|
||||||
|
LastSequence: lastSequence,
|
||||||
|
}
|
||||||
|
|
||||||
|
return changes, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (es *ProjectEventstore) DeactivateApplication(ctx context.Context, projectID, appID string) (*proj_model.Application, error) {
|
func (es *ProjectEventstore) DeactivateApplication(ctx context.Context, projectID, appID string) (*proj_model.Application, error) {
|
||||||
if appID == "" {
|
if appID == "" {
|
||||||
return nil, caos_errs.ThrowPreconditionFailed(nil, "EVENT-dlp9e", "appID missing")
|
return nil, caos_errs.ThrowPreconditionFailed(nil, "EVENT-dlp9e", "appID missing")
|
||||||
|
@ -2,6 +2,7 @@ package eventsourcing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
mock_cache "github.com/caos/zitadel/internal/cache/mock"
|
mock_cache "github.com/caos/zitadel/internal/cache/mock"
|
||||||
"github.com/caos/zitadel/internal/crypto"
|
"github.com/caos/zitadel/internal/crypto"
|
||||||
"github.com/caos/zitadel/internal/eventstore/mock"
|
"github.com/caos/zitadel/internal/eventstore/mock"
|
||||||
@ -9,6 +10,7 @@ import (
|
|||||||
"github.com/caos/zitadel/internal/id"
|
"github.com/caos/zitadel/internal/id"
|
||||||
proj_model "github.com/caos/zitadel/internal/project/model"
|
proj_model "github.com/caos/zitadel/internal/project/model"
|
||||||
"github.com/caos/zitadel/internal/project/repository/eventsourcing/model"
|
"github.com/caos/zitadel/internal/project/repository/eventsourcing/model"
|
||||||
|
repo_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model"
|
||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -275,3 +277,57 @@ func GetMockProjectGrantMemberByIDsOK(ctrl *gomock.Controller) *ProjectEventstor
|
|||||||
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||||
return GetMockedEventstore(ctrl, mockEs)
|
return GetMockedEventstore(ctrl, mockEs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetMockChangesProjectOK(ctrl *gomock.Controller) *ProjectEventstore {
|
||||||
|
project := model.Project{
|
||||||
|
Name: "MusterProject",
|
||||||
|
}
|
||||||
|
data, err := json.Marshal(project)
|
||||||
|
if err != nil {
|
||||||
|
|
||||||
|
}
|
||||||
|
events := []*es_models.Event{
|
||||||
|
&es_models.Event{AggregateID: "AggregateIDProject", Sequence: 1, AggregateType: repo_model.ProjectAggregate, Data: data},
|
||||||
|
}
|
||||||
|
mockEs := mock.NewMockEventstore(ctrl)
|
||||||
|
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||||
|
return GetMockedEventstoreComplexity(ctrl, mockEs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMockChangesProjectNoEvents(ctrl *gomock.Controller) *ProjectEventstore {
|
||||||
|
events := []*es_models.Event{}
|
||||||
|
mockEs := mock.NewMockEventstore(ctrl)
|
||||||
|
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||||
|
return GetMockedEventstoreComplexity(ctrl, mockEs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMockedEventstoreComplexity(ctrl *gomock.Controller, mockEs *mock.MockEventstore) *ProjectEventstore {
|
||||||
|
return &ProjectEventstore{
|
||||||
|
Eventstore: mockEs,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMockChangesApplicationOK(ctrl *gomock.Controller) *ProjectEventstore {
|
||||||
|
app := model.Application{
|
||||||
|
Name: "MusterApp",
|
||||||
|
AppID: "AppId",
|
||||||
|
Type: 3,
|
||||||
|
}
|
||||||
|
data, err := json.Marshal(app)
|
||||||
|
if err != nil {
|
||||||
|
|
||||||
|
}
|
||||||
|
events := []*es_models.Event{
|
||||||
|
&es_models.Event{AggregateID: "AggregateIDApp", Type: "project.application.added", Sequence: 1, AggregateType: repo_model.ProjectAggregate, Data: data},
|
||||||
|
}
|
||||||
|
mockEs := mock.NewMockEventstore(ctrl)
|
||||||
|
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||||
|
return GetMockedEventstoreComplexity(ctrl, mockEs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMockChangesApplicationNoEvents(ctrl *gomock.Controller) *ProjectEventstore {
|
||||||
|
events := []*es_models.Event{}
|
||||||
|
mockEs := mock.NewMockEventstore(ctrl)
|
||||||
|
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||||
|
return GetMockedEventstoreComplexity(ctrl, mockEs)
|
||||||
|
}
|
||||||
|
@ -2,13 +2,15 @@ package eventsourcing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/api/auth"
|
"github.com/caos/zitadel/internal/api/auth"
|
||||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||||
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
||||||
"github.com/caos/zitadel/internal/project/model"
|
"github.com/caos/zitadel/internal/project/model"
|
||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
"reflect"
|
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestProjectByID(t *testing.T) {
|
func TestProjectByID(t *testing.T) {
|
||||||
@ -2695,3 +2697,139 @@ func TestRemoveProjectGrantMember(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func TestChangesProject(t *testing.T) {
|
||||||
|
ctrl := gomock.NewController(t)
|
||||||
|
type args struct {
|
||||||
|
es *ProjectEventstore
|
||||||
|
id string
|
||||||
|
lastSequence uint64
|
||||||
|
limit uint64
|
||||||
|
}
|
||||||
|
type res struct {
|
||||||
|
changes *model.ProjectChanges
|
||||||
|
project *model.Project
|
||||||
|
wantErr bool
|
||||||
|
errFunc func(err error) bool
|
||||||
|
}
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
args args
|
||||||
|
res res
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "changes from events, ok",
|
||||||
|
args: args{
|
||||||
|
es: GetMockChangesProjectOK(ctrl),
|
||||||
|
id: "1",
|
||||||
|
lastSequence: 0,
|
||||||
|
limit: 0,
|
||||||
|
},
|
||||||
|
res: res{
|
||||||
|
changes: &model.ProjectChanges{Changes: []*model.ProjectChange{&model.ProjectChange{EventType: "", Sequence: 1, Modifier: ""}}, LastSequence: 1},
|
||||||
|
project: &model.Project{Name: "MusterProject"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "changes from events, no events",
|
||||||
|
args: args{
|
||||||
|
es: GetMockChangesProjectNoEvents(ctrl),
|
||||||
|
id: "2",
|
||||||
|
lastSequence: 0,
|
||||||
|
limit: 0,
|
||||||
|
},
|
||||||
|
res: res{
|
||||||
|
wantErr: true,
|
||||||
|
errFunc: caos_errs.IsNotFound,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
result, err := tt.args.es.ProjectChanges(nil, tt.args.id, tt.args.lastSequence, tt.args.limit)
|
||||||
|
|
||||||
|
project := &model.Project{}
|
||||||
|
if result != nil && len(result.Changes) > 0 {
|
||||||
|
b, err := json.Marshal(result.Changes[0].Data)
|
||||||
|
json.Unmarshal(b, project)
|
||||||
|
if err != nil {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !tt.res.wantErr && result.LastSequence != tt.res.changes.LastSequence && project.Name != tt.res.project.Name {
|
||||||
|
t.Errorf("got wrong result name: expected: %v, actual: %v ", tt.res.changes.LastSequence, result.LastSequence)
|
||||||
|
}
|
||||||
|
if tt.res.wantErr && !tt.res.errFunc(err) {
|
||||||
|
t.Errorf("got wrong err: %v ", err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestChangesApplication(t *testing.T) {
|
||||||
|
ctrl := gomock.NewController(t)
|
||||||
|
type args struct {
|
||||||
|
es *ProjectEventstore
|
||||||
|
id string
|
||||||
|
secId string
|
||||||
|
lastSequence uint64
|
||||||
|
limit uint64
|
||||||
|
}
|
||||||
|
type res struct {
|
||||||
|
changes *model.ApplicationChanges
|
||||||
|
app *model.Application
|
||||||
|
wantErr bool
|
||||||
|
errFunc func(err error) bool
|
||||||
|
}
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
args args
|
||||||
|
res res
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "changes from events, ok",
|
||||||
|
args: args{
|
||||||
|
es: GetMockChangesApplicationOK(ctrl),
|
||||||
|
id: "1",
|
||||||
|
secId: "AppId",
|
||||||
|
lastSequence: 0,
|
||||||
|
limit: 0,
|
||||||
|
},
|
||||||
|
res: res{
|
||||||
|
changes: &model.ApplicationChanges{Changes: []*model.ApplicationChange{&model.ApplicationChange{EventType: "", Sequence: 1, Modifier: ""}}, LastSequence: 1},
|
||||||
|
app: &model.Application{Name: "MusterApp", AppID: "AppId", Type: 3},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "changes from events, no events",
|
||||||
|
args: args{
|
||||||
|
es: GetMockChangesApplicationNoEvents(ctrl),
|
||||||
|
id: "2",
|
||||||
|
secId: "2",
|
||||||
|
lastSequence: 0,
|
||||||
|
limit: 0,
|
||||||
|
},
|
||||||
|
res: res{
|
||||||
|
wantErr: true,
|
||||||
|
errFunc: caos_errs.IsNotFound,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
result, err := tt.args.es.ApplicationChanges(nil, tt.args.id, tt.args.secId, tt.args.lastSequence, tt.args.limit)
|
||||||
|
|
||||||
|
app := &model.Application{}
|
||||||
|
if result != nil && len(result.Changes) > 0 {
|
||||||
|
b, err := json.Marshal(result.Changes[0].Data)
|
||||||
|
json.Unmarshal(b, app)
|
||||||
|
if err != nil {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !tt.res.wantErr && result.LastSequence != tt.res.changes.LastSequence && app.Name != tt.res.app.Name {
|
||||||
|
t.Errorf("got wrong result name: expected: %v, actual: %v ", tt.res.changes.LastSequence, result.LastSequence)
|
||||||
|
}
|
||||||
|
if tt.res.wantErr && !tt.res.errFunc(err) {
|
||||||
|
t.Errorf("got wrong err: %v ", err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
policy_model "github.com/caos/zitadel/internal/policy/model"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
policy_model "github.com/caos/zitadel/internal/policy/model"
|
||||||
|
"github.com/golang/protobuf/ptypes/timestamp"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/crypto"
|
"github.com/caos/zitadel/internal/crypto"
|
||||||
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
||||||
)
|
)
|
||||||
@ -23,6 +25,18 @@ type User struct {
|
|||||||
PasswordCode *PasswordCode
|
PasswordCode *PasswordCode
|
||||||
OTP *OTP
|
OTP *OTP
|
||||||
}
|
}
|
||||||
|
type UserChanges struct {
|
||||||
|
Changes []*UserChange
|
||||||
|
LastSequence uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserChange struct {
|
||||||
|
ChangeDate *timestamp.Timestamp `json:"changeDate,omitempty"`
|
||||||
|
EventType string `json:"eventType,omitempty"`
|
||||||
|
Sequence uint64 `json:"sequence,omitempty"`
|
||||||
|
Modifier string `json:"modifierUser,omitempty"`
|
||||||
|
Data interface{} `json:"data,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type InitUserCode struct {
|
type InitUserCode struct {
|
||||||
es_models.ObjectRoot
|
es_models.ObjectRoot
|
||||||
|
@ -2,8 +2,14 @@ package eventsourcing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/caos/logging"
|
||||||
|
"github.com/caos/zitadel/internal/errors"
|
||||||
"github.com/caos/zitadel/internal/id"
|
"github.com/caos/zitadel/internal/id"
|
||||||
policy_model "github.com/caos/zitadel/internal/policy/model"
|
policy_model "github.com/caos/zitadel/internal/policy/model"
|
||||||
|
"github.com/golang/protobuf/ptypes"
|
||||||
|
|
||||||
"github.com/pquerna/otp/totp"
|
"github.com/pquerna/otp/totp"
|
||||||
|
|
||||||
@ -264,6 +270,60 @@ func (es *UserEventstore) UnlockUser(ctx context.Context, id string) (*usr_model
|
|||||||
return model.UserToModel(repoExisting), nil
|
return model.UserToModel(repoExisting), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (es *UserEventstore) UserChanges(ctx context.Context, id string, lastSequence uint64, limit uint64) (*usr_model.UserChanges, error) {
|
||||||
|
query := ChangesQuery(id, lastSequence)
|
||||||
|
|
||||||
|
events, err := es.Eventstore.FilterEvents(context.Background(), query)
|
||||||
|
if err != nil {
|
||||||
|
logging.Log("EVENT-g9HCv").WithError(err).Warn("eventstore unavailable")
|
||||||
|
return nil, errors.ThrowInternal(err, "EVENT-htuG9", "unable to get current user")
|
||||||
|
}
|
||||||
|
if len(events) == 0 {
|
||||||
|
return nil, caos_errs.ThrowNotFound(nil, "EVENT-6cAxe", "no objects found")
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make([]*usr_model.UserChange, 0)
|
||||||
|
|
||||||
|
for _, u := range events {
|
||||||
|
creationDate, err := ptypes.TimestampProto(u.CreationDate)
|
||||||
|
logging.Log("EVENT-8GTGS").OnError(err).Debug("unable to parse timestamp")
|
||||||
|
change := &usr_model.UserChange{
|
||||||
|
ChangeDate: creationDate,
|
||||||
|
EventType: u.Type.String(),
|
||||||
|
Modifier: u.EditorUser,
|
||||||
|
Sequence: u.Sequence,
|
||||||
|
}
|
||||||
|
|
||||||
|
userDummy := model.Profile{}
|
||||||
|
if u.Data != nil {
|
||||||
|
if err := json.Unmarshal(u.Data, &userDummy); err != nil {
|
||||||
|
log.Println("Error getting data!", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
change.Data = userDummy
|
||||||
|
|
||||||
|
result = append(result, change)
|
||||||
|
if lastSequence < u.Sequence {
|
||||||
|
lastSequence = u.Sequence
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
changes := &usr_model.UserChanges{
|
||||||
|
Changes: result,
|
||||||
|
LastSequence: lastSequence,
|
||||||
|
}
|
||||||
|
|
||||||
|
return changes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func ChangesQuery(userID string, latestSequence uint64) *es_models.SearchQuery {
|
||||||
|
query := es_models.NewSearchQuery().
|
||||||
|
AggregateTypeFilter(model.UserAggregate).
|
||||||
|
LatestSequenceFilter(latestSequence).
|
||||||
|
AggregateIDFilter(userID)
|
||||||
|
return query
|
||||||
|
}
|
||||||
|
|
||||||
func (es *UserEventstore) InitializeUserCodeByID(ctx context.Context, userID string) (*usr_model.InitUserCode, error) {
|
func (es *UserEventstore) InitializeUserCodeByID(ctx context.Context, userID string) (*usr_model.InitUserCode, error) {
|
||||||
if userID == "" {
|
if userID == "" {
|
||||||
return nil, caos_errs.ThrowPreconditionFailed(nil, "EVENT-d8diw", "userID missing")
|
return nil, caos_errs.ThrowPreconditionFailed(nil, "EVENT-d8diw", "userID missing")
|
||||||
|
@ -2,9 +2,10 @@ package eventsourcing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/caos/zitadel/internal/id"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/caos/zitadel/internal/id"
|
||||||
|
|
||||||
mock_cache "github.com/caos/zitadel/internal/cache/mock"
|
mock_cache "github.com/caos/zitadel/internal/cache/mock"
|
||||||
"github.com/caos/zitadel/internal/crypto"
|
"github.com/caos/zitadel/internal/crypto"
|
||||||
"github.com/caos/zitadel/internal/eventstore/mock"
|
"github.com/caos/zitadel/internal/eventstore/mock"
|
||||||
@ -456,3 +457,34 @@ func GetMockManipulateUserNoEventsWithPw(ctrl *gomock.Controller) *UserEventstor
|
|||||||
mockEs.EXPECT().PushAggregates(gomock.Any(), gomock.Any()).Return(nil)
|
mockEs.EXPECT().PushAggregates(gomock.Any(), gomock.Any()).Return(nil)
|
||||||
return GetMockedEventstoreWithPw(ctrl, mockEs, false, false, false, true)
|
return GetMockedEventstoreWithPw(ctrl, mockEs, false, false, false, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetMockedEventstoreComplexity(ctrl *gomock.Controller, mockEs *mock.MockEventstore) *UserEventstore {
|
||||||
|
return &UserEventstore{
|
||||||
|
Eventstore: mockEs,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMockChangesUserOK(ctrl *gomock.Controller) *UserEventstore {
|
||||||
|
user := model.Profile{
|
||||||
|
FirstName: "Hans",
|
||||||
|
LastName: "Muster",
|
||||||
|
UserName: "HansMuster",
|
||||||
|
}
|
||||||
|
data, err := json.Marshal(user)
|
||||||
|
if err != nil {
|
||||||
|
|
||||||
|
}
|
||||||
|
events := []*es_models.Event{
|
||||||
|
&es_models.Event{AggregateID: "AggregateID", Sequence: 1, AggregateType: model.UserAggregate, Data: data},
|
||||||
|
}
|
||||||
|
mockEs := mock.NewMockEventstore(ctrl)
|
||||||
|
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||||
|
return GetMockedEventstoreComplexity(ctrl, mockEs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMockChangesUserNoEvents(ctrl *gomock.Controller) *UserEventstore {
|
||||||
|
events := []*es_models.Event{}
|
||||||
|
mockEs := mock.NewMockEventstore(ctrl)
|
||||||
|
mockEs.EXPECT().FilterEvents(gomock.Any(), gomock.Any()).Return(events, nil)
|
||||||
|
return GetMockedEventstoreComplexity(ctrl, mockEs)
|
||||||
|
}
|
||||||
|
@ -2,11 +2,13 @@ package eventsourcing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
policy_model "github.com/caos/zitadel/internal/policy/model"
|
"encoding/json"
|
||||||
"net"
|
"net"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
policy_model "github.com/caos/zitadel/internal/policy/model"
|
||||||
|
|
||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/api/auth"
|
"github.com/caos/zitadel/internal/api/auth"
|
||||||
@ -3211,3 +3213,71 @@ func TestRemoveOTP(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestChangesUser(t *testing.T) {
|
||||||
|
ctrl := gomock.NewController(t)
|
||||||
|
type args struct {
|
||||||
|
es *UserEventstore
|
||||||
|
id string
|
||||||
|
secId string
|
||||||
|
lastSequence uint64
|
||||||
|
limit uint64
|
||||||
|
}
|
||||||
|
type res struct {
|
||||||
|
changes *model.UserChanges
|
||||||
|
user *model.Profile
|
||||||
|
wantErr bool
|
||||||
|
errFunc func(err error) bool
|
||||||
|
}
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
args args
|
||||||
|
res res
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "changes from events, ok",
|
||||||
|
args: args{
|
||||||
|
es: GetMockChangesUserOK(ctrl),
|
||||||
|
id: "1",
|
||||||
|
lastSequence: 0,
|
||||||
|
limit: 0,
|
||||||
|
},
|
||||||
|
res: res{
|
||||||
|
changes: &model.UserChanges{Changes: []*model.UserChange{&model.UserChange{EventType: "", Sequence: 1, Modifier: ""}}, LastSequence: 1},
|
||||||
|
user: &model.Profile{FirstName: "Hans", LastName: "Muster", UserName: "HansMuster"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "changes from events, no events",
|
||||||
|
args: args{
|
||||||
|
es: GetMockChangesUserNoEvents(ctrl),
|
||||||
|
id: "2",
|
||||||
|
lastSequence: 0,
|
||||||
|
limit: 0,
|
||||||
|
},
|
||||||
|
res: res{
|
||||||
|
wantErr: true,
|
||||||
|
errFunc: caos_errs.IsNotFound,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
result, err := tt.args.es.UserChanges(nil, tt.args.id, tt.args.lastSequence, tt.args.limit)
|
||||||
|
|
||||||
|
user := &model.Profile{}
|
||||||
|
if result != nil && len(result.Changes) > 0 {
|
||||||
|
b, err := json.Marshal(result.Changes[0].Data)
|
||||||
|
json.Unmarshal(b, user)
|
||||||
|
if err != nil {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !tt.res.wantErr && result.LastSequence != tt.res.changes.LastSequence && user.UserName != tt.res.user.UserName {
|
||||||
|
t.Errorf("got wrong result name: expected: %v, actual: %v ", tt.res.changes.LastSequence, result.LastSequence)
|
||||||
|
}
|
||||||
|
if tt.res.wantErr && !tt.res.errFunc(err) {
|
||||||
|
t.Errorf("got wrong err: %v ", err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1229,11 +1229,11 @@ var fileDescriptor_73a7fc70dcc2027c = []byte{
|
|||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
var _ context.Context
|
var _ context.Context
|
||||||
var _ grpc.ClientConnInterface
|
var _ grpc.ClientConn
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
// is compatible with the grpc package it is being compiled against.
|
// is compatible with the grpc package it is being compiled against.
|
||||||
const _ = grpc.SupportPackageIsVersion6
|
const _ = grpc.SupportPackageIsVersion4
|
||||||
|
|
||||||
// AdminServiceClient is the client API for AdminService service.
|
// AdminServiceClient is the client API for AdminService service.
|
||||||
//
|
//
|
||||||
@ -1252,10 +1252,10 @@ type AdminServiceClient interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type adminServiceClient struct {
|
type adminServiceClient struct {
|
||||||
cc grpc.ClientConnInterface
|
cc *grpc.ClientConn
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAdminServiceClient(cc grpc.ClientConnInterface) AdminServiceClient {
|
func NewAdminServiceClient(cc *grpc.ClientConn) AdminServiceClient {
|
||||||
return &adminServiceClient{cc}
|
return &adminServiceClient{cc}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,15 +38,6 @@ func request_AdminService_Healthz_0(ctx context.Context, marshaler runtime.Marsh
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AdminService_Healthz_0(ctx context.Context, marshaler runtime.Marshaler, server AdminServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.Healthz(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AdminService_Ready_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AdminService_Ready_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -56,15 +47,6 @@ func request_AdminService_Ready_0(ctx context.Context, marshaler runtime.Marshal
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AdminService_Ready_0(ctx context.Context, marshaler runtime.Marshaler, server AdminServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.Ready(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AdminService_Validate_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AdminService_Validate_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -74,15 +56,6 @@ func request_AdminService_Validate_0(ctx context.Context, marshaler runtime.Mars
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AdminService_Validate_0(ctx context.Context, marshaler runtime.Marshaler, server AdminServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.Validate(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
filter_AdminService_IsOrgUnique_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
filter_AdminService_IsOrgUnique_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||||
)
|
)
|
||||||
@ -103,19 +76,6 @@ func request_AdminService_IsOrgUnique_0(ctx context.Context, marshaler runtime.M
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AdminService_IsOrgUnique_0(ctx context.Context, marshaler runtime.Marshaler, server AdminServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq UniqueOrgRequest
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_AdminService_IsOrgUnique_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.IsOrgUnique(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AdminService_GetOrgByID_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AdminService_GetOrgByID_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq OrgID
|
var protoReq OrgID
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -143,33 +103,6 @@ func request_AdminService_GetOrgByID_0(ctx context.Context, marshaler runtime.Ma
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AdminService_GetOrgByID_0(ctx context.Context, marshaler runtime.Marshaler, server AdminServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq OrgID
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
var (
|
|
||||||
val string
|
|
||||||
ok bool
|
|
||||||
err error
|
|
||||||
_ = err
|
|
||||||
)
|
|
||||||
|
|
||||||
val, ok = pathParams["id"]
|
|
||||||
if !ok {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
|
||||||
}
|
|
||||||
|
|
||||||
protoReq.Id, err = runtime.String(val)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.GetOrgByID(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AdminService_SearchOrgs_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AdminService_SearchOrgs_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq OrgSearchRequest
|
var protoReq OrgSearchRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -187,23 +120,6 @@ func request_AdminService_SearchOrgs_0(ctx context.Context, marshaler runtime.Ma
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AdminService_SearchOrgs_0(ctx context.Context, marshaler runtime.Marshaler, server AdminServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq OrgSearchRequest
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.SearchOrgs(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AdminService_SetUpOrg_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AdminService_SetUpOrg_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq OrgSetUpRequest
|
var protoReq OrgSetUpRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -221,171 +137,6 @@ func request_AdminService_SetUpOrg_0(ctx context.Context, marshaler runtime.Mars
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AdminService_SetUpOrg_0(ctx context.Context, marshaler runtime.Marshaler, server AdminServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq OrgSetUpRequest
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.SetUpOrg(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterAdminServiceHandlerServer registers the http handlers for service AdminService to "mux".
|
|
||||||
// UnaryRPC :call AdminServiceServer directly.
|
|
||||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
|
||||||
func RegisterAdminServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AdminServiceServer, opts []grpc.DialOption) error {
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AdminService_Healthz_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AdminService_Healthz_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AdminService_Healthz_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AdminService_Ready_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AdminService_Ready_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AdminService_Ready_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AdminService_Validate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AdminService_Validate_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AdminService_Validate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AdminService_IsOrgUnique_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AdminService_IsOrgUnique_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AdminService_IsOrgUnique_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AdminService_GetOrgByID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AdminService_GetOrgByID_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AdminService_GetOrgByID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("POST", pattern_AdminService_SearchOrgs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AdminService_SearchOrgs_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AdminService_SearchOrgs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("POST", pattern_AdminService_SetUpOrg_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AdminService_SetUpOrg_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AdminService_SetUpOrg_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterAdminServiceHandlerFromEndpoint is same as RegisterAdminServiceHandler but
|
// RegisterAdminServiceHandlerFromEndpoint is same as RegisterAdminServiceHandler but
|
||||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||||
func RegisterAdminServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
func RegisterAdminServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||||
|
@ -2515,11 +2515,11 @@ var fileDescriptor_8bbd6f3875b0e874 = []byte{
|
|||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
var _ context.Context
|
var _ context.Context
|
||||||
var _ grpc.ClientConnInterface
|
var _ grpc.ClientConn
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
// is compatible with the grpc package it is being compiled against.
|
// is compatible with the grpc package it is being compiled against.
|
||||||
const _ = grpc.SupportPackageIsVersion6
|
const _ = grpc.SupportPackageIsVersion4
|
||||||
|
|
||||||
// AuthServiceClient is the client API for AuthService service.
|
// AuthServiceClient is the client API for AuthService service.
|
||||||
//
|
//
|
||||||
@ -2558,10 +2558,10 @@ type AuthServiceClient interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type authServiceClient struct {
|
type authServiceClient struct {
|
||||||
cc grpc.ClientConnInterface
|
cc *grpc.ClientConn
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient {
|
func NewAuthServiceClient(cc *grpc.ClientConn) AuthServiceClient {
|
||||||
return &authServiceClient{cc}
|
return &authServiceClient{cc}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,15 +38,6 @@ func request_AuthService_Healthz_0(ctx context.Context, marshaler runtime.Marsha
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_Healthz_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.Healthz(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_Ready_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_Ready_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -56,15 +47,6 @@ func request_AuthService_Ready_0(ctx context.Context, marshaler runtime.Marshale
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_Ready_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.Ready(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_Validate_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_Validate_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -74,15 +56,6 @@ func request_AuthService_Validate_0(ctx context.Context, marshaler runtime.Marsh
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_Validate_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.Validate(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_GetMyUserSessions_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_GetMyUserSessions_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -92,15 +65,6 @@ func request_AuthService_GetMyUserSessions_0(ctx context.Context, marshaler runt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_GetMyUserSessions_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.GetMyUserSessions(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_GetMyUserProfile_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_GetMyUserProfile_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -110,15 +74,6 @@ func request_AuthService_GetMyUserProfile_0(ctx context.Context, marshaler runti
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_GetMyUserProfile_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.GetMyUserProfile(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_UpdateMyUserProfile_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_UpdateMyUserProfile_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq UpdateUserProfileRequest
|
var protoReq UpdateUserProfileRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -136,23 +91,6 @@ func request_AuthService_UpdateMyUserProfile_0(ctx context.Context, marshaler ru
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_UpdateMyUserProfile_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq UpdateUserProfileRequest
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.UpdateMyUserProfile(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_GetMyUserEmail_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_GetMyUserEmail_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -162,15 +100,6 @@ func request_AuthService_GetMyUserEmail_0(ctx context.Context, marshaler runtime
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_GetMyUserEmail_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.GetMyUserEmail(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_ChangeMyUserEmail_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_ChangeMyUserEmail_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq UpdateUserEmailRequest
|
var protoReq UpdateUserEmailRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -188,23 +117,6 @@ func request_AuthService_ChangeMyUserEmail_0(ctx context.Context, marshaler runt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_ChangeMyUserEmail_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq UpdateUserEmailRequest
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.ChangeMyUserEmail(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_VerifyMyUserEmail_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_VerifyMyUserEmail_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq VerifyMyUserEmailRequest
|
var protoReq VerifyMyUserEmailRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -222,23 +134,6 @@ func request_AuthService_VerifyMyUserEmail_0(ctx context.Context, marshaler runt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_VerifyMyUserEmail_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq VerifyMyUserEmailRequest
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.VerifyMyUserEmail(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_ResendMyEmailVerificationMail_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_ResendMyEmailVerificationMail_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -256,23 +151,6 @@ func request_AuthService_ResendMyEmailVerificationMail_0(ctx context.Context, ma
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_ResendMyEmailVerificationMail_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.ResendMyEmailVerificationMail(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_GetMyUserPhone_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_GetMyUserPhone_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -282,15 +160,6 @@ func request_AuthService_GetMyUserPhone_0(ctx context.Context, marshaler runtime
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_GetMyUserPhone_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.GetMyUserPhone(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_ChangeMyUserPhone_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_ChangeMyUserPhone_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq UpdateUserPhoneRequest
|
var protoReq UpdateUserPhoneRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -308,23 +177,6 @@ func request_AuthService_ChangeMyUserPhone_0(ctx context.Context, marshaler runt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_ChangeMyUserPhone_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq UpdateUserPhoneRequest
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.ChangeMyUserPhone(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_VerifyMyUserPhone_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_VerifyMyUserPhone_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq VerifyUserPhoneRequest
|
var protoReq VerifyUserPhoneRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -342,23 +194,6 @@ func request_AuthService_VerifyMyUserPhone_0(ctx context.Context, marshaler runt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_VerifyMyUserPhone_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq VerifyUserPhoneRequest
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.VerifyMyUserPhone(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_ResendMyPhoneVerificationCode_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_ResendMyPhoneVerificationCode_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -376,23 +211,6 @@ func request_AuthService_ResendMyPhoneVerificationCode_0(ctx context.Context, ma
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_ResendMyPhoneVerificationCode_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.ResendMyPhoneVerificationCode(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_GetMyUserAddress_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_GetMyUserAddress_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -402,15 +220,6 @@ func request_AuthService_GetMyUserAddress_0(ctx context.Context, marshaler runti
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_GetMyUserAddress_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.GetMyUserAddress(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_UpdateMyUserAddress_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_UpdateMyUserAddress_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq UpdateUserAddressRequest
|
var protoReq UpdateUserAddressRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -428,23 +237,6 @@ func request_AuthService_UpdateMyUserAddress_0(ctx context.Context, marshaler ru
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_UpdateMyUserAddress_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq UpdateUserAddressRequest
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.UpdateMyUserAddress(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_GetMyMfas_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_GetMyMfas_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -454,15 +246,6 @@ func request_AuthService_GetMyMfas_0(ctx context.Context, marshaler runtime.Mars
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_GetMyMfas_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.GetMyMfas(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_ChangeMyPassword_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_ChangeMyPassword_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq PasswordChange
|
var protoReq PasswordChange
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -480,23 +263,6 @@ func request_AuthService_ChangeMyPassword_0(ctx context.Context, marshaler runti
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_ChangeMyPassword_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq PasswordChange
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.ChangeMyPassword(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_AddMfaOTP_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_AddMfaOTP_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -514,23 +280,6 @@ func request_AuthService_AddMfaOTP_0(ctx context.Context, marshaler runtime.Mars
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_AddMfaOTP_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.AddMfaOTP(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_VerifyMfaOTP_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_VerifyMfaOTP_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq VerifyMfaOtp
|
var protoReq VerifyMfaOtp
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -548,23 +297,6 @@ func request_AuthService_VerifyMfaOTP_0(ctx context.Context, marshaler runtime.M
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_VerifyMfaOTP_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq VerifyMfaOtp
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.VerifyMfaOTP(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_RemoveMfaOTP_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_RemoveMfaOTP_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -574,15 +306,6 @@ func request_AuthService_RemoveMfaOTP_0(ctx context.Context, marshaler runtime.M
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_RemoveMfaOTP_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.RemoveMfaOTP(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_SearchMyUserGrant_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_SearchMyUserGrant_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq UserGrantSearchRequest
|
var protoReq UserGrantSearchRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -600,23 +323,6 @@ func request_AuthService_SearchMyUserGrant_0(ctx context.Context, marshaler runt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_SearchMyUserGrant_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq UserGrantSearchRequest
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.SearchMyUserGrant(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_SearchMyProjectOrgs_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_SearchMyProjectOrgs_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq MyProjectOrgSearchRequest
|
var protoReq MyProjectOrgSearchRequest
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -634,23 +340,6 @@ func request_AuthService_SearchMyProjectOrgs_0(ctx context.Context, marshaler ru
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_SearchMyProjectOrgs_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq MyProjectOrgSearchRequest
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
|
||||||
if berr != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
|
||||||
}
|
|
||||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg, err := server.SearchMyProjectOrgs(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_AuthService_GetMyZitadelPermissions_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_AuthService_GetMyZitadelPermissions_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var protoReq empty.Empty
|
var protoReq empty.Empty
|
||||||
var metadata runtime.ServerMetadata
|
var metadata runtime.ServerMetadata
|
||||||
@ -660,503 +349,6 @@ func request_AuthService_GetMyZitadelPermissions_0(ctx context.Context, marshale
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func local_request_AuthService_GetMyZitadelPermissions_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var protoReq empty.Empty
|
|
||||||
var metadata runtime.ServerMetadata
|
|
||||||
|
|
||||||
msg, err := server.GetMyZitadelPermissions(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterAuthServiceHandlerServer registers the http handlers for service AuthService to "mux".
|
|
||||||
// UnaryRPC :call AuthServiceServer directly.
|
|
||||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
|
||||||
func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServiceServer, opts []grpc.DialOption) error {
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AuthService_Healthz_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_Healthz_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_Healthz_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AuthService_Ready_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_Ready_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_Ready_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AuthService_Validate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_Validate_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_Validate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AuthService_GetMyUserSessions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_GetMyUserSessions_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_GetMyUserSessions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AuthService_GetMyUserProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_GetMyUserProfile_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_GetMyUserProfile_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("PUT", pattern_AuthService_UpdateMyUserProfile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_UpdateMyUserProfile_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_UpdateMyUserProfile_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AuthService_GetMyUserEmail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_GetMyUserEmail_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_GetMyUserEmail_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("PUT", pattern_AuthService_ChangeMyUserEmail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_ChangeMyUserEmail_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_ChangeMyUserEmail_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("POST", pattern_AuthService_VerifyMyUserEmail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_VerifyMyUserEmail_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_VerifyMyUserEmail_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("POST", pattern_AuthService_ResendMyEmailVerificationMail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_ResendMyEmailVerificationMail_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_ResendMyEmailVerificationMail_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AuthService_GetMyUserPhone_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_GetMyUserPhone_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_GetMyUserPhone_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("PUT", pattern_AuthService_ChangeMyUserPhone_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_ChangeMyUserPhone_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_ChangeMyUserPhone_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("POST", pattern_AuthService_VerifyMyUserPhone_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_VerifyMyUserPhone_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_VerifyMyUserPhone_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("POST", pattern_AuthService_ResendMyPhoneVerificationCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_ResendMyPhoneVerificationCode_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_ResendMyPhoneVerificationCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AuthService_GetMyUserAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_GetMyUserAddress_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_GetMyUserAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("PUT", pattern_AuthService_UpdateMyUserAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_UpdateMyUserAddress_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_UpdateMyUserAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AuthService_GetMyMfas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_GetMyMfas_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_GetMyMfas_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("PUT", pattern_AuthService_ChangeMyPassword_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_ChangeMyPassword_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_ChangeMyPassword_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("POST", pattern_AuthService_AddMfaOTP_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_AddMfaOTP_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_AddMfaOTP_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("PUT", pattern_AuthService_VerifyMfaOTP_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_VerifyMfaOTP_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_VerifyMfaOTP_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("DELETE", pattern_AuthService_RemoveMfaOTP_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_RemoveMfaOTP_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_RemoveMfaOTP_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("POST", pattern_AuthService_SearchMyUserGrant_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_SearchMyUserGrant_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_SearchMyUserGrant_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("POST", pattern_AuthService_SearchMyProjectOrgs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_SearchMyProjectOrgs_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_SearchMyProjectOrgs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
mux.Handle("GET", pattern_AuthService_GetMyZitadelPermissions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_AuthService_GetMyZitadelPermissions_0(rctx, inboundMarshaler, server, req, pathParams)
|
|
||||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
forward_AuthService_GetMyZitadelPermissions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterAuthServiceHandlerFromEndpoint is same as RegisterAuthServiceHandler but
|
// RegisterAuthServiceHandlerFromEndpoint is same as RegisterAuthServiceHandler but
|
||||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||||
func RegisterAuthServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
func RegisterAuthServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||||
|
@ -2,6 +2,7 @@ package grpc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/errors"
|
"github.com/caos/zitadel/internal/errors"
|
||||||
"github.com/golang/protobuf/ptypes/empty"
|
"github.com/golang/protobuf/ptypes/empty"
|
||||||
)
|
)
|
||||||
@ -85,5 +86,9 @@ func (s *Server) RegenerateOIDCClientSecret(ctx context.Context, in *Application
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) ApplicationChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
|
func (s *Server) ApplicationChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
|
||||||
return nil, errors.ThrowUnimplemented(nil, "GRPC-due45", "Not implemented")
|
response, err := s.project.ApplicationChanges(ctx, changesRequest.Id, changesRequest.SecId, 0, 0)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return appChangesToResponse(response, changesRequest.GetSequenceOffset(), changesRequest.GetLimit()), nil
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
package grpc
|
package grpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/caos/logging"
|
"github.com/caos/logging"
|
||||||
"github.com/caos/zitadel/internal/eventstore/models"
|
"github.com/caos/zitadel/internal/eventstore/models"
|
||||||
"github.com/caos/zitadel/internal/model"
|
"github.com/caos/zitadel/internal/model"
|
||||||
proj_model "github.com/caos/zitadel/internal/project/model"
|
proj_model "github.com/caos/zitadel/internal/project/model"
|
||||||
"github.com/golang/protobuf/ptypes"
|
"github.com/golang/protobuf/ptypes"
|
||||||
|
"google.golang.org/protobuf/encoding/protojson"
|
||||||
|
"google.golang.org/protobuf/types/known/structpb"
|
||||||
)
|
)
|
||||||
|
|
||||||
func appFromModel(app *proj_model.Application) *Application {
|
func appFromModel(app *proj_model.Application) *Application {
|
||||||
@ -311,3 +315,31 @@ func oidcAuthMethodTypeFromModel(authType proj_model.OIDCAuthMethodType) OIDCAut
|
|||||||
return OIDCAuthMethodType_OIDCAUTHMETHODTYPE_BASIC
|
return OIDCAuthMethodType_OIDCAUTHMETHODTYPE_BASIC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func appChangesToResponse(response *proj_model.ApplicationChanges, offset uint64, limit uint64) (_ *Changes) {
|
||||||
|
return &Changes{
|
||||||
|
Limit: limit,
|
||||||
|
Offset: offset,
|
||||||
|
Changes: appChangesToMgtAPI(response),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func appChangesToMgtAPI(changes *proj_model.ApplicationChanges) (_ []*Change) {
|
||||||
|
result := make([]*Change, len(changes.Changes))
|
||||||
|
|
||||||
|
for i, change := range changes.Changes {
|
||||||
|
b, err := json.Marshal(change.Data)
|
||||||
|
data := &structpb.Struct{}
|
||||||
|
err = protojson.Unmarshal(b, data)
|
||||||
|
if err != nil {
|
||||||
|
}
|
||||||
|
result[i] = &Change{
|
||||||
|
ChangeDate: change.ChangeDate,
|
||||||
|
EventType: change.EventType,
|
||||||
|
Sequence: change.Sequence,
|
||||||
|
Data: data,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -364,7 +364,7 @@ func request_ManagementService_UserChanges_0(ctx context.Context, marshaler runt
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
filter_ManagementService_ApplicationChanges_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
filter_ManagementService_ApplicationChanges_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0, "sec_id": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
|
||||||
)
|
)
|
||||||
|
|
||||||
func request_ManagementService_ApplicationChanges_0(ctx context.Context, marshaler runtime.Marshaler, client ManagementServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_ManagementService_ApplicationChanges_0(ctx context.Context, marshaler runtime.Marshaler, client ManagementServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
@ -389,6 +389,17 @@ func request_ManagementService_ApplicationChanges_0(ctx context.Context, marshal
|
|||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val, ok = pathParams["sec_id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sec_id")
|
||||||
|
}
|
||||||
|
|
||||||
|
protoReq.SecId, err = runtime.String(val)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sec_id", err)
|
||||||
|
}
|
||||||
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ManagementService_ApplicationChanges_0); err != nil {
|
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ManagementService_ApplicationChanges_0); err != nil {
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
}
|
}
|
||||||
@ -5832,7 +5843,7 @@ var (
|
|||||||
|
|
||||||
pattern_ManagementService_UserChanges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2}, []string{"users", "id", "changes"}, ""))
|
pattern_ManagementService_UserChanges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2}, []string{"users", "id", "changes"}, ""))
|
||||||
|
|
||||||
pattern_ManagementService_ApplicationChanges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2}, []string{"applications", "id", "changes"}, ""))
|
pattern_ManagementService_ApplicationChanges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"projects", "id", "applications", "sec_id", "changes"}, ""))
|
||||||
|
|
||||||
pattern_ManagementService_OrgChanges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2}, []string{"orgs", "id", "changes"}, ""))
|
pattern_ManagementService_OrgChanges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1, 2, 2}, []string{"orgs", "id", "changes"}, ""))
|
||||||
|
|
||||||
|
@ -19,44 +19,6 @@
|
|||||||
"application/grpc"
|
"application/grpc"
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"/applications/{id}/changes": {
|
|
||||||
"get": {
|
|
||||||
"operationId": "ApplicationChanges",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "A successful response.",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/v1Changes"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"in": "path",
|
|
||||||
"required": true,
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "limit",
|
|
||||||
"in": "query",
|
|
||||||
"required": false,
|
|
||||||
"type": "string",
|
|
||||||
"format": "uint64"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sequence_offset",
|
|
||||||
"in": "query",
|
|
||||||
"required": false,
|
|
||||||
"type": "string",
|
|
||||||
"format": "uint64"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"ManagementService"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/authgrants/_search": {
|
"/authgrants/_search": {
|
||||||
"post": {
|
"post": {
|
||||||
"summary": "Grant",
|
"summary": "Grant",
|
||||||
@ -436,6 +398,12 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "sec_id",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "limit",
|
"name": "limit",
|
||||||
"in": "query",
|
"in": "query",
|
||||||
@ -1159,6 +1127,50 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/projects/{id}/applications/{sec_id}/changes": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "ApplicationChanges",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/v1Changes"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sec_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "limit",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"type": "string",
|
||||||
|
"format": "uint64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sequence_offset",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"type": "string",
|
||||||
|
"format": "uint64"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"ManagementService"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/projects/{id}/changes": {
|
"/projects/{id}/changes": {
|
||||||
"get": {
|
"get": {
|
||||||
"operationId": "ProjectChanges",
|
"operationId": "ProjectChanges",
|
||||||
@ -1177,6 +1189,12 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "sec_id",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "limit",
|
"name": "limit",
|
||||||
"in": "query",
|
"in": "query",
|
||||||
@ -2834,6 +2852,12 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "sec_id",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "limit",
|
"name": "limit",
|
||||||
"in": "query",
|
"in": "query",
|
||||||
|
@ -2,8 +2,6 @@ package grpc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *Server) GetOrgByID(ctx context.Context, orgID *OrgID) (*Org, error) {
|
func (s *Server) GetOrgByID(ctx context.Context, orgID *OrgID) (*Org, error) {
|
||||||
@ -39,5 +37,9 @@ func (s *Server) ReactivateOrg(ctx context.Context, in *OrgID) (*Org, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) OrgChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
|
func (s *Server) OrgChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
|
||||||
return nil, errors.ThrowUnimplemented(nil, "GRPC-DNiIq", "unimplemented")
|
response, err := s.org.OrgChanges(ctx, changesRequest.Id, 0, 0)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return orgChangesToResponse(response, changesRequest.GetSequenceOffset(), changesRequest.GetLimit()), nil
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package grpc
|
package grpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/caos/logging"
|
"github.com/caos/logging"
|
||||||
org_model "github.com/caos/zitadel/internal/org/model"
|
org_model "github.com/caos/zitadel/internal/org/model"
|
||||||
"github.com/golang/protobuf/ptypes"
|
"github.com/golang/protobuf/ptypes"
|
||||||
|
"google.golang.org/protobuf/encoding/protojson"
|
||||||
|
"google.golang.org/protobuf/types/known/structpb"
|
||||||
)
|
)
|
||||||
|
|
||||||
func orgsFromModel(orgs []*org_model.Org) []*Org {
|
func orgsFromModel(orgs []*org_model.Org) []*Org {
|
||||||
@ -58,3 +62,31 @@ func orgStateFromModel(state org_model.OrgState) OrgState {
|
|||||||
return OrgState_ORGSTATE_UNSPECIFIED
|
return OrgState_ORGSTATE_UNSPECIFIED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func orgChangesToResponse(response *org_model.OrgChanges, offset uint64, limit uint64) (_ *Changes) {
|
||||||
|
return &Changes{
|
||||||
|
Limit: limit,
|
||||||
|
Offset: offset,
|
||||||
|
Changes: orgChangesToMgtAPI(response),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func orgChangesToMgtAPI(changes *org_model.OrgChanges) (_ []*Change) {
|
||||||
|
result := make([]*Change, len(changes.Changes))
|
||||||
|
|
||||||
|
for i, change := range changes.Changes {
|
||||||
|
b, err := json.Marshal(change.Data)
|
||||||
|
data := &structpb.Struct{}
|
||||||
|
err = protojson.Unmarshal(b, data)
|
||||||
|
if err != nil {
|
||||||
|
}
|
||||||
|
result[i] = &Change{
|
||||||
|
ChangeDate: change.ChangeDate,
|
||||||
|
EventType: change.EventType,
|
||||||
|
Sequence: change.Sequence,
|
||||||
|
Data: data,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@ package grpc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/api"
|
"github.com/caos/zitadel/internal/api"
|
||||||
"github.com/caos/zitadel/internal/api/auth"
|
"github.com/caos/zitadel/internal/api/auth"
|
||||||
grpc_util "github.com/caos/zitadel/internal/api/grpc"
|
grpc_util "github.com/caos/zitadel/internal/api/grpc"
|
||||||
@ -124,7 +125,11 @@ func (s *Server) SearchProjectRoles(ctx context.Context, in *ProjectRoleSearchRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) ProjectChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
|
func (s *Server) ProjectChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
|
||||||
return nil, errors.ThrowUnimplemented(nil, "GRPC-mci3f", "Not implemented")
|
response, err := s.project.ProjectChanges(ctx, changesRequest.Id, 0, 0)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return projectChangesToResponse(response, changesRequest.GetSequenceOffset(), changesRequest.GetLimit()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) IsZitadel(ctx context.Context, projectID string) bool {
|
func (s *Server) IsZitadel(ctx context.Context, projectID string) bool {
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
package grpc
|
package grpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/caos/logging"
|
"github.com/caos/logging"
|
||||||
"github.com/caos/zitadel/internal/eventstore/models"
|
"github.com/caos/zitadel/internal/eventstore/models"
|
||||||
proj_model "github.com/caos/zitadel/internal/project/model"
|
proj_model "github.com/caos/zitadel/internal/project/model"
|
||||||
"github.com/golang/protobuf/ptypes"
|
"github.com/golang/protobuf/ptypes"
|
||||||
|
"google.golang.org/protobuf/encoding/protojson"
|
||||||
|
"google.golang.org/protobuf/types/known/structpb"
|
||||||
)
|
)
|
||||||
|
|
||||||
func projectFromModel(project *proj_model.Project) *Project {
|
func projectFromModel(project *proj_model.Project) *Project {
|
||||||
@ -248,3 +252,31 @@ func projectRoleSearchKeyToModel(key ProjectRoleSearchKey) proj_model.ProjectRol
|
|||||||
return proj_model.PROJECTROLESEARCHKEY_UNSPECIFIED
|
return proj_model.PROJECTROLESEARCHKEY_UNSPECIFIED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func projectChangesToResponse(response *proj_model.ProjectChanges, offset uint64, limit uint64) (_ *Changes) {
|
||||||
|
return &Changes{
|
||||||
|
Limit: limit,
|
||||||
|
Offset: offset,
|
||||||
|
Changes: projectChangesToMgtAPI(response),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func projectChangesToMgtAPI(changes *proj_model.ProjectChanges) (_ []*Change) {
|
||||||
|
result := make([]*Change, len(changes.Changes))
|
||||||
|
|
||||||
|
for i, change := range changes.Changes {
|
||||||
|
b, err := json.Marshal(change.Data)
|
||||||
|
data := &structpb.Struct{}
|
||||||
|
err = protojson.Unmarshal(b, data)
|
||||||
|
if err != nil {
|
||||||
|
}
|
||||||
|
result[i] = &Change{
|
||||||
|
ChangeDate: change.ChangeDate,
|
||||||
|
EventType: change.EventType,
|
||||||
|
Sequence: change.Sequence,
|
||||||
|
Data: data,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@ package grpc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/api"
|
"github.com/caos/zitadel/internal/api"
|
||||||
grpc_util "github.com/caos/zitadel/internal/api/grpc"
|
grpc_util "github.com/caos/zitadel/internal/api/grpc"
|
||||||
"github.com/caos/zitadel/internal/errors"
|
"github.com/caos/zitadel/internal/errors"
|
||||||
@ -36,7 +37,11 @@ func (s *Server) SearchUsers(ctx context.Context, in *UserSearchRequest) (*UserS
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) UserChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
|
func (s *Server) UserChanges(ctx context.Context, changesRequest *ChangeRequest) (*Changes, error) {
|
||||||
return nil, errors.ThrowUnimplemented(nil, "GRPC-pl6Zu", "Not implemented")
|
response, err := s.user.UserChanges(ctx, changesRequest.Id, 0, 0)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return userChangesToResponse(response, changesRequest.GetSequenceOffset(), changesRequest.GetLimit()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) IsUserUnique(ctx context.Context, request *UniqueUserRequest) (*UniqueUserResponse, error) {
|
func (s *Server) IsUserUnique(ctx context.Context, request *UniqueUserRequest) (*UniqueUserResponse, error) {
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
package grpc
|
package grpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/caos/logging"
|
"github.com/caos/logging"
|
||||||
"github.com/caos/zitadel/internal/eventstore/models"
|
"github.com/caos/zitadel/internal/eventstore/models"
|
||||||
usr_model "github.com/caos/zitadel/internal/user/model"
|
usr_model "github.com/caos/zitadel/internal/user/model"
|
||||||
"github.com/golang/protobuf/ptypes"
|
"github.com/golang/protobuf/ptypes"
|
||||||
"golang.org/x/text/language"
|
"golang.org/x/text/language"
|
||||||
|
"google.golang.org/protobuf/encoding/protojson"
|
||||||
|
"google.golang.org/protobuf/types/known/structpb"
|
||||||
)
|
)
|
||||||
|
|
||||||
func userFromModel(user *usr_model.User) *User {
|
func userFromModel(user *usr_model.User) *User {
|
||||||
@ -397,3 +401,31 @@ func mfaStateFromModel(state usr_model.MfaState) MFAState {
|
|||||||
return MFAState_MFASTATE_UNSPECIFIED
|
return MFAState_MFASTATE_UNSPECIFIED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func userChangesToResponse(response *usr_model.UserChanges, offset uint64, limit uint64) (_ *Changes) {
|
||||||
|
return &Changes{
|
||||||
|
Limit: limit,
|
||||||
|
Offset: offset,
|
||||||
|
Changes: userChangesToMgtAPI(response),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func userChangesToMgtAPI(changes *usr_model.UserChanges) (_ []*Change) {
|
||||||
|
result := make([]*Change, len(changes.Changes))
|
||||||
|
|
||||||
|
for i, change := range changes.Changes {
|
||||||
|
b, err := json.Marshal(change.Data)
|
||||||
|
data := &structpb.Struct{}
|
||||||
|
err = protojson.Unmarshal(b, data)
|
||||||
|
if err != nil {
|
||||||
|
}
|
||||||
|
result[i] = &Change{
|
||||||
|
ChangeDate: change.ChangeDate,
|
||||||
|
EventType: change.EventType,
|
||||||
|
Sequence: change.Sequence,
|
||||||
|
Data: data,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
@ -170,7 +170,7 @@ service ManagementService {
|
|||||||
|
|
||||||
rpc ApplicationChanges(ChangeRequest) returns (Changes) {
|
rpc ApplicationChanges(ChangeRequest) returns (Changes) {
|
||||||
option (google.api.http) = {
|
option (google.api.http) = {
|
||||||
get: "/applications/{id}/changes"
|
get: "/projects/{id}/applications/{sec_id}/changes"
|
||||||
};
|
};
|
||||||
|
|
||||||
option (caos.zitadel.utils.v1.auth_option) = {
|
option (caos.zitadel.utils.v1.auth_option) = {
|
||||||
@ -1235,8 +1235,9 @@ service ManagementService {
|
|||||||
|
|
||||||
message ChangeRequest {
|
message ChangeRequest {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
uint64 limit= 2;
|
string sec_id = 2;
|
||||||
uint64 sequence_offset = 3;
|
uint64 limit= 3;
|
||||||
|
uint64 sequence_offset = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Changes {
|
message Changes {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user