-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: Check user permission before exporting #6581
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
Merged
iamareebjamal
merged 10 commits into
fossasia:development
from
prateekj117:event-export-permissions
Nov 27, 2019
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3dccf6a
Check proper permissions before exporting an event
prateekj117 56d0c94
Correct CI errors
prateekj117 ae10e8a
Simplify logic
prateekj117 9d3a0f7
Merge branch 'development' into event-export-permissions
prateekj117 9c7112e
Add a separate decorator for getting event id.
prateekj117 5f3ab66
Required changes.
prateekj117 dc326f9
Required changes.
prateekj117 81c6553
Required changes
prateekj117 b7b0676
Required changes.
prateekj117 ba24a32
Required changes
prateekj117 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -147,16 +147,15 @@ def decorated_function(*args, **kwargs): | |
|
|
||
|
|
||
| @second_order_decorator(jwt_required) | ||
| def is_coorganizer(f): | ||
| def get_event_id(f): | ||
prateekj117 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| """ | ||
| Allows Organizer and Co-organizer to access the event resources. | ||
| Get event id from event identifier. | ||
prateekj117 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| :param f: | ||
| :return: | ||
| """ | ||
|
|
||
| @wraps(f) | ||
|
||
| def decorated_function(*args, **kwargs): | ||
| user = current_user | ||
|
|
||
| if 'event_identifier' in kwargs: | ||
| if not kwargs['event_identifier'].isdigit(): | ||
|
|
@@ -165,6 +164,24 @@ def decorated_function(*args, **kwargs): | |
| else: | ||
| kwargs['event_id'] = kwargs['event_identifier'] | ||
|
|
||
| return f(*args, **kwargs) | ||
|
||
|
|
||
| return decorated_function | ||
|
|
||
|
|
||
|
|
||
| @second_order_decorator(jwt_required) | ||
| def is_coorganizer(f): | ||
| """ | ||
| Allows Organizer and Co-organizer to access the event resources. | ||
| :param f: | ||
| :return: | ||
| """ | ||
|
|
||
| @wraps(f) | ||
| def decorated_function(*args, **kwargs): | ||
| user = current_user | ||
|
|
||
| if user.is_staff or ('event_id' in kwargs and user.has_event_access(kwargs['event_id'])): | ||
| if 'event_identifier' in kwargs: | ||
| kwargs.pop('event_id', None) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this should be event_id and conversion in each function should be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will edit the logic accordingly.