Chore: Remove org model duplicates (#61025)
Remove org model duplicates
This commit is contained in:
@@ -82,7 +82,7 @@ func (p *teamPermissionMigrator) mapPermissionToRBAC(permission models.Permissio
|
||||
}
|
||||
|
||||
func (p *teamPermissionMigrator) getUserRoleByOrgMapping() (map[int64]map[int64]string, error) {
|
||||
var orgUsers []*models.OrgUserDTO
|
||||
var orgUsers []*org.OrgUserDTO
|
||||
if err := p.sess.SQL(`SELECT * FROM org_user`).Cols("org_user.org_id", "org_user.user_id", "org_user.role").Find(&orgUsers); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -91,13 +91,13 @@ func (p *teamPermissionMigrator) getUserRoleByOrgMapping() (map[int64]map[int64]
|
||||
|
||||
// Loop through users and organise them by organization ID
|
||||
for _, orgUser := range orgUsers {
|
||||
orgRoles, initialized := userRolesByOrg[orgUser.OrgId]
|
||||
orgRoles, initialized := userRolesByOrg[orgUser.OrgID]
|
||||
if !initialized {
|
||||
orgRoles = map[int64]string{}
|
||||
}
|
||||
|
||||
orgRoles[orgUser.UserId] = orgUser.Role
|
||||
userRolesByOrg[orgUser.OrgId] = orgRoles
|
||||
orgRoles[orgUser.UserID] = orgUser.Role
|
||||
userRolesByOrg[orgUser.OrgID] = orgRoles
|
||||
}
|
||||
|
||||
return userRolesByOrg, nil
|
||||
|
||||
@@ -273,38 +273,38 @@ func setupTeams(t *testing.T, x *xorm.Engine) {
|
||||
require.NoError(t, errInsertUsers)
|
||||
require.Equal(t, int64(5), usersCount, "needed 5 users for this test to run")
|
||||
|
||||
orgUsers := []models.OrgUser{
|
||||
orgUsers := []org.OrgUser{
|
||||
{
|
||||
OrgId: 1,
|
||||
UserId: 1,
|
||||
OrgID: 1,
|
||||
UserID: 1,
|
||||
Role: org.RoleViewer,
|
||||
Created: now,
|
||||
Updated: now,
|
||||
},
|
||||
{
|
||||
OrgId: 1,
|
||||
UserId: 2,
|
||||
OrgID: 1,
|
||||
UserID: 2,
|
||||
Role: org.RoleViewer,
|
||||
Created: now,
|
||||
Updated: now,
|
||||
},
|
||||
{
|
||||
OrgId: 1,
|
||||
UserId: 3,
|
||||
OrgID: 1,
|
||||
UserID: 3,
|
||||
Role: org.RoleEditor,
|
||||
Created: now,
|
||||
Updated: now,
|
||||
},
|
||||
{
|
||||
OrgId: 1,
|
||||
UserId: 4,
|
||||
OrgID: 1,
|
||||
UserID: 4,
|
||||
Role: org.RoleAdmin,
|
||||
Created: now,
|
||||
Updated: now,
|
||||
},
|
||||
{
|
||||
OrgId: 2,
|
||||
UserId: 5,
|
||||
OrgID: 2,
|
||||
UserID: 5,
|
||||
Role: org.RoleEditor,
|
||||
Created: now,
|
||||
Updated: now,
|
||||
|
||||
Reference in New Issue
Block a user