Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
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
jumpserver
Commits
0a931bbf
Commit
0a931bbf
authored
Jan 22, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature] es support
parent
17181db8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
9 additions
and
17 deletions
+9
-17
api.py
apps/common/api.py
+0
-5
fields.py
apps/common/fields.py
+0
-1
forms.py
apps/common/forms.py
+2
-2
models.py
apps/common/models.py
+7
-3
views.py
apps/common/views.py
+0
-1
settings.py
apps/jumpserver/settings.py
+0
-4
django.mo
apps/locale/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/locale/zh/LC_MESSAGES/django.po
+0
-0
forms.py
apps/users/forms.py
+0
-1
No files found.
apps/common/api.py
View file @
0a931bbf
...
@@ -63,8 +63,6 @@ class LDAPTestingAPI(APIView):
...
@@ -63,8 +63,6 @@ class LDAPTestingAPI(APIView):
search_filter
=
serializer
.
validated_data
[
"AUTH_LDAP_SEARCH_FILTER"
]
search_filter
=
serializer
.
validated_data
[
"AUTH_LDAP_SEARCH_FILTER"
]
attr_map
=
serializer
.
validated_data
[
"AUTH_LDAP_USER_ATTR_MAP"
]
attr_map
=
serializer
.
validated_data
[
"AUTH_LDAP_USER_ATTR_MAP"
]
print
(
serializer
.
validated_data
)
try
:
try
:
attr_map
=
json
.
loads
(
attr_map
)
attr_map
=
json
.
loads
(
attr_map
)
except
json
.
JSONDecodeError
:
except
json
.
JSONDecodeError
:
...
@@ -77,9 +75,6 @@ class LDAPTestingAPI(APIView):
...
@@ -77,9 +75,6 @@ class LDAPTestingAPI(APIView):
except
Exception
as
e
:
except
Exception
as
e
:
return
Response
({
"error"
:
str
(
e
)},
status
=
401
)
return
Response
({
"error"
:
str
(
e
)},
status
=
401
)
print
(
search_ou
)
print
(
search_filter
%
({
"user"
:
"*"
}))
print
(
attr_map
.
values
())
ok
=
conn
.
search
(
search_ou
,
search_filter
%
({
"user"
:
"*"
}),
ok
=
conn
.
search
(
search_ou
,
search_filter
%
({
"user"
:
"*"
}),
attributes
=
list
(
attr_map
.
values
()))
attributes
=
list
(
attr_map
.
values
()))
if
not
ok
:
if
not
ok
:
...
...
apps/common/fields.py
View file @
0a931bbf
...
@@ -18,7 +18,6 @@ class DictField(forms.Field):
...
@@ -18,7 +18,6 @@ class DictField(forms.Field):
# we don't need to handle that explicitly.
# we don't need to handle that explicitly.
if
isinstance
(
value
,
six
.
string_types
):
if
isinstance
(
value
,
six
.
string_types
):
try
:
try
:
print
(
value
)
value
=
json
.
loads
(
value
)
value
=
json
.
loads
(
value
)
return
value
return
value
except
json
.
JSONDecodeError
:
except
json
.
JSONDecodeError
:
...
...
apps/common/forms.py
View file @
0a931bbf
...
@@ -36,9 +36,9 @@ class BaseForm(forms.Form):
...
@@ -36,9 +36,9 @@ class BaseForm(forms.Form):
for
name
,
field
in
self
.
fields
.
items
():
for
name
,
field
in
self
.
fields
.
items
():
db_value
=
getattr
(
db_settings
,
name
)
.
value
db_value
=
getattr
(
db_settings
,
name
)
.
value
django_value
=
getattr
(
settings
,
name
)
if
hasattr
(
settings
,
name
)
else
None
django_value
=
getattr
(
settings
,
name
)
if
hasattr
(
settings
,
name
)
else
None
if
db_value
is
not
Non
e
:
if
db_value
is
False
or
db_valu
e
:
field
.
initial
=
to_form_value
(
db_value
)
field
.
initial
=
to_form_value
(
db_value
)
elif
django_value
is
not
Non
e
:
elif
django_value
is
False
or
django_valu
e
:
field
.
initial
=
django_value
field
.
initial
=
django_value
def
save
(
self
,
category
=
"default"
):
def
save
(
self
,
category
=
"default"
):
...
...
apps/common/models.py
View file @
0a931bbf
...
@@ -2,6 +2,7 @@ import json
...
@@ -2,6 +2,7 @@ import json
import
ldap
import
ldap
from
django.db
import
models
from
django.db
import
models
from
django.db.utils
import
ProgrammingError
,
OperationalError
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.conf
import
settings
from
django.conf
import
settings
from
django_auth_ldap.config
import
LDAPSearch
from
django_auth_ldap.config
import
LDAPSearch
...
@@ -50,9 +51,12 @@ class Setting(models.Model):
...
@@ -50,9 +51,12 @@ class Setting(models.Model):
@classmethod
@classmethod
def
refresh_all_settings
(
cls
):
def
refresh_all_settings
(
cls
):
settings_list
=
cls
.
objects
.
all
()
try
:
for
setting
in
settings_list
:
settings_list
=
cls
.
objects
.
all
()
setting
.
refresh_setting
()
for
setting
in
settings_list
:
setting
.
refresh_setting
()
except
(
ProgrammingError
,
OperationalError
):
pass
def
refresh_setting
(
self
):
def
refresh_setting
(
self
):
try
:
try
:
...
...
apps/common/views.py
View file @
0a931bbf
...
@@ -107,7 +107,6 @@ class TerminalSettingView(AdminUserRequiredMixin, TemplateView):
...
@@ -107,7 +107,6 @@ class TerminalSettingView(AdminUserRequiredMixin, TemplateView):
return
super
()
.
get_context_data
(
**
kwargs
)
return
super
()
.
get_context_data
(
**
kwargs
)
def
post
(
self
,
request
):
def
post
(
self
,
request
):
print
(
request
.
POST
)
form
=
self
.
form_class
(
request
.
POST
)
form
=
self
.
form_class
(
request
.
POST
)
if
form
.
is_valid
():
if
form
.
is_valid
():
form
.
save
()
form
.
save
()
...
...
apps/jumpserver/settings.py
View file @
0a931bbf
...
@@ -385,10 +385,6 @@ TERMINAL_COMMAND_STORAGE = {
...
@@ -385,10 +385,6 @@ TERMINAL_COMMAND_STORAGE = {
# 'TYPE': 'elasticsearch',
# 'TYPE': 'elasticsearch',
# 'HOSTS': ['http://elastic:changeme@localhost:9200'],
# 'HOSTS': ['http://elastic:changeme@localhost:9200'],
# },
# },
# 'ali-hz-es': {
# 'TYPE': 'elasticsearch',
# 'HOSTS': ['http://elastic:changeme@localhost:9200'],
# }
}
}
...
...
apps/locale/zh/LC_MESSAGES/django.mo
View file @
0a931bbf
No preview for this file type
apps/locale/zh/LC_MESSAGES/django.po
View file @
0a931bbf
This diff is collapsed.
Click to expand it.
apps/users/forms.py
View file @
0a931bbf
...
@@ -172,7 +172,6 @@ class UserBulkUpdateForm(forms.ModelForm):
...
@@ -172,7 +172,6 @@ class UserBulkUpdateForm(forms.ModelForm):
if
self
.
data
.
get
(
field
)
is
not
None
:
if
self
.
data
.
get
(
field
)
is
not
None
:
changed_fields
.
append
(
field
)
changed_fields
.
append
(
field
)
print
(
changed_fields
)
cleaned_data
=
{
k
:
v
for
k
,
v
in
self
.
cleaned_data
.
items
()
cleaned_data
=
{
k
:
v
for
k
,
v
in
self
.
cleaned_data
.
items
()
if
k
in
changed_fields
}
if
k
in
changed_fields
}
users
=
cleaned_data
.
pop
(
'users'
,
''
)
users
=
cleaned_data
.
pop
(
'users'
,
''
)
...
...
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