Skip to content

Commit

Permalink
fix: jans-linux-setup create json index for multivalued attributes (#…
Browse files Browse the repository at this point in the history
…1131)

* fix: jans-linux-setup create json index for multivalued attributes

* fix: jans-linux-setup code smells
  • Loading branch information
devrimyatar committed Mar 30, 2022
1 parent 99046e5 commit be9e63c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions jans-linux-setup/jans_setup/setup_app/installers/rdbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ def create_indexes(self):
sql_indexes_fn = os.path.join(Config.static_rdbm_dir, Config.rdbm_type + '_index.json')
sql_indexes = base.readJsonFile(sql_indexes_fn)

# read opendj indexes and add multivalued attributes to JSON indexing
opendj_index = base.readJsonFile(base.current_app.OpenDjInstaller.openDjIndexJson)
opendj_index_list = [ atribute['attribute'] for atribute in opendj_index ]

for attribute in self.jans_attributes:
if attribute.get('multivalued'):
for attr_name in attribute['names']:
if attr_name in opendj_index_list and attr_name not in sql_indexes['__common__']['fields']:
sql_indexes['__common__']['fields'].append(attr_name)

if Config.rdbm_type == 'spanner':
tables = self.dbUtils.spanner.get_tables()
for tblCls in tables:
Expand All @@ -237,7 +247,7 @@ def create_indexes(self):
data_type = attr['type']

if data_type == 'ARRAY':
#TODO: How to index for ARRAY types in spanner?
# How to index for ARRAY types in spanner?
pass

elif attr_name in tbl_fields:
Expand Down Expand Up @@ -340,7 +350,7 @@ def import_ldif(self):
ldif_files.remove(Config.ldif_site)

Config.pbar.progress(self.service_name, "Importing ldif files to {}".format(Config.rdbm_type), False)
if not Config.ldif_base in ldif_files:
if Config.ldif_base not in ldif_files:
if Config.rdbm_type == 'mysql':
force = BackendTypes.MYSQL
elif Config.rdbm_type == 'pgsql':
Expand Down

0 comments on commit be9e63c

Please sign in to comment.