Skip to content

Commit

Permalink
other users without create/end permission can only join and see the list
Browse files Browse the repository at this point in the history
  • Loading branch information
fuji246 committed Dec 3, 2012
1 parent 91cb2dc commit a6f90a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions bbb_django/bbb/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ class Meeting(models.Model):
class Meta:
verbose_name = _('meeting')
verbose_name_plural = _('meetings')
permissions = (
('create_meeting', 'Can create meeting'),
('end_meetnig', 'Can end meeting'),
)

@classmethod
def api_call(self, query, call):
Expand Down
9 changes: 6 additions & 3 deletions bbb_django/bbb/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def calendar(request, year, month):
m = int(month)
from_date = date(y, m, 1)
to_date = date(y, m, monthrange(y,m)[1])
meetings = Meeting.objects.filter(user=request.user).filter(start_time__gte=from_date, start_time__lte=to_date)
#meetings = Meeting.objects.filter(user=request.user).filter(start_time__gte=from_date, start_time__lte=to_date)
meetings = Meeting.objects.filter(start_time__gte=from_date, start_time__lte=to_date)
prev_year = y
prev_month = m - 1
if prev_month == 0:
Expand Down Expand Up @@ -108,8 +109,8 @@ def begin_meeting(request):
@login_required
def meetings(request):

#meetings = Meeting.objects.all()
existing = Meeting.objects.filter(user=request.user)
existing = Meeting.objects.all()
#existing = Meeting.objects.filter(user=request.user)
#meetings = Meeting.get_meetings()
started = Meeting.get_meetings()

Expand Down Expand Up @@ -175,6 +176,7 @@ def join_meeting(request, meeting_id):
return render_to_response('join.html', context)

@login_required
@permission_required('bbb.end_meeting')
def delete_meeting(request, meeting_id, password):
if request.method == "POST":
meeting = Meeting.objects.filter(id=meeting_id)
Expand All @@ -190,6 +192,7 @@ def delete_meeting(request, meeting_id, password):
return HttpResponseRedirect(reverse('meetings'))

@login_required
@permission_required('bbb.create_meeting')
def create_meeting(request):
form_class = Meeting.CreateForm

Expand Down

0 comments on commit a6f90a7

Please sign in to comment.