Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Mar 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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