Repository: fedora-infra/bodhi

Issue:
Delete bodhi.server.views.admin
Bodhi has a strange view that tells admin users what their username and principals are, but does not allow non-admin users to use it:

https://github.com/fedora-infra/bodhi/blob/3.0.0/bodhi/server/views/admin.py

When I visit https://bodhi.fedoraproject.org/admin/ I see:

```
{"principals": ["system.Everyone", "system.Authenticated", "bowlofeggs", "group:packager", "group:infra-sig", "group:bodhiadmin"], "user": "bowlofeggs"}
```

I don't know what the purpose of this view was, but I'm pretty sure we can delete it.


Discussion:

Resolving patch:
diff --git a/bodhi/server/views/admin.py b/bodhi/server/views/admin.py
deleted file mode 100644
--- a/bodhi/server/views/admin.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright © 2014-2017 Red Hat, Inc. and others
-#
-# This file is part of Bodhi.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-"""Define the admin view."""
-
-from cornice import Service
-
-from bodhi.server import log
-from bodhi.server import security
-
-
-admin_service = Service(name='admin', path='/admin/',
-                        description='Administrator view',
-                        factory=security.AdminACLFactory)
-
-
-@admin_service.get(permission='admin')
-def admin(request):
-    """
-    Return a dictionary with keys "user" and "principals".
-
-    "user" indexes the current user's name, and "principals" indexes the user's effective
-    principals.
-
-    Args:
-        request (pyramid.request): The current request.
-    Returns:
-        dict: A dictionary as described above.
-    """
-    user = request.user
-    log.info('%s logged into admin panel' % user.name)
-    principals = request.effective_principals
-    return {'user': user.name, 'principals': principals}


Test patch:
diff --git a/bodhi/tests/server/functional/test_admin.py b/bodhi/tests/server/functional/test_admin.py
deleted file mode 100644
--- a/bodhi/tests/server/functional/test_admin.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright 2018 Red Hat, Inc.
-#
-# This file is part of Bodhi.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-import copy
-
-import webtest
-
-from bodhi.server import main
-from bodhi.tests.server import base
-
-
-class TestAdminView(base.BaseTestCase):
-
-    def test_admin(self):
-        """Test that authticated user can see the Admin panel"""
-        res = self.app.get('/admin/')
-        body = res.json_body
-        self.assertEqual(body['principals'][0], 'system.Everyone')
-        self.assertEqual(body['principals'][1], 'system.Authenticated')
-        self.assertEqual(body['principals'][2], 'guest')
-        self.assertEqual(body['user'], 'guest')
-
-    def test_admin_unauthed(self):
-        """Test that an unauthed user cannot see the admin endpoint"""
-        anonymous_settings = copy.copy(self.app_settings)
-        anonymous_settings.update({
-            'authtkt.secret': 'whatever',
-            'authtkt.secure': True,
-        })
-        app = webtest.TestApp(main({}, session=self.db, **anonymous_settings))
-        res = app.get('/admin/', status=403)
-        self.assertIn('<h1>403 <small>Forbidden</small></h1>', res)
-        self.assertIn('<p class="lead">Access was denied to this resource.</p>', res)