ui_auth.py 1.86 KB
Newer Older
LE GAC Renaud's avatar
LE GAC Renaud committed
1 2 3 4 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 64 65 66 67 68 69 70 71 72
# -*- coding: utf-8 -*-
"""User Interface for the authentication tables

"""
from plugin_dbui import GridModifier


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

        """
        # ....................................................................
        #
        # Grid
        #
        mdf = GridModifier("auth_user")
        mdf.configure_column("first_name", width=30)
        mdf.configure_column("last_name", width=30)
        mdf.hide_columns("password")