Skip to content

Commit

Permalink
'listuser'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hadjer711 committed Jun 2, 2020
1 parent a721ec9 commit a900202
Show file tree
Hide file tree
Showing 103 changed files with 96 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .idea/CoronaWatchApi.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified API/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified API/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified API/__pycache__/settings.cpython-36.pyc
Binary file not shown.
Binary file modified API/__pycache__/settings.cpython-38.pyc
Binary file not shown.
Binary file modified API/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file modified API/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified API/__pycache__/wsgi.cpython-36.pyc
Binary file not shown.
Binary file modified API/__pycache__/wsgi.cpython-38.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions API/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
path('', include('coronawatch.urls')),
path('', include('report.urls')),
path('', include('article.urls')),
path('',include('customauth.urls')),
path('api/token/obtain', MyTokenObtainPairView.as_view(), name='token_create'),
path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
path('api/token/verify/', TokenVerifyView.as_view(), name='token_verify'),
Expand Down
Binary file modified article/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified article/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified article/__pycache__/admin.cpython-36.pyc
Binary file not shown.
Binary file modified article/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file modified article/__pycache__/models.cpython-36.pyc
Binary file not shown.
Binary file modified article/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file modified article/__pycache__/serializers.cpython-36.pyc
Binary file not shown.
Binary file modified article/__pycache__/serializers.cpython-38.pyc
Binary file not shown.
Binary file modified article/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file modified article/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified article/__pycache__/views.cpython-36.pyc
Binary file not shown.
Binary file modified article/__pycache__/views.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file modified article/migrations/__pycache__/0001_initial.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file modified article/migrations/__pycache__/0002_article_url.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file modified article/migrations/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified coronawatch/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified coronawatch/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified coronawatch/__pycache__/admin.cpython-36.pyc
Binary file not shown.
Binary file modified coronawatch/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file modified coronawatch/__pycache__/models.cpython-36.pyc
Binary file not shown.
Binary file modified coronawatch/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file modified coronawatch/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file modified coronawatch/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file modified coronawatch/migrations/__pycache__/0001_initial.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file modified coronawatch/migrations/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified customauth/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified customauth/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified customauth/__pycache__/admin.cpython-36.pyc
Binary file not shown.
Binary file modified customauth/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file modified customauth/__pycache__/models.cpython-36.pyc
Binary file not shown.
Binary file modified customauth/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file modified customauth/__pycache__/serializers.cpython-36.pyc
Binary file not shown.
Binary file modified customauth/__pycache__/serializers.cpython-38.pyc
Binary file not shown.
Binary file modified customauth/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified customauth/__pycache__/views.cpython-36.pyc
Binary file not shown.
Binary file modified customauth/__pycache__/views.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file modified customauth/migrations/__pycache__/0001_initial.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file modified customauth/migrations/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
11 changes: 8 additions & 3 deletions customauth/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ class MyTokenObtainPairSerializer(TokenObtainPairSerializer):
@classmethod
def get_token(cls, user):
token = super().get_token(user)

# Add custom claims
token['role'] = user.role
# ...
token['userId'] = user.pk
token['email'] = user.email

return token

Expand All @@ -32,4 +32,9 @@ def create(self, validated_data):
if password is not None:
instance.set_password(password)
instance.save()
return instance
return instance

class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = '__all__'
1 change: 1 addition & 0 deletions customauth/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


router = routers.DefaultRouter()
router.register('api/user', UserViewSet, 'user')
"""""
router.register('api/token/obtain', MyTokenObtainPairView, 'token_create')
router.register('api/token/refresh/', TokenRefreshView, 'token_refresh')
Expand Down
14 changes: 12 additions & 2 deletions customauth/views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from django.shortcuts import render
from .serializers import MyTokenObtainPairSerializer, UserCreateSerializer
from .serializers import MyTokenObtainPairSerializer, UserCreateSerializer, UserSerializer
from rest_framework.views import APIView
from rest_framework import status, permissions
from rest_framework import status, permissions, viewsets
from rest_framework.response import Response
from rest_framework_simplejwt.views import TokenObtainPairView
from .models import User

# Create your views here.

class MyTokenObtainPairView(TokenObtainPairView):
Expand All @@ -21,3 +23,11 @@ def post(self, request):
json = serializer.data
return Response(json, status=status.HTTP_201_CREATED)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)


class UserViewSet(viewsets.ModelViewSet):
queryset = User.objects.all()
permission_classes = [
permissions.AllowAny
]
serializer_class = UserSerializer
Binary file added media/DSC_0384.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/Event_org_chart_example_-_Page_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/bilan2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/bilan2_UYcGWDN.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/coronavirusarticleimage.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/coronavirusarticleimage_WqJTmGW.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/coronavirusarticleimage_aJPx2nP.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/coronavirusarticleimage_ks293lr.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/coronavirusarticleimage_pgIvn7M.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/oms.jfif
Binary file not shown.
Binary file added media/oms.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/oms_dTb8VuD.jfif
Binary file not shown.
Binary file added media/oms_m7Re6OI.jfif
Binary file not shown.
Binary file added report/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified report/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added report/__pycache__/admin.cpython-36.pyc
Binary file not shown.
Binary file modified report/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file added report/__pycache__/models.cpython-36.pyc
Binary file not shown.
Binary file modified report/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file added report/__pycache__/serializers.cpython-36.pyc
Binary file not shown.
Binary file modified report/__pycache__/serializers.cpython-38.pyc
Binary file not shown.
Binary file added report/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file modified report/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file added report/__pycache__/views.cpython-36.pyc
Binary file not shown.
Binary file modified report/__pycache__/views.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file modified report/migrations/__pycache__/0001_initial.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file modified report/migrations/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions report/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
router = routers.DefaultRouter()
router.register('api/region', RegionViewSet, 'region')
router.register('api/casSignaler', CasSignaleeViewSet, 'casSignaler')

urlpatterns = router.urls
Binary file added sendMail/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified sendMail/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added sendMail/__pycache__/admin.cpython-36.pyc
Binary file not shown.
Binary file modified sendMail/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file added sendMail/__pycache__/models.cpython-36.pyc
Binary file not shown.
Binary file modified sendMail/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file added sendMail/__pycache__/views.cpython-36.pyc
Binary file not shown.
Binary file modified sendMail/__pycache__/views.cpython-38.pyc
Binary file not shown.
20 changes: 10 additions & 10 deletions static/rest_framework/docs/js/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function formEntries (form) {

$(function () {
var $selectedAuthentication = $('#selected-authentication')
var $authControl = $('#customauth-control')
var $authControl = $('#auth-control')
var $authTokenModal = $('#auth_token_modal')
var $authBasicModal = $('#auth_basic_modal')
var $authSessionModal = $('#auth_session_modal')
Expand Down Expand Up @@ -265,12 +265,12 @@ $(function () {
})

// Authentication: none
$authControl.find("[data-customauth='none']").click(function (event) {
$authControl.find("[data-auth='none']").click(function (event) {
event.preventDefault()
window.auth = null
$selectedAuthentication.text('none')
$authControl.find("[data-customauth]").closest('li').removeClass('active')
$authControl.find("[data-customauth='none']").closest('li').addClass('active')
$authControl.find("[data-auth]").closest('li').removeClass('active')
$authControl.find("[data-auth='none']").closest('li').addClass('active')
})

// Authentication: token
Expand All @@ -285,8 +285,8 @@ $(function () {
'token': token
}
$selectedAuthentication.text('token')
$authControl.find("[data-customauth]").closest('li').removeClass('active')
$authControl.find("[data-customauth='token']").closest('li').addClass('active')
$authControl.find("[data-auth]").closest('li').removeClass('active')
$authControl.find("[data-auth='token']").closest('li').addClass('active')
$authTokenModal.modal('hide')
})

Expand All @@ -302,8 +302,8 @@ $(function () {
'password': password
}
$selectedAuthentication.text('basic')
$authControl.find("[data-customauth]").closest('li').removeClass('active')
$authControl.find("[data-customauth='basic']").closest('li').addClass('active')
$authControl.find("[data-auth]").closest('li').removeClass('active')
$authControl.find("[data-auth='basic']").closest('li').addClass('active')
$authBasicModal.modal('hide')
})

Expand All @@ -314,8 +314,8 @@ $(function () {
'type': 'session'
}
$selectedAuthentication.text('session')
$authControl.find("[data-customauth]").closest('li').removeClass('active')
$authControl.find("[data-customauth='session']").closest('li').addClass('active')
$authControl.find("[data-auth]").closest('li').removeClass('active')
$authControl.find("[data-auth='session']").closest('li').addClass('active')
$authSessionModal.modal('hide')
})
})
4 changes: 2 additions & 2 deletions static/rest_framework/js/coreapi-0.1.1.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a900202

Please sign in to comment.