mirror of https://github.com/jumpserver/jumpserver
merge
commit
be92ac58ae
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
|
|
|
@ -47,6 +47,7 @@ INSTALLED_APPS = [
|
|||
'ops.apps.OpsConfig',
|
||||
'audits.apps.AuditsConfig',
|
||||
'common.apps.CommonConfig',
|
||||
'rest_framework',
|
||||
'bootstrapform',
|
||||
# 'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
|
@ -168,6 +169,13 @@ BOOTSTRAP_COLUMN_COUNT = 11
|
|||
# Init data or generate fake data source for development
|
||||
FIXTURE_DIRS = [os.path.join(BASE_DIR, 'fixtures'), ]
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
# Use Django's standard `django.contrib.auth` permissions,
|
||||
# or allow read-only access for unauthenticated users.
|
||||
'DEFAULT_PERMISSION_CLASSES': [
|
||||
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
|
||||
],
|
||||
}
|
||||
# This setting is required to override the Django's main loop, when running in
|
||||
# development mode, such as ./manage runserver
|
||||
WSGI_APPLICATION = 'ws4redis.django_runserver.application'
|
||||
|
@ -190,4 +198,4 @@ WS4REDIS_PREFIX = 'demo'
|
|||
|
||||
SESSION_ENGINE = 'redis_sessions.session'
|
||||
|
||||
SESSION_REDIS_PREFIX = 'session'
|
||||
SESSION_REDIS_PREFIX = 'session'
|
||||
|
|
|
@ -35,6 +35,10 @@ urlpatterns = [
|
|||
# url(r'^admin/', admin.site.urls),
|
||||
]
|
||||
|
||||
urlpatterns += [
|
||||
url(r'^api/users/', include('users.api_urls')),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
# ~*~ coding: utf-8 ~*~
|
||||
#
|
||||
#
|
||||
|
||||
from rest_framework import viewsets
|
||||
|
||||
from .serializers import UserSerializer
|
||||
from .models import User, UserGroup, Role
|
||||
|
||||
|
||||
class UserViewSet(viewsets.ModelViewSet):
|
||||
queryset = User.objects.all()
|
||||
serializer_class = UserSerializer
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
|
||||
from django.conf.urls import url, include
|
||||
from rest_framework import routers
|
||||
|
||||
from .api import UserViewSet
|
||||
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register(r'users', UserViewSet)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'v1/', include(router.urls)),
|
||||
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_fr
|
|
@ -0,0 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from .models import Role, User, UserGroup
|
||||
|
||||
|
||||
class UserSerializer(serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = User
|
||||
fields =
|
|
@ -11,3 +11,5 @@ redis==2.10.5
|
|||
six==1.10.0
|
||||
wcwidth==0.1.7
|
||||
websocket-client==0.37.0
|
||||
djangorestframework==3.4.5
|
||||
ForgeryPy==0.1
|
||||
|
|
Loading…
Reference in New Issue