Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
K
koko
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
koko
Commits
d23472ed
Commit
d23472ed
authored
Jul 12, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改url
parent
9de03f5e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
19 deletions
+22
-19
.gitignore
.gitignore
+4
-1
session.go
pkg/handler/session.go
+2
-2
assets.go
pkg/service/assets.go
+2
-2
terminal.go
pkg/service/terminal.go
+1
-1
urls.go
pkg/service/urls.go
+12
-12
users.go
pkg/service/users.go
+1
-1
No files found.
.gitignore
View file @
d23472ed
...
...
@@ -16,4 +16,7 @@ log/
vendor/
config.yml
host_key
cmd/coco
cmd/koko
cmd/logs
cmd/kokodir
build
pkg/handler/session.go
View file @
d23472ed
...
...
@@ -101,7 +101,7 @@ func (h *interactiveHandler) loadAssetsFromCache() {
go
h
.
firstLoadAssetAndNodes
()
}
else
{
h
.
assets
=
make
([]
model
.
Asset
,
0
)
h
.
firstLoadAssetAndNodes
()
go
h
.
firstLoadAssetAndNodes
()
}
}
...
...
@@ -159,7 +159,7 @@ func (h *interactiveHandler) Dispatch(ctx cctx.Context) {
if
err
!=
nil
{
if
err
!=
io
.
EOF
{
logger
.
Debug
(
"
u
ser disconnected"
)
logger
.
Debug
(
"
U
ser disconnected"
)
}
else
{
logger
.
Error
(
"Read from user err: "
,
err
)
}
...
...
pkg/service/assets.go
View file @
d23472ed
...
...
@@ -57,7 +57,7 @@ func GetSystemUserFilterRules(systemUserID string) (rules []model.SystemUserFilt
"filter": "de7693ca-75d5-4639-986b-44ed390260a0"
}
]`*/
Url
:=
fmt
.
Sprintf
(
SystemUserCmdFilterRules
,
systemUserID
)
Url
:=
fmt
.
Sprintf
(
SystemUserCmdFilterRules
ListURL
,
systemUserID
)
err
=
authClient
.
Get
(
Url
,
&
rules
)
if
err
!=
nil
{
...
...
@@ -94,7 +94,7 @@ func GetDomainWithGateway(gID string) (domain model.Domain) {
}
func
GetTokenAsset
(
token
string
)
(
tokenUser
model
.
TokenUser
)
{
Url
:=
fmt
.
Sprintf
(
TokenAssetU
rl
,
token
)
Url
:=
fmt
.
Sprintf
(
TokenAssetU
RL
,
token
)
err
:=
authClient
.
Get
(
Url
,
&
tokenUser
)
if
err
!=
nil
{
logger
.
Error
(
"Get Token Asset info failed: "
,
err
)
...
...
pkg/service/terminal.go
View file @
d23472ed
...
...
@@ -102,7 +102,7 @@ func PushSessionCommand(commands []*model.Command) (err error) {
}
func
PushFTPLog
(
data
*
model
.
FTPLog
)
(
err
error
)
{
err
=
authClient
.
Post
(
FTPLogList
,
data
,
nil
)
err
=
authClient
.
Post
(
FTPLogList
URL
,
data
,
nil
)
if
err
!=
nil
{
logger
.
Error
(
err
)
}
...
...
pkg/service/urls.go
View file @
d23472ed
...
...
@@ -3,16 +3,16 @@ package service
const
(
UserAuthURL
=
"/api/authentication/v1/auth/"
// post 验证用户登陆
UserProfileURL
=
"/api/users/v1/profile/"
// 获取当前用户的基本信息
UserListU
rl
=
"/api/users/v1/users/"
// 用户列表地址
UserListU
RL
=
"/api/users/v1/users/"
// 用户列表地址
UserDetailURL
=
"/api/users/v1/users/%s/"
// 获取用户信息
UserAuthOTPURL
=
"/api/authentication/v1/otp/auth/"
// 验证OTP
TokenAssetU
rl
=
"/api/authentication/v1/connection-token/?token=%s"
// Token name
TokenAssetU
RL
=
"/api/authentication/v1/connection-token/?token=%s"
// Token name
SystemUserAssetAuthURL
=
"/api/assets/v1/system-user/%s/asset/%s/auth-info/"
// 该系统用户对某资产的授权
SystemUserCmdFilterRules
=
"/api/assets/v1/system-user/%s/cmd-filter-rules/"
// 过滤规则url
SystemUserDetailURL
=
"/api/assets/v1/system-user/%s/"
// 某个系统用户的信息
AssetDetailURL
=
"/api/assets/v1/assets/%s/"
// 某一个资产信息
DomainDetailURL
=
"/api/assets/v1/domain/%s/?gateway=1"
SystemUserAssetAuthURL
=
"/api/assets/v1/system-user/%s/asset/%s/auth-info/"
// 该系统用户对某资产的授权
SystemUserCmdFilterRules
ListURL
=
"/api/assets/v1/system-user/%s/cmd-filter-rules/"
// 过滤规则url
SystemUserDetailURL
=
"/api/assets/v1/system-user/%s/"
// 某个系统用户的信息
AssetDetailURL
=
"/api/assets/v1/assets/%s/"
// 某一个资产信息
DomainDetailURL
=
"/api/assets/v1/domain/%s/?gateway=1"
TerminalRegisterURL
=
"/api/terminal/v2/terminal-registrations/"
// 注册当前coco
TerminalConfigURL
=
"/api/terminal/v1/terminal/config/"
// 从jumpserver获取coco的配置
...
...
@@ -22,11 +22,11 @@ const (
SessionDetailURL
=
"/api/terminal/v1/sessions/%s/"
// finish session的时候发送
SessionReplayURL
=
"/api/terminal/v1/sessions/%s/replay/"
//上传录像
SessionCommandURL
=
"/api/terminal/v1/command/"
//上传批量命令
F
TPLogList
=
"/api/audits/v1/ftp-log/"
// 上传 ftp日志
F
inishTaskURL
=
"/api/terminal/v1/tasks/%s/"
F
inishTaskURL
=
"/api/terminal/v1/tasks/%s/"
F
TPLogListURL
=
"/api/audits/v1/ftp-log/"
// 上传 ftp日志
UserAssetsURL
=
"/api/perms/v1/user/%s/assets/"
//获取用户授权的所有资产
UserNodesAssetsURL
=
"/api/perms/v1/user/%s/nodes-assets/"
// 获取用户授权的所有节点信息 节点分组
ValidateUserAssetPermissionURL
=
"/api/perms/v1/asset-permission/user/validate/"
//0不使用缓存 1 使用缓存 2 刷新缓存
UserAssetsURL
=
"/api/perms/v1/user
s
/%s/assets/"
//获取用户授权的所有资产
UserNodesAssetsURL
=
"/api/perms/v1/user
s
/%s/nodes-assets/"
// 获取用户授权的所有节点信息 节点分组
ValidateUserAssetPermissionURL
=
"/api/perms/v1/asset-permission
s
/user/validate/"
//0不使用缓存 1 使用缓存 2 刷新缓存
)
pkg/service/users.go
View file @
d23472ed
...
...
@@ -44,7 +44,7 @@ func GetProfile() (user *model.User, err error) {
func
GetUserByUsername
(
username
string
)
(
user
*
model
.
User
,
err
error
)
{
var
users
[]
*
model
.
User
payload
:=
map
[
string
]
string
{
"username"
:
username
}
err
=
authClient
.
Get
(
UserListU
rl
,
&
users
,
payload
)
err
=
authClient
.
Get
(
UserListU
RL
,
&
users
,
payload
)
if
err
!=
nil
{
return
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment