Skip to content

Commit

Permalink
fix: Allow admin/organizer to edit/add sessions
Browse files Browse the repository at this point in the history
even when speaker call is not present
  • Loading branch information
iamareebjamal committed Nov 12, 2020
1 parent 3d70017 commit 71ae20c
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions app/api/helpers/speaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ def can_edit_after_cfs_ends(event_id):
speakers_call = SpeakersCall.query.filter_by(
event_id=event_id, deleted_at=None
).one_or_none()
not_allowed = not (
has_access('is_admin')
or has_access('is_organizer', event_id=event_id)
or has_access('is_coorganizer', event_id=event_id)
)
if speakers_call:
speakers_call_tz = speakers_call.ends_at.tzinfo
return not (
speakers_call.ends_at <= datetime.now().replace(tzinfo=speakers_call_tz)
and not (
has_access('is_admin')
or has_access('is_organizer', event_id=event_id)
or has_access('is_coorganizer', event_id=event_id)
)
and not_allowed
)
raise ForbiddenError(
{'source': '/data/event-id'},
f'Speaker Calls for event {event_id} not found',
)
elif not_allowed:
raise ForbiddenError(
{'source': '/data/event-id'},
f'Speaker Calls for event {event_id} not found',
)
return True

0 comments on commit 71ae20c

Please sign in to comment.