-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JARS-146] Resource should be accessible even if there is no title #147
base: develop
Are you sure you want to change the base?
Conversation
prnvshrn
commented
Dec 7, 2018
- I have added the functionality of deleting the resources which do not have a title / are not properly uploaded.
- A delete button appears besides such entries to perform the operation
cookies/templates/resources.html
Outdated
|
||
<script> | ||
jQuery(document).ready(function($) { | ||
$(".opendeleteResourceModal").click(function(e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proper camelcase
cookies/templates/resources.html
Outdated
<h4 class="modal-title">Delete entry</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<p>Do you want to delete this invalid entry ? </p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no blank before '?'
|
||
|
||
@login_required | ||
def delete_resource(request, resource_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
permission check is needed
def delete_resource(request, resource_id): | ||
# Extra check to ensure that only resources which do not have primary id get deleted. | ||
resource_container = ResourceContainer.objects.get(pk=resource_id) | ||
if resource_container.primary_id is None and request.user.id == resource_container.created_by_id: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to check with the permissions here. other people can have access to a resource and can delete them.