mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 10:12:04 +02:00
19.0 vanilla
This commit is contained in:
parent
d1963a3c3a
commit
2d3ee4855a
7430 changed files with 2687981 additions and 2965473 deletions
|
|
@ -69,7 +69,7 @@ class Obfuscate(Command):
|
|||
return SQL("""CASE WHEN starts_with(%(field_name)s, 'odoo_cyph_') THEN pgp_sym_decrypt(decode(substring(%(field_name)s, 11)::text, 'base64'), %(pwd)s) ELSE %(field_name)s END""", field_name=sql_field, pwd=password)
|
||||
|
||||
def check_field(self, table, field):
|
||||
qry = "SELECT udt_name FROM information_schema.columns WHERE table_name=%s AND column_name=%s"
|
||||
qry = "SELECT udt_name FROM information_schema.columns WHERE table_name=%s AND column_name=%s AND table_schema = current_schema"
|
||||
self.cr.execute(qry, [table, field])
|
||||
if self.cr.rowcount == 1:
|
||||
res = self.cr.fetchone()
|
||||
|
|
@ -81,7 +81,10 @@ class Obfuscate(Command):
|
|||
return False
|
||||
|
||||
def get_all_fields(self):
|
||||
qry = "SELECT table_name, column_name FROM information_schema.columns WHERE table_schema='public' AND udt_name IN ['text', 'varchar', 'jsonb'] AND NOT table_name LIKE 'ir_%' ORDER BY 1,2"
|
||||
qry = (
|
||||
"SELECT table_name, column_name FROM information_schema.columns"
|
||||
" WHERE table_schema = current_schema AND udt_name IN ('text', 'varchar', 'jsonb') AND NOT table_name LIKE 'ir_%' ORDER BY 1,2"
|
||||
)
|
||||
self.cr.execute(qry)
|
||||
return self.cr.fetchall()
|
||||
|
||||
|
|
@ -158,7 +161,13 @@ class Obfuscate(Command):
|
|||
if opt.allfields and not opt.unobfuscate:
|
||||
_logger.error("--allfields can only be used in unobfuscate mode")
|
||||
sys.exit("ERROR: --allfields can only be used in unobfuscate mode")
|
||||
self.dbname = config['db_name']
|
||||
if not opt.db_name:
|
||||
_logger.error('Obfuscate command needs a database name. Use "-d" argument')
|
||||
sys.exit('ERROR: Obfuscate command needs a database name. Use "-d" argument')
|
||||
if len(opt.db_name) > 1:
|
||||
_logger.error("-d/--database has multiple databases, please provide a single one")
|
||||
sys.exit("ERROR: -d/--database has multiple databases, please provide a single one")
|
||||
self.dbname = config['db_name'][0]
|
||||
self.registry = Registry(self.dbname)
|
||||
with self.registry.cursor() as cr:
|
||||
self.cr = cr
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue