ui_auth.py 2.04 KB
Newer Older
LE GAC Renaud's avatar
LE GAC Renaud committed
1 2 3
"""User Interface for the authentication tables

"""
4
from plugin_dbui import FormModifier, GridModifier
LE GAC Renaud's avatar
LE GAC Renaud committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63


class AuthUI(object):

    @staticmethod
    def configure(db, T):
        """Configure the user interface for the history table and
        its foreign tables,

        Args:
            db (pyDAL.DAL): database connection
            T (gluon.languages.translator): language translator

        """
        AuthUI.auth_group(db, T)
        AuthUI.auth_membership(db, T)
        AuthUI.auth_user(db, T)

    @staticmethod
    def auth_group(db, T):
        """UI for the auth table

        Args:
            db (pyDAL.DAL): database connection
            T (gluon.languages.translator): language translator

        """
        # ....................................................................
        #
        # Grid
        #
        mdf = GridModifier("auth_group")
        mdf.configure_column("role", width=15)

    @staticmethod
    def auth_membership(db, T):
        """UI for the auth_membership table

        Args:
            db (pyDAL.DAL): database connection
            T (gluon.languages.translator): language translator

        """
        # ....................................................................
        #
        # Grid
        #
        mdf = GridModifier("auth_membership")
        mdf.configure_column("user_id", width=20)

    @staticmethod
    def auth_user(db, T):
        """UI for the auth_user table

        Args:
            db (pyDAL.DAL): database connection
            T (gluon.languages.translator): language translator

        """
64 65 66 67 68 69 70
        # ....................................................................
        #
        # Form
        #
        mdf = FormModifier("auth_user")
        mdf.hide_fields("password")

LE GAC Renaud's avatar
LE GAC Renaud committed
71 72 73 74 75 76 77 78
        # ....................................................................
        #
        # Grid
        #
        mdf = GridModifier("auth_user")
        mdf.configure_column("first_name", width=30)
        mdf.configure_column("last_name", width=30)
        mdf.hide_columns("password")