예제 #1
0
    def grantPermissions(self, dbname, username):
        host = self.okHost(username) or "%.sabren.com"

        sql =\
            """
            GRANT SELECT, INSERT, UPDATE, DELETE,
                  CREATE, CREATE TEMPORARY TABLES,
                  DROP, INDEX, ALTER, LOCK TABLES
            ON %s.*
            TO %s@'%s'
            """ % (self.sanitize(dbname),
                   self.sanitize(username), self.sanitize(host))

        if host:
            password = '******'
        else:
            password = handy.randpass()
            sql += "IDENTIFIED BY '%s'" % password

        self.execute(sql)

        # and this is so the db table ONLY has '%' in it
        self.execute("update db set host='%'")
        return password
예제 #2
0
    def grantPermissions(self, dbname, username):
        host = self.okHost(username) or "%.sabren.com"
        
        sql =\
            """
            GRANT SELECT, INSERT, UPDATE, DELETE,
                  CREATE, CREATE TEMPORARY TABLES,
                  DROP, INDEX, ALTER, LOCK TABLES
            ON %s.*
            TO %s@'%s'
            """ % (self.sanitize(dbname),
                   self.sanitize(username), self.sanitize(host))
        
        if host:
            password = '******'
        else:
            password = handy.randpass()
            sql += "IDENTIFIED BY '%s'" % password

        self.execute(sql)

        # and this is so the db table ONLY has '%' in it
        self.execute("update db set host='%'")
        return password
예제 #3
0
파일: Account.py 프로젝트: sabren/letsbank
 def __init__(self, **args):
     super(Account, self).__init__(**args)
     if not self.password:
         self.password = randpass()