mirror of
https://github.com/goharbor/harbor
synced 2025-04-11 21:02:47 +00:00
Merge pull request #1967 from ywk253100/170407_role
Fixes out of range bug when listing projects
This commit is contained in:
commit
3543a4742f
|
@ -302,7 +302,10 @@ func (p *ProjectAPI) List() {
|
|||
log.Errorf("failed to get user's project role: %v", err)
|
||||
p.CustomAbort(http.StatusInternalServerError, "")
|
||||
}
|
||||
projectList[i].Role = roles[0].RoleID
|
||||
if len(roles) != 0 {
|
||||
projectList[i].Role = roles[0].RoleID
|
||||
}
|
||||
|
||||
if projectList[i].Role == models.PROJECTADMIN ||
|
||||
isAdmin {
|
||||
projectList[i].Togglable = true
|
||||
|
|
Loading…
Reference in New Issue
Block a user