Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
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
coco
Commits
f689b5a3
Commit
f689b5a3
authored
Jan 02, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
def3ad94
e710aeb4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
7 deletions
+5
-7
httpd.py
coco/httpd.py
+3
-6
proxy.py
coco/proxy.py
+2
-1
No files found.
coco/httpd.py
View file @
f689b5a3
...
...
@@ -32,7 +32,7 @@ class BaseWebSocketHandler:
else
:
remote_ip
=
request
.
remote_addr
self
.
clients
[
request
.
sid
][
"request"
]
=
Request
((
remote_ip
,
0
))
self
.
clients
[
request
.
sid
][
"request"
]
.
user
=
self
.
get_current_user
()
self
.
clients
[
request
.
sid
][
"request"
]
.
user
=
self
.
current_user
self
.
clients
[
request
.
sid
][
"request"
]
.
meta
=
{
"width"
:
self
.
clients
[
request
.
sid
][
"cols"
],
"height"
:
self
.
clients
[
request
.
sid
][
"rows"
]}
# self.request.__dict__.update(request.__dict__)
...
...
@@ -41,9 +41,6 @@ class BaseWebSocketHandler:
self
.
app
.
clients
.
append
(
self
.
clients
[
request
.
sid
][
"client"
])
self
.
clients
[
request
.
sid
][
"forwarder"
]
=
ProxyServer
(
self
.
app
,
self
.
clients
[
request
.
sid
][
"client"
])
def
get_current_user
(
self
):
return
User
(
id
=
'61c39c1f5b5742688180b6dda235aadd'
,
username
=
"admin"
,
name
=
"admin"
)
def
check_origin
(
self
,
origin
):
return
True
...
...
@@ -78,7 +75,8 @@ class SSHws(Namespace, BaseWebSocketHandler):
"rw"
:
[]
}
join_room
(
room
)
self
.
current_user
=
self
.
app
.
service
.
check_user_cookie
(
session_id
=
request
.
cookies
.
get
(
'sessionid'
,
''
),
csrf_token
=
request
.
cookies
.
get
(
'csrftoken'
,
''
))
self
.
prepare
(
request
)
def
on_data
(
self
,
message
):
...
...
@@ -162,4 +160,3 @@ class HttpServer:
def
shutdown
(
self
):
pass
coco/proxy.py
View file @
f689b5a3
...
...
@@ -69,7 +69,8 @@ class ProxyServer:
def
get_server_conn
(
self
,
asset
,
system_user
):
logger
.
info
(
"Connect to {}"
.
format
(
asset
.
hostname
))
if
not
self
.
validate_permission
(
asset
,
system_user
):
self
.
client
.
send
(
warning
(
_
(
'No permission'
)))
# self.client.send(warning(_('No permission')))
self
.
client
.
send
(
warning
(
'No permission'
))
return
None
self
.
get_system_user_auth
(
system_user
)
if
True
:
...
...
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