Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #99 from vubo/vol_access
Browse files Browse the repository at this point in the history
Fix a bug: volunteer shifts access
  • Loading branch information
tapaswenipathak committed Jul 27, 2015
2 parents 0492bc4 + 3d1c5c5 commit c0b26ab
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions vms/shift/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,23 +573,35 @@ def view_hours(request, volunteer_id):

@login_required
def view_volunteer_shifts(request, volunteer_id):
if volunteer_id:
volunteer = get_volunteer_by_id(volunteer_id)
if volunteer:
user = request.user
if int(user.volunteer.id) == int(volunteer_id):
shift_list = get_unlogged_shifts_by_volunteer_id(volunteer_id)
return render(
request,
'shift/volunteer_shifts.html',
{'shift_list': shift_list, 'volunteer_id': volunteer_id, }
)
user = request.user
vol = None

try:
vol = user.volunteer
except ObjectDoesNotExist:
pass

# check that a volunteer is logged in
if vol:
if volunteer_id:
volunteer = get_volunteer_by_id(volunteer_id)
if volunteer:
user = request.user
if int(user.volunteer.id) == int(volunteer_id):
shift_list = get_unlogged_shifts_by_volunteer_id(volunteer_id)
return render(
request,
'shift/volunteer_shifts.html',
{'shift_list': shift_list, 'volunteer_id': volunteer_id, }
)
else:
return HttpResponse(status=403)
else:
return HttpResponse(status=403)
raise Http404
else:
raise Http404
else:
raise Http404
return HttpResponse(status=403)


@login_required
Expand Down

0 comments on commit c0b26ab

Please sign in to comment.