Change codebase to query or create correct User model
[mediagoblin.git] / mediagoblin / edit / lib.py
index b722e9c111b6f54c6c4c47f9208ec79894db84d1..6acebc96f31fb1b414c32c46a6dc14ad495fdd24 100644 (file)
@@ -1,5 +1,5 @@
 # GNU MediaGoblin -- federated, autonomous media hosting
-# Copyright (C) 2011 MediaGoblin contributors.  See AUTHORS.
+# Copyright (C) 2011, 2012 MediaGoblin contributors.  See AUTHORS.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as published by
@@ -17,8 +17,8 @@
 
 def may_edit_media(request, media):
     """Check, if the request's user may edit the media details"""
-    if media['uploader'] == request.user['_id']:
+    if media.uploader == request.user.id:
         return True
-    if request.user['is_admin']:
+    if request.user.has_privilege(u'admin'):
         return True
     return False