Esempio n. 1
0
    def __init__(self, rights, net_perm, depth, path, vrf, urlpath="0", cfont="#000000", cbg="#FFFFFF"):

        self._cfg_ = ConfigObj("ipall.cfg")
        (self._create_, self._user_admin_, self._company_admin_) = rights
        ### rights of the logged in user(group)
        (self._delete_, self._edit_, self._subnet_, self._view_net_) = net_perm
        ### URL path of a selected network
        self._urlpath_ = urlpath
        ### path of the network, stored in database
        self._path_ = path
        self._vrf_ = str(vrf)
        ### how many parents a subnet has
        self._depth_ = 	depth
        ### the last id in the path -> direct parent id of selected node
        self._selected_ = int(self._urlpath_.split(":")[len(self._urlpath_.split(":"))-1])
        self._font_color_ = cfont
        self._bg_color_ = cbg
        self._sbox_ = self._cfg_['Site']['smoothbox'].replace("?", "&")
        self._cgi_dir_ = self._cfg_['Server']['cgi_dir']
        self._ipall_dir_ = self._cfg_['Server']['ipall_dir']
        self._db_host_ = self._cfg_['Database']['db_host']
        self._db_user_ = self._cfg_['Database']['db_user']
        self._db_pw_ = self._cfg_['Database']['db_pw']
        self._db_ = self._cfg_['Database']['db']
        self._conn_ = DBmy.db(self._db_host_, self._db_user_, self._db_pw_, self._db_)
Esempio n. 2
0
    def __init__(self, username):
        """IpallUser 
        username    ...	    must be unique in database"""

        self._username_ = username
        self._cfg_ = ConfigObj("ipall.cfg")
        self._db_host_ = self._cfg_['Database']['db_host']
        self._db_user_ = self._cfg_['Database']['db_user']
        self._db_pw_ = self._cfg_['Database']['db_pw']
        self._db_ = self._cfg_['Database']['db']
        self._conn_ = DBmy.db(self._db_host_, self._db_user_, self._db_pw_, self._db_)