mirror of
https://github.com/zitadel/zitadel.git
synced 2025-05-01 06:40:53 +00:00
fix: projectorgs (#193)
* fix: get my project orgs * fix: get project orgs
This commit is contained in:
parent
17f0eea4a1
commit
25b97b1bcc
@ -31,4 +31,3 @@ cockroachdb/cockroach:v19.2.2 start --insecure
|
|||||||
|
|
||||||
#### Should show eventstore, management, admin, auth
|
#### Should show eventstore, management, admin, auth
|
||||||
`show databases;`
|
`show databases;`
|
||||||
|
|
||||||
|
@ -45,7 +45,8 @@ func VerifyTokenAndWriteCtxData(ctx context.Context, token, orgID string, t Toke
|
|||||||
//TODO: Remove as soon an authentification is implemented
|
//TODO: Remove as soon an authentification is implemented
|
||||||
if CheckInternal(ctx) {
|
if CheckInternal(ctx) {
|
||||||
userID = grpc_util.GetHeader(ctx, api.ZitadelUserID)
|
userID = grpc_util.GetHeader(ctx, api.ZitadelUserID)
|
||||||
projectID = grpc_util.GetHeader(ctx, api.ZitadelClientID)
|
clientID = grpc_util.GetHeader(ctx, api.ZitadelClientID)
|
||||||
|
projectID, err = t.GetProjectIDByClientID(ctx, clientID)
|
||||||
agentID = grpc_util.GetHeader(ctx, api.ZitadelAgentID)
|
agentID = grpc_util.GetHeader(ctx, api.ZitadelAgentID)
|
||||||
} else {
|
} else {
|
||||||
userID, clientID, agentID, err = verifyAccessToken(ctx, token, t)
|
userID, clientID, agentID, err = verifyAccessToken(ctx, token, t)
|
||||||
|
@ -42,7 +42,11 @@ func (repo *UserGrantRepo) SearchMyProjectOrgs(ctx context.Context, request *gra
|
|||||||
if ctxData.ProjectID == "" {
|
if ctxData.ProjectID == "" {
|
||||||
return nil, caos_errs.ThrowPreconditionFailed(nil, "APP-7lqva", "Could not get ProjectID")
|
return nil, caos_errs.ThrowPreconditionFailed(nil, "APP-7lqva", "Could not get ProjectID")
|
||||||
}
|
}
|
||||||
if ctxData.ProjectID == repo.AuthZRepo.IamProjectID {
|
err := repo.AuthZRepo.FillIamProjectID(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if ctxData.ProjectID == repo.AuthZRepo.UserGrantRepo.IamProjectID {
|
||||||
isAdmin, err := repo.IsIamAdmin(ctx)
|
isAdmin, err := repo.IsIamAdmin(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -49,7 +49,7 @@ func (repo *TokenVerifierRepo) ProjectIDByClientID(ctx context.Context, clientID
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
return app.ID, nil
|
return app.ProjectID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *TokenVerifierRepo) verifierClientID(ctx context.Context, appName, appClientID string) (string, error) {
|
func (repo *TokenVerifierRepo) verifierClientID(ctx context.Context, appName, appClientID string) (string, error) {
|
||||||
|
@ -23,7 +23,7 @@ func (repo *UserGrantRepo) Health() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (repo *UserGrantRepo) ResolveGrants(ctx context.Context) (*auth.Grant, error) {
|
func (repo *UserGrantRepo) ResolveGrants(ctx context.Context) (*auth.Grant, error) {
|
||||||
err := repo.fillIamProjectID(ctx)
|
err := repo.FillIamProjectID(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ func (repo *UserGrantRepo) SearchMyZitadelPermissions(ctx context.Context) ([]st
|
|||||||
return permissions.Permissions, nil
|
return permissions.Permissions, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *UserGrantRepo) fillIamProjectID(ctx context.Context) error {
|
func (repo *UserGrantRepo) FillIamProjectID(ctx context.Context) error {
|
||||||
if repo.IamProjectID != "" {
|
if repo.IamProjectID != "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user