Skip to content
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

BUGFIX: Added authorization check for MongoEngineListResource. #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
except ImportError:
pass

VERSION = '0.4.6'
VERSION = '0.4.7'

if __name__ == '__main__':
setup(
9 changes: 9 additions & 0 deletions tastypie_mongoengine/resources.py
Original file line number Diff line number Diff line change
@@ -853,6 +853,9 @@ def add_index(index, obj):
return ListQuerySet([(unicode(index), add_index(index, obj)) for index, obj in enumerate(getattr(self.instance, self.attribute))])

def obj_create(self, bundle, **kwargs):

self.authorized_create_detail(self.get_object_list(bundle.request), bundle)

try:
bundle.obj = self._meta.object_class()

@@ -892,6 +895,9 @@ def find_embedded_document(self, objects, pk_field, pk):

# TODO: Use skip_errors?
def obj_update(self, bundle, skip_errors=False, **kwargs):

self.authorized_update_detail(self.get_object_list(bundle.request), bundle)

try:
if not bundle.obj or not getattr(bundle.obj, 'pk', None):
try:
@@ -920,6 +926,9 @@ def obj_update(self, bundle, skip_errors=False, **kwargs):
raise exceptions.ValidationError(ex.message)

def obj_delete(self, bundle, **kwargs):

self.authorized_delete_detail(self.get_object_list(bundle.request), bundle)

obj = kwargs.pop('_obj', None)

if not getattr(obj, 'pk', None):