添加删除接口,修改运行sql返回数据结构
This commit is contained in:
parent
6c835e371a
commit
1244feb7de
|
|
@ -156,7 +156,7 @@ func DeleteDBManage(req *proto.DeleteDBManageReq, userId int) error {
|
|||
return err
|
||||
}
|
||||
} else if req.Del_Type == 1 && req.UserID > 0 {
|
||||
if req.UserID != userId && user.Role != "admin" {
|
||||
if req.UserID != uint(userId) && user.Role != "admin" {
|
||||
return errors.New("unauthorized access to delete all database management systems")
|
||||
}
|
||||
err := dao.DeleteDBManageByUserID(req.UserID)
|
||||
|
|
@ -183,11 +183,11 @@ func DeleteSQLRunHistory(req *proto.DeleteDBManageSQLHistoryReq, userId int) err
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else if Del_Type == 1 && req.UserID > 0 {
|
||||
if req.UserID != userId && user.Role != "admin" {
|
||||
} else if req.Del_Type == 1 && req.UserID > 0 {
|
||||
if req.UserID != uint(userId) && user.Role != "admin" {
|
||||
return errors.New("unauthorized access to delete all SQL run history")
|
||||
}
|
||||
err := dao.DelSQLRunHistoryByAuthID(req.UserID)
|
||||
err := dao.DelSQLRunHistoryByAuthID(int(req.UserID))
|
||||
return err
|
||||
} else {
|
||||
return errors.New("invalid delete type or parameters")
|
||||
|
|
|
|||
Loading…
Reference in New Issue