-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: speakers can't be edited after the cfs ends
- Loading branch information
Travis CI
committed
Jan 20, 2020
1 parent
ceb867e
commit 110d5d1
Showing
4 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from app.models.speakers_call import SpeakersCall | ||
from app.api.helpers.permission_manager import has_access | ||
from datetime import datetime | ||
from app.api.helpers.exceptions import ForbiddenException | ||
|
||
|
||
def can_edit_after_cfs_ends(event_id): | ||
""" | ||
Method to check that user has permission to edit the speaker or session | ||
after the CFS ends | ||
""" | ||
speakers_call = SpeakersCall.query.filter_by(event_id=event_id).one() | ||
if speakers_call: | ||
speakers_call_tz = speakers_call.ends_at.tzinfo | ||
if 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)): | ||
return False | ||
else: | ||
return True | ||
else: | ||
raise ForbiddenException({'source': '/data/event-id'}, | ||
'Speaker Calls for event {id} not found'.format(id=event_id)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters