ctreffe / alfred

Alfred - A library for rapid experiment development
MIT License
10 stars 1 forks source link

Rework Admin Mode #115

Closed jobrachem closed 2 years ago

jobrachem commented 3 years ago

We plan a more general implementation for an admin interface that revolves around a special section. This section can be accessed via url parameter ?admin=true, if the user has set an admin password in secrets.conf. If not, the experiment displays a helpful error message.

The first page is always a password page. After the password page, the user can access all admin pages that have been added in script.py.

For future progress, the admin section may include a jumplist on every page and my prevent the rest of the experiment from being needlessly rendered.

def setup(exp):
    exp.adminsection += MatchMakerAdmin()
        - MatchMakerAdmin adds admin view for all matchmakers 
            (but we probably need only one anyway)

class ExperimentSession():

    - admin mode is enabled by specifying a password in secrets.conf
    - admin mode is accessed through url param
    - if url param is used, but no admin pw has been set in secrets.conf,
        the experiment aborts (and shows an abortion page)

    def __init__(self, ...):
        if self.admin_mode:
            self._root_section = AdminSection()

            - Exp does not save data in admin mode

AdminSection()
    - Has a password page
    - Has a JumpList on every Page, much like the debug jumplist
    - In fact, I may just use the debug jumplist