mirror of https://github.com/goharbor/harbor.git
Merge pull request #14653 from reasonerjt/no-oidc-admin
Do not get OIDC info for admin user
This commit is contained in:
commit
e6b2abfebb
|
@ -20,6 +20,7 @@ import (
|
|||
|
||||
"github.com/goharbor/harbor/src/common/security"
|
||||
"github.com/goharbor/harbor/src/common/security/local"
|
||||
"github.com/goharbor/harbor/src/lib/errors"
|
||||
"github.com/goharbor/harbor/src/lib/q"
|
||||
"github.com/goharbor/harbor/src/pkg/oidc"
|
||||
"github.com/goharbor/harbor/src/pkg/user"
|
||||
|
@ -102,7 +103,7 @@ func (c *controller) Get(ctx context.Context, id int, opt *Option) (*models.User
|
|||
if opt != nil && opt.WithOIDCInfo {
|
||||
oidcMeta, err := c.oidcMetaMgr.GetByUserID(ctx, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.UnknownError(err)
|
||||
}
|
||||
u.OIDCUserMeta = oidcMeta
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ func (u *usersAPI) getUserByID(ctx context.Context, id int) (*models.UserResp, e
|
|||
}
|
||||
|
||||
opt := &user.Option{
|
||||
WithOIDCInfo: auth == common.OIDCAuth,
|
||||
WithOIDCInfo: auth == common.OIDCAuth && id > 1, // Super user is authenticated via DB
|
||||
}
|
||||
|
||||
us, err := u.ctl.Get(ctx, id, opt)
|
||||
|
|
Loading…
Reference in New Issue