Skip to content
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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

prnvshrn
Copy link
Collaborator

@prnvshrn 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

@prnvshrn prnvshrn requested review from jdamerow and tjquinn1 December 7, 2018 22:51

<script>
jQuery(document).ready(function($) {
$(".opendeleteResourceModal").click(function(e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proper camelcase

<h4 class="modal-title">Delete entry</h4>
</div>
<div class="modal-body">
<p>Do you want to delete this invalid entry ? </p>
Copy link
Member

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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

permission check is needed

@jdamerow jdamerow closed this Dec 11, 2018
@prnvshrn prnvshrn reopened this Dec 11, 2018
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:
Copy link
Member

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.

@jdamerow jdamerow closed this Dec 11, 2018
@prnvshrn prnvshrn reopened this Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants