mirror of
https://github.com/zitadel/zitadel.git
synced 2025-04-30 20:10:48 +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
|
||||
`show databases;`
|
||||
|
||||
|
@ -45,7 +45,8 @@ func VerifyTokenAndWriteCtxData(ctx context.Context, token, orgID string, t Toke
|
||||
//TODO: Remove as soon an authentification is implemented
|
||||
if CheckInternal(ctx) {
|
||||
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)
|
||||
} else {
|
||||
userID, clientID, agentID, err = verifyAccessToken(ctx, token, t)
|
||||
|
@ -42,7 +42,11 @@ func (repo *UserGrantRepo) SearchMyProjectOrgs(ctx context.Context, request *gra
|
||||
if ctxData.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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -49,7 +49,7 @@ func (repo *TokenVerifierRepo) ProjectIDByClientID(ctx context.Context, clientID
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return app.ID, nil
|
||||
return app.ProjectID, nil
|
||||
}
|
||||
|
||||
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) {
|
||||
err := repo.fillIamProjectID(ctx)
|
||||
err := repo.FillIamProjectID(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -59,7 +59,7 @@ func (repo *UserGrantRepo) SearchMyZitadelPermissions(ctx context.Context) ([]st
|
||||
return permissions.Permissions, nil
|
||||
}
|
||||
|
||||
func (repo *UserGrantRepo) fillIamProjectID(ctx context.Context) error {
|
||||
func (repo *UserGrantRepo) FillIamProjectID(ctx context.Context) error {
|
||||
if repo.IamProjectID != "" {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user