'Verifies that the given (uid, password) is authorized for the database ``db`` and
raise an exception if it is not.'

@classmethod
def check(cls, db, uid, passwd):

    if (not passwd):
        raise AccessDenied()
    db = cls.pool.db_name
    if (cls.__uid_cache[db].get(uid) == passwd):
        return
    cr = cls.pool.cursor()
    try:
        self = api.Environment(cr, uid, {})[cls._name]
        self.check_credentials(passwd)
        cls.__uid_cache[db][uid] = passwd
    finally:
        cr.close()
