Return code 403 when accessing admin pages
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Thu, 15 Nov 2012 14:41:06 +0000 (15:41 +0100)
committerSebastian Spaeth <Sebastian@SSpaeth.de>
Thu, 29 Nov 2012 08:10:43 +0000 (09:10 +0100)
without being an admin. Previously we were just returning a 404 page
and this confused the heck out of me, as I did not understand why the
admin pages were not there at all (I was no admin).

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
mediagoblin/admin/views.py

index e6a3eac3c60cbde361a5242fc057f54323f51166..9c14c55c313989b27a9dc67d3dd3cfceec66baab 100644 (file)
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from mediagoblin.tools.response import render_to_response, render_404
 from mediagoblin.db.util import DESCENDING
 from mediagoblin.decorators import require_active_login
-
+from mediagoblin.tools.response import (render_to_response, render_403,
+                                        render_404)
 
 @require_active_login
 def admin_processing_panel(request):
     '''
     Show the global processing panel for this instance
     '''
+    # TODO: Why not a "require_admin_login" decorator throwing a 403 exception?
     if not request.user.is_admin:
-        return render_404(request)
+        return render_403(request)
 
     processing_entries = request.db.MediaEntry.find(
         {'state': u'processing'}).sort('created', DESCENDING)