mirror of
https://github.com/goharbor/harbor
synced 2024-09-20 23:59:56 +00:00
Merge pull request #9838 from stonezdj/fix_review
Fix review comments on PR9749
This commit is contained in:
commit
6f0b4a139a
|
@ -97,9 +97,12 @@ func GetUserGroup(id int) (*models.UserGroup, error) {
|
|||
|
||||
// PopulateGroup - Return the group ID by given group name. if not exist in Harbor DB, create one
|
||||
func PopulateGroup(userGroups []models.UserGroup) ([]int, error) {
|
||||
var ugList []int
|
||||
ugList := make([]int, 0)
|
||||
for _, group := range userGroups {
|
||||
OnBoardUserGroup(&group)
|
||||
err := OnBoardUserGroup(&group)
|
||||
if err != nil {
|
||||
return ugList, err
|
||||
}
|
||||
if group.ID > 0 {
|
||||
ugList = append(ugList, group.ID)
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ func (u *UserGroup) TableName() string {
|
|||
|
||||
// UserGroupsFromName ...
|
||||
func UserGroupsFromName(groupNames []string, groupType int) []UserGroup {
|
||||
var groups []UserGroup
|
||||
groups := make([]UserGroup, 0)
|
||||
for _, name := range groupNames {
|
||||
groups = append(groups, UserGroup{GroupName: name, GroupType: groupType})
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ func (l *Auth) Authenticate(m models.AuthModel) (*models.User, error) {
|
|||
}
|
||||
|
||||
}
|
||||
var userGroups []models.UserGroup
|
||||
userGroups := make([]models.UserGroup, 0)
|
||||
for _, dn := range ldapUsers[0].GroupDNList {
|
||||
userGroups = append(userGroups, models.UserGroup{GroupName: dn, LdapGroupDN: dn, GroupType: common.LDAPGroupType})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user