Merge pull request #4706 from ywk253100/180418_admiral

Fix bug #4688
This commit is contained in:
Daniel Jiang 2018-04-18 18:23:24 +08:00 committed by GitHub
commit 5792829951
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,7 +76,7 @@ func (a *AuthContext) GetProjectRoles(projectIDOrName interface{}) []int {
roles := []string{}
for _, project := range a.Projects {
p := convertProject(project)
if p.ProjectID == id || p.Name == name {
if id != 0 && p.ProjectID == id || len(name) > 0 && p.Name == name {
roles = append(roles, project.Roles...)
break
}