Browse Source

Troubleshooting 403 errors with RetrieveUpdateDestroyAPIView that only happen on OpenShift #5

pull/170/head
Michael Olund 5 years ago
parent
commit
357beee3ca
3 changed files with 7 additions and 14 deletions
  1. +3
    -2
      edivorce/apps/core/urls.py
  2. +0
    -10
      edivorce/apps/core/views/api.py
  3. +4
    -2
      vue/src/components/Uploader/Uploader.vue

+ 3
- 2
edivorce/apps/core/urls.py View File

@ -7,10 +7,11 @@ urlpatterns = [
# url(r'^guide$', styleguide.guide),
url(r'^api/response$', api.UserResponseHandler.as_view()),
url(r'^api/documents/$', api.DocumentCreateView.as_view(), name='documents'),
# path('api/documents/<doc_type>/<int:party_code>/', api.DocumentMetaDataView.as_view(), name='documents-meta'),
path('api/documents/<doc_type>/<int:party_code>/<filename>x/<int:size>/', api.DocumentView.as_view(), name='document'),
path('api/documents/<file_key>/', api.get_document_file_by_key, name='document_by_key'),
# we add an extra 'x' to the file extension so the siteminder proxy doesn't treat it as an image
path('api/documents/<doc_type>/<int:party_code>/<filename>x/<int:size>/', api.DocumentView.as_view(), name='document'),
# url(r'^login/headers$', system.headers),
url(r'^login$', main.login, name="login"),


+ 0
- 10
edivorce/apps/core/views/api.py View File

@ -60,16 +60,6 @@ class DocumentCreateView(CreateAPIView):
queryset = Document.objects.all()
#class DocumentMetaDataView(ListAPIView):
# serializer_class = DocumentMetadataSerializer
# permission_classes = [permissions.IsAuthenticated]
#
# def get_queryset(self):
# doc_type = self.kwargs['doc_type']
# party_code = self.kwargs['party_code']
# return Document.objects.filter(doc_type=doc_type, party_code=party_code, bceid_user=self.request.user).order_by('sort_order')
class DocumentView(RetrieveUpdateDestroyAPIView):
serializer_class = DocumentMetadataSerializer
permission_classes = [permissions.IsAuthenticated]


+ 4
- 2
vue/src/components/Uploader/Uploader.vue View File

@ -262,7 +262,8 @@ export default {
remove(file) {
const urlbase = `${this.$parent.proxyRootPath}api/documents`;
const encFilename = encodeURIComponent(file.name);
const url = `${urlbase}/${this.docType}/${this.party}/${file.size}/${encFilename}`;
// we add an extra 'x' to the file extension so the siteminder proxy doesn't treat it as an image
const url = `${urlbase}/${this.docType}/${this.party}/${encFilename}x/${file.size}/`;
axios.delete(url)
.then(response => {
var pos = this.files.findIndex(f => f.docType === file.docType && f.size === file.size);
@ -371,7 +372,8 @@ export default {
error: false,
success: true,
progress: '100.00',
objectURL: `${this.$parent.proxyRootPath}api/documents/${this.docType}/${this.party}/${doc.size}/${doc.filename}`
// we add an extra 'x' to the file extension so the siteminder proxy doesn't treat it as an image
objectURL: `${this.$parent.proxyRootPath}api/documents/${this.docType}/${this.party}/${doc.filename}x/${doc.size}/`
});
});
})


Loading…
Cancel
Save