mirror of
https://github.com/goharbor/harbor
synced 2025-04-14 07:42:55 +00:00
Merge pull request #14910 from reasonerjt/fix-oidc-callback-nil-pointer
Check user in security context before getting the ID
This commit is contained in:
commit
4492e47e89
2
.github/workflows/CI.yml
vendored
2
.github/workflows/CI.yml
vendored
|
@ -37,7 +37,7 @@ jobs:
|
||||||
- name: setup Docker
|
- name: setup Docker
|
||||||
uses: docker-practice/actions-setup-docker@0.0.1
|
uses: docker-practice/actions-setup-docker@0.0.1
|
||||||
with:
|
with:
|
||||||
docker_version: 18.09
|
docker_version: 20.04
|
||||||
docker_channel: stable
|
docker_channel: stable
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -113,7 +113,7 @@ func (c *controller) Get(ctx context.Context, id int, opt *Option) (*models.User
|
||||||
return nil, fmt.Errorf("can't find security context")
|
return nil, fmt.Errorf("can't find security context")
|
||||||
}
|
}
|
||||||
lsc, ok := sctx.(*local.SecurityContext)
|
lsc, ok := sctx.(*local.SecurityContext)
|
||||||
if ok && lsc.User().UserID == id {
|
if ok && lsc.User() != nil && lsc.User().UserID == id {
|
||||||
u.AdminRoleInAuth = lsc.User().AdminRoleInAuth
|
u.AdminRoleInAuth = lsc.User().AdminRoleInAuth
|
||||||
}
|
}
|
||||||
if opt != nil && opt.WithOIDCInfo {
|
if opt != nil && opt.WithOIDCInfo {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user