~homeworkprod/byceps

96a437f0b81a3c31299ede015be4c5d3098d4b4f — Jochen Kupperschmidt 9 months ago dde3ef3
Move current user blueprint from `common` to `site` package

Remove special admin-only cases along the way.

This makes this endpoint unavailable on the admin backend. However,
normal users, for which this cookie header-based endpoint is meant,
shouldn't be logged in to the admin backend anyway.
6 files changed, 3 insertions(+), 6 deletions(-)

M byceps/blueprints/blueprints.py
R byceps/blueprints/{common/user/current/__init__.py => site/user/__init__.py}
A byceps/blueprints/site/user/current/__init__.py
R byceps/blueprints/{common/user/current/views.py => site/user/current/views.py}
A tests/integration/blueprints/site/user/__init__.py
R tests/integration/blueprints/{common/user/test_views_current_user_json.py => site/user/test_views_current_user_json.py}
M byceps/blueprints/blueprints.py => byceps/blueprints/blueprints.py +1 -1
@@ 49,7 49,6 @@ def _get_blueprints_common() -> Iterator[BlueprintReg]:
        ('common.user',                     None                        ),
        ('common.user.avatar',              '/users'                    ),
        ('common.user.creation',            '/users'                    ),
        ('common.user.current',             '/users'                    ),
        ('common.user.email_address',       '/users/email_address'      ),
        ('common.user.settings',            '/users/me/settings'        ),
    ]


@@ 72,6 71,7 @@ def _get_blueprints_site() -> Iterator[BlueprintReg]:
        ('site.terms',                      '/terms'                    ),
        ('site.ticketing',                  '/tickets'                  ),
        ('site.tourney',                    '/tourneys'                 ),
        ('site.user.current',               '/users'                    ),
        ('site.user_profile',               '/users'                    ),
        ('site.user_badge',                 '/user_badges'              ),
        ('site.user_group',                 '/user_groups'              ),

R byceps/blueprints/common/user/current/__init__.py => byceps/blueprints/site/user/__init__.py +0 -0
A byceps/blueprints/site/user/current/__init__.py => byceps/blueprints/site/user/current/__init__.py +0 -0
R byceps/blueprints/common/user/current/views.py => byceps/blueprints/site/user/current/views.py +2 -5
@@ 1,6 1,6 @@
"""
byceps.blueprints.common.user.current.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.site.user.current.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)


@@ 18,9 18,6 @@ blueprint = create_blueprint('user_current', __name__)
@blueprint.route('/me.json')
def view_as_json():
    """Show selected attributes of the current user's profile as JSON."""
    if get_app_mode().is_admin():
        abort(404)

    user = g.current_user

    if not user.is_active:

A tests/integration/blueprints/site/user/__init__.py => tests/integration/blueprints/site/user/__init__.py +0 -0
R tests/integration/blueprints/common/user/test_views_current_user_json.py => tests/integration/blueprints/site/user/test_views_current_user_json.py +0 -0