Beispiel #1
0
def ask_to_add_user(session):
    """HTML form to add a user."""
    return pls.WEBSTART + u"""
        {userdetails}
        <h1>Add user</h1>
        <form name="myform" action="{script}" method="POST">
            User name:
            <input type="text" name="{PARAM.USERNAME}" autocomplete="off"><br>

            Password:
            <input type="password" name="{PARAM.PASSWORD_1}"
                    autocomplete="off">
            (minimum length {MINIMUM_PASSWORD_LENGTH} characters)<br>

            Re-enter password:
            <input type="password" name="{PARAM.PASSWORD_2}"
                    autocomplete="off"><br>

            <label>
                <input type="checkbox" name="{PARAM.MUST_CHANGE_PASSWORD}"
                        value="1" {TRUE}>
                {LABEL.MUST_CHANGE_PASSWORD}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.MAY_USE_WEBVIEWER}"
                    value="1" {TRUE}>
                {LABEL.MAY_USE_WEBVIEWER}
            </label><br>
            <label>
                <input type="checkbox"
                    name="{PARAM.MAY_VIEW_OTHER_USERS_RECORDS}"
                    value="1" {TRUE}>
                {LABEL.MAY_VIEW_OTHER_USERS_RECORDS}
            </label><br>
            <label>
                <input type="checkbox"
                    name="{PARAM.VIEW_ALL_PTS_WHEN_UNFILTERED}"
                    value="1" {FALSE}>
                {LABEL.VIEW_ALL_PATIENTS_WHEN_UNFILTERED}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.MAY_UPLOAD}"
                    value="1" {TRUE}>
                {LABEL.MAY_UPLOAD}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.SUPERUSER}"
                    value="1" {FALSE}>
                {LABEL.SUPERUSER}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.MAY_REGISTER_DEVICES}"
                    value="1" {FALSE}>
                {LABEL.MAY_REGISTER_DEVICES}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.MAY_USE_WEBSTORAGE}"
                    value="1" {FALSE}>
                {LABEL.MAY_USE_WEBSTORAGE}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.MAY_DUMP_DATA}"
                    value="1" {FALSE}>
                {LABEL.MAY_DUMP_DATA}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.MAY_RUN_REPORTS}"
                    value="1" {FALSE}>
                {LABEL.MAY_RUN_REPORTS}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.MAY_ADD_NOTES}"
                    value="1" {FALSE}>
                {LABEL.MAY_ADD_NOTES}
            </label><br>
            <input type="hidden" name="{PARAM.ACTION}"
                value="{ACTION.ADD_USER}">
            <input type="submit" value="Submit">
        </form>
    """.format(
        TRUE=ws.checkbox_checked(True),
        FALSE=ws.checkbox_checked(False),
        LABEL=LABEL,
        userdetails=session.get_current_user_html(),
        script=pls.SCRIPT_NAME,
        PARAM=PARAM,
        ACTION=ACTION,
        MINIMUM_PASSWORD_LENGTH=MINIMUM_PASSWORD_LENGTH,
    ) + cc_html.WEBEND
Beispiel #2
0
def edit_user(session, username):
    """HTML form to edit a single user's permissions."""
    user = User(username, False)
    if not user.user:
        return user_management_failure_message("Invalid user: "******"""
        {userdetails}
        <h1>Edit user {username}</h1>
        <form name="myform" action="{script}" method="POST">
            <input type="hidden" name="{PARAM.USERNAME}" value="{username}">
            <label>
                <input type="checkbox" name="{PARAM.MAY_USE_WEBVIEWER}"
                    value="1" {may_use_webviewer}>
                {LABEL.MAY_USE_WEBVIEWER}
            </label><br>
            <label>
                <input type="checkbox"
                    name="{PARAM.MAY_VIEW_OTHER_USERS_RECORDS}"
                    value="1" {may_view_other_users_records}>
                {LABEL.MAY_VIEW_OTHER_USERS_RECORDS}
            </label><br>
            <label>
                <input type="checkbox"
                    name="{PARAM.VIEW_ALL_PTS_WHEN_UNFILTERED}"
                    value="1" {view_all_patients_when_unfiltered}>
                {LABEL.VIEW_ALL_PATIENTS_WHEN_UNFILTERED}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.MAY_UPLOAD}"
                    value="1" {may_upload}>
                {LABEL.MAY_UPLOAD}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.SUPERUSER}"
                    value="1" {superuser}>
                {LABEL.SUPERUSER}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.MAY_REGISTER_DEVICES}"
                    value="1" {may_register_devices}>
                {LABEL.MAY_REGISTER_DEVICES}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.MAY_USE_WEBSTORAGE}"
                    value="1" {may_use_webstorage}>
                {LABEL.MAY_USE_WEBSTORAGE}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.MAY_DUMP_DATA}"
                    value="1" {may_dump_data}>
                {LABEL.MAY_DUMP_DATA}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.MAY_RUN_REPORTS}"
                    value="1" {may_run_reports}>
                {LABEL.MAY_RUN_REPORTS}
            </label><br>
            <label>
                <input type="checkbox" name="{PARAM.MAY_ADD_NOTES}"
                    value="1" {may_add_notes}>
                {LABEL.MAY_ADD_NOTES}
            </label><br>
            <input type="hidden" name="{PARAM.ACTION}"
                value="{ACTION.CHANGE_USER}">
            <input type="submit" value="Submit">
        </form>
    """.format(
        may_use_webviewer=ws.checkbox_checked(user.may_use_webviewer),
        may_view_other_users_records=ws.checkbox_checked(
            user.may_view_other_users_records),
        view_all_patients_when_unfiltered=ws.checkbox_checked(
            user.view_all_patients_when_unfiltered),
        may_upload=ws.checkbox_checked(user.may_upload),
        superuser=ws.checkbox_checked(user.superuser),
        may_register_devices=ws.checkbox_checked(user.may_register_devices),
        may_use_webstorage=ws.checkbox_checked(user.may_use_webstorage),
        may_dump_data=ws.checkbox_checked(user.may_dump_data),
        may_run_reports=ws.checkbox_checked(user.may_run_reports),
        may_add_notes=ws.checkbox_checked(user.may_add_notes),
        userdetails=session.get_current_user_html(),
        script=pls.SCRIPT_NAME,
        username=user.user,
        PARAM=PARAM,
        ACTION=ACTION,
        LABEL=LABEL,
    ) + cc_html.WEBEND