Skip to content

Commit

Permalink
- 修复用户搜索接口参数异常的问题 fixed #329
Browse files Browse the repository at this point in the history
- 修复导入备份时资产所有者未替换的问题
  • Loading branch information
dushixiang committed Jan 28, 2023
1 parent aa42e85 commit 51cfc04
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions server/repository/authorised.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package repository

import (
"context"

"next-terminal/server/dto"
"next-terminal/server/model"
)
Expand Down
2 changes: 1 addition & 1 deletion server/repository/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package repository

import (
"context"
"next-terminal/server/common/nt"

"next-terminal/server/common/nt"
"next-terminal/server/env"

"gorm.io/gorm"
Expand Down
1 change: 1 addition & 0 deletions server/repository/role_menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package repository

import (
"context"

"next-terminal/server/model"
)

Expand Down
2 changes: 1 addition & 1 deletion server/repository/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package repository

import (
"context"
"next-terminal/server/common/nt"
"time"

"next-terminal/server/common/nt"
"next-terminal/server/dto"
"next-terminal/server/model"
)
Expand Down
2 changes: 1 addition & 1 deletion server/repository/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (r userRepository) Find(c context.Context, pageIndex, pageSize int, usernam
dbCounter = dbCounter.Joins("left join login_policies_ref as ref on users.id = ref.user_id")

db = db.Where("ref.login_policy_id = ?", loginPolicyId)
dbCounter = db.Where("ref.login_policy_id = ?", loginPolicyId)
dbCounter = dbCounter.Where("ref.login_policy_id = ?", loginPolicyId)
}

if len(username) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion server/service/access_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package service
import (
"context"
"errors"
"next-terminal/server/common/nt"

"next-terminal/server/common"
"next-terminal/server/common/nt"
"next-terminal/server/dto"
"next-terminal/server/env"
"next-terminal/server/global/cache"
Expand Down
6 changes: 4 additions & 2 deletions server/service/authorised.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package service

import (
"context"
"github.com/pkg/errors"
"gorm.io/gorm"

"next-terminal/server/common"
"next-terminal/server/dto"
"next-terminal/server/model"
"next-terminal/server/repository"
"next-terminal/server/utils"

"github.com/pkg/errors"
"gorm.io/gorm"
)

var AuthorisedService = new(authorisedService)
Expand Down
10 changes: 4 additions & 6 deletions server/service/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"
"encoding/json"
"errors"
"next-terminal/server/common/maps"
"strings"

"next-terminal/server/common"
"next-terminal/server/common/maps"
"next-terminal/server/common/nt"
"next-terminal/server/config"
"next-terminal/server/dto"
Expand Down Expand Up @@ -177,12 +177,8 @@ func (service backupService) Import(backup *dto.Backup) error {

if len(backup.Storages) > 0 {
for _, item := range backup.Storages {
owner := userIdMapping[item.Owner]
if owner == "" {
continue
}
item.ID = utils.UUID()
item.Owner = owner
item.Owner = userIdMapping[item.Owner]
item.Created = common.NowJsonTime()
if err := repository.StorageRepository.Create(ctx, &item); err != nil {
return err
Expand Down Expand Up @@ -251,6 +247,7 @@ func (service backupService) Import(backup *dto.Backup) error {
oldId := item.ID
newId := utils.UUID()
item.ID = newId
item.Owner = userIdMapping[item.Owner]
if err := CredentialService.Create(ctx, &item); err != nil {
return err
}
Expand Down Expand Up @@ -279,6 +276,7 @@ func (service backupService) Import(backup *dto.Backup) error {
}

oldId := m["id"].(string)
m["owner"] = userIdMapping[m["owner"].(string)]
asset, err := AssetService.Create(ctx, m)
if err != nil {
return err
Expand Down

0 comments on commit 51cfc04

Please sign in to comment.