Commit f1da5e13 authored by Eric's avatar Eric

[update] modify service assets part

parent 117e5199
package service package service
import ( import (
"encoding/json"
"fmt" "fmt"
"cocogo/pkg/logger" "cocogo/pkg/logger"
...@@ -9,11 +8,16 @@ import ( ...@@ -9,11 +8,16 @@ import (
) )
func GetSystemUserAssetAuthInfo(systemUserID, assetID string) (info model.SystemUserAuthInfo) { func GetSystemUserAssetAuthInfo(systemUserID, assetID string) (info model.SystemUserAuthInfo) {
Url := authClient.ParseUrlQuery(fmt.Sprintf(SystemUserAssetAuthURL, systemUserID, assetID), nil)
err := authClient.Get(Url, &info)
if err != nil {
logger.Error("Get system user Asset auth info failed")
}
return return
} }
func GetSystemUserAuthInfo(systemUserID string) (info model.SystemUserAuthInfo) { func GetSystemUserAuthInfo(systemUserID string) (info model.SystemUserAuthInfo) {
Url := fmt.Sprintf(SystemUserAuthInfoURL, systemUserID) Url := authClient.ParseUrlQuery(fmt.Sprintf(SystemUserAuthInfoURL, systemUserID), nil)
err := authClient.Get(Url, &info) err := authClient.Get(Url, &info)
if err != nil { if err != nil {
...@@ -22,8 +26,8 @@ func GetSystemUserAuthInfo(systemUserID string) (info model.SystemUserAuthInfo) ...@@ -22,8 +26,8 @@ func GetSystemUserAuthInfo(systemUserID string) (info model.SystemUserAuthInfo)
return return
} }
func GetSystemUserFilterRules(systemUsrId string) (rules []model.SystemUserFilterRule, err error) { func GetSystemUserFilterRules(systemUserID string) (rules []model.SystemUserFilterRule, err error) {
var resp = `[ /*[
{ {
"id": "12ae03a4-81b7-43d9-b356-2db4d5d63927", "id": "12ae03a4-81b7-43d9-b356-2db4d5d63927",
"org_id": "", "org_id": "",
...@@ -62,7 +66,12 @@ func GetSystemUserFilterRules(systemUsrId string) (rules []model.SystemUserFilte ...@@ -62,7 +66,12 @@ func GetSystemUserFilterRules(systemUsrId string) (rules []model.SystemUserFilte
"created_by": "Administrator", "created_by": "Administrator",
"filter": "de7693ca-75d5-4639-986b-44ed390260a0" "filter": "de7693ca-75d5-4639-986b-44ed390260a0"
} }
]` ]`*/
err = json.Unmarshal([]byte(resp), &rules) Url := authClient.ParseUrlQuery(fmt.Sprintf(SystemUserCmdFilterRules, systemUserID), nil)
err = authClient.Get(Url, &rules)
if err != nil {
logger.Error("Get system user auth info failed")
}
return return
} }
...@@ -7,6 +7,7 @@ const ( ...@@ -7,6 +7,7 @@ const (
SystemUserAssetAuthURL = "/api/assets/v1/system-user/%s/asset/%s/auth-info/" // 该系统用户对某资产的授权 SystemUserAssetAuthURL = "/api/assets/v1/system-user/%s/asset/%s/auth-info/" // 该系统用户对某资产的授权
SystemUserAuthInfoURL = "/api/assets/v1/system-user/%s/auth-info/" // 该系统用户的授权 SystemUserAuthInfoURL = "/api/assets/v1/system-user/%s/auth-info/" // 该系统用户的授权
SystemUserCmdFilterRules = "/api/assets/v1/system-user/%s/cmd-filter-rules/" // 过滤规则url
TerminalRegisterURL = "/api/terminal/v2/terminal-registrations/" // 注册当前coco TerminalRegisterURL = "/api/terminal/v2/terminal-registrations/" // 注册当前coco
TerminalConfigURL = "/api/terminal/v1/terminal/config/" // 从jumpserver获取coco的配置 TerminalConfigURL = "/api/terminal/v1/terminal/config/" // 从jumpserver获取coco的配置
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment