mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
remove useless import
This commit is contained in:
parent
fc8fbbcb98
commit
836598f5c9
@ -19,7 +19,6 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/vmware/harbor/dao"
|
||||
"github.com/vmware/harbor/models"
|
||||
|
@ -59,11 +59,13 @@ func listRoles(userID int, projectID int64) ([]models.Role, error) {
|
||||
roles := make([]models.Role, 0, 1)
|
||||
isSysAdmin, err := dao.IsAdminRole(userID)
|
||||
if err != nil {
|
||||
log.Errorf("failed to determine whether the user %d is system admin: %v", userID, err)
|
||||
return roles, err
|
||||
}
|
||||
if isSysAdmin {
|
||||
role, err := dao.GetRoleByID(models.PROJECTADMIN)
|
||||
if err != nil {
|
||||
log.Errorf("failed to get role %d: %v", models.PROJECTADMIN, err)
|
||||
return roles, err
|
||||
}
|
||||
roles = append(roles, *role)
|
||||
@ -72,6 +74,7 @@ func listRoles(userID int, projectID int64) ([]models.Role, error) {
|
||||
|
||||
rs, err := dao.GetUserProjectRoles(userID, projectID)
|
||||
if err != nil {
|
||||
log.Errorf("failed to get user %d 's roles for project %d: %v", userID, projectID, err)
|
||||
return roles, err
|
||||
}
|
||||
roles = append(roles, rs...)
|
||||
|
Loading…
Reference in New Issue
Block a user