Skip to content

Commit

Permalink
fix: jans-linux-setup multivalued json mapping (ref: #1088) (#1090)
Browse files Browse the repository at this point in the history
* fix: jans-linux-setup multivalued json mapping (ref: #1088)

* fix: jans-linux-setup multivalued attributes are json
  • Loading branch information
devrimyatar authored Mar 23, 2022
1 parent f10ccb1 commit e3d9dbf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 49 deletions.
9 changes: 8 additions & 1 deletion jans-linux-setup/jans_setup/schema/jans_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@
"names": [
"memberOf"
],
"multivalued": true,
"oid": "jansAttr",
"syntax": "1.3.6.1.4.1.1466.115.121.1.12",
"x_origin": "Jans created attribute"
Expand Down Expand Up @@ -885,6 +886,7 @@
"names": [
"jansReqURI"
],
"multivalued": true,
"oid": "jansAttr",
"substr": "caseIgnoreSubstringsMatch",
"syntax": "1.3.6.1.4.1.1466.115.121.1.15",
Expand Down Expand Up @@ -1621,7 +1623,7 @@
"names": [
"jansScrDn"
],
"multivalued": true,
"multivalued": true,
"oid": "jansAttr",
"syntax": "1.3.6.1.4.1.1466.115.121.1.12",
"x_origin": "Jans created attribute"
Expand Down Expand Up @@ -1654,6 +1656,7 @@
"names": [
"jansSmtpConf"
],
"multivalued": true,
"oid": "jansAttr",
"substr": "caseIgnoreSubstringsMatch",
"syntax": "1.3.6.1.4.1.1466.115.121.1.15",
Expand Down Expand Up @@ -1917,6 +1920,7 @@
"names": [
"jansUmaPermission"
],
"multivalued": true,
"oid": "jansAttr",
"substr": "caseIgnoreSubstringsMatch",
"syntax": "1.3.6.1.4.1.1466.115.121.1.15",
Expand Down Expand Up @@ -2506,6 +2510,7 @@
"names": [
"jansClaimRedirectURI"
],
"multivalued": true,
"oid": "jansAttr",
"substr": "caseIgnoreSubstringsMatch",
"syntax": "1.3.6.1.4.1.1466.115.121.1.15",
Expand Down Expand Up @@ -2668,6 +2673,7 @@
"names": [
"jansAuthorizedOrigins"
],
"multivalued": true,
"oid": "jansAttr",
"substr": "caseIgnoreSubstringsMatch",
"syntax": "1.3.6.1.4.1.1466.115.121.1.15",
Expand Down Expand Up @@ -2861,6 +2867,7 @@
"names": [
"jansAlias"
],
"multivalued": true,
"oid": "jansAttr",
"syntax": "1.3.6.1.4.1.1466.115.121.1.15",
"x_origin": "Jans created attribute"
Expand Down
13 changes: 11 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 @@ -33,9 +33,12 @@ def install(self):

self.local_install()
jans_schema_files = []

self.jans_attributes = []
for jans_schema_fn in ('jans_schema.json', 'custom_schema.json'):
jans_schema_files.append(os.path.join(Config.install_dir, 'schema', jans_schema_fn))
schema_full_path = os.path.join(Config.install_dir, 'schema', jans_schema_fn)
jans_schema_files.append(schema_full_path)
schema_ = base.readJsonFile(schema_full_path)
self.jans_attributes += schema_.get('attributeTypes', [])

self.create_tables(jans_schema_files)
self.create_subtables()
Expand Down Expand Up @@ -83,6 +86,12 @@ def local_install(self):

def get_sql_col_type(self, attrname, table=None):

for attr_ in self.jans_attributes:
if attrname in attr_['names'] and attr_.get('multivalued'):
if Config.rdbm_type == 'spanner':
return 'ARRAY<STRING(MAX)>'
return 'JSON'

if attrname in self.dbUtils.sql_data_types:
type_ = self.dbUtils.sql_data_types[attrname].get(Config.rdbm_type) or self.dbUtils.sql_data_types[attrname]['mysql']
if table in type_.get('tables', {}):
Expand Down
46 changes: 0 additions & 46 deletions jans-linux-setup/jans_setup/static/rdbm/sql_data_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -542,17 +542,6 @@
"type": "STRING(MAX)"
}
},
"jansReqURI": {
"mysql": {
"type": "TINYTEXT"
},
"pgsql": {
"type": "TEXT"
},
"spanner": {
"type": "STRING(MAX)"
}
},
"jansSectorIdentifierURI": {
"mysql": {
"type": "TINYTEXT"
Expand Down Expand Up @@ -586,17 +575,6 @@
"type": "STRING(MAX)"
}
},
"jansClaimRedirectURI": {
"mysql": {
"type": "TINYTEXT"
},
"pgsql": {
"type": "TEXT"
},
"spanner": {
"type": "STRING(MAX)"
}
},
"jansJwt": {
"mysql": {
"type": "TEXT"
Expand Down Expand Up @@ -756,14 +734,6 @@
"type": "STRING(MAX)"
}
},
"memberOf": {
"mysql": {
"type": "JSON"
},
"spanner": {
"type": "ARRAY<STRING(MAX)>"
}
},
"tknCde": {
"mysql": {
"size": 80,
Expand All @@ -774,14 +744,6 @@
"type": "STRING"
}
},
"jansUmaPermission": {
"mysql": {
"type": "JSON"
},
"spanner": {
"type": "ARRAY<STRING(MAX)>"
}
},
"jansScrError": {
"mysql": {
"type": "TEXT"
Expand Down Expand Up @@ -833,14 +795,6 @@
"type": "STRING"
}
},
"jansSmtpConf": {
"mysql": {
"type": "JSON"
},
"spanner": {
"type": "ARRAY<STRING(MAX)>"
}
},
"jansResource": {
"mysql": {
"type": "TINYTEXT"
Expand Down

0 comments on commit e3d9dbf

Please sign in to comment.