Fix bug: the user can push images although he have no permisson by checking empty value before assign permissions.
This commit is contained in:
Wenkai Yin 79628 2018-04-18 12:03:06 +08:00
parent 42ff98cb35
commit f6bd2f245d

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
}