Skip to content
Merged
Show file tree
Hide file tree
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
87 changes: 87 additions & 0 deletions flex-linux-setup/flex_linux_setup/flex_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@
"type": "TEXT"
}
}
},
{
"desc": "Admin UI feature identifier",
"equality": "caseIgnoreMatch",
"names": [
"auiFeatureId"
],
"oid": "jansAttr",
"substr": "caseIgnoreSubstringsMatch",
"syntax": "1.3.6.1.4.1.1466.115.121.1.15",
"x_origin": "Jans created attribute"
},
{
"desc": "Webhook identifier",
"equality": "caseIgnoreMatch",
"names": [
"webhookId"
],
"rdbm_json_column": true,
"oid": "jansAttr",
"substr": "caseIgnoreSubstringsMatch",
"syntax": "1.3.6.1.4.1.1466.115.121.1.15",
"x_origin": "Jans created attribute"
}
],
"objectClasses": [
Expand All @@ -39,6 +62,70 @@
"top"
],
"x_origin": "Gluu Flex created objectclass"
},
{
"kind": "STRUCTURAL",
"may": [
"auiFeatureId",
"displayName",
"jansScope",
"webhookId"
],
"must": [
"objectclass"
],
"names": [
"auiFeatures"
],
"oid": "jansObjClass",
"sup": [
"top"
],
"x_origin": "Gluu Flex created objectclass"
},
{
"kind": "STRUCTURAL",
"may": [
"inum",
"displayName",
"description",
"url",
"httpMethod",
"httpRequestBody",
"jansEnabled",
"httpHeaders"
],
"must": [
"objectclass"
],
"names": [
"auiWebhooks"
],
"oid": "jansObjClass",
"sup": [
"top"
],
"x_origin": "Gluu Flex created objectclass"
},
{
"kind": "STRUCTURAL",
"may": [
"inum",
"jansResource",
"jansAccessType",
"jansScope"
],
"must": [
"objectclass"
],
"names": [
"adminUIResourceScopesMapping"
],
"oid": "jansObjClass",
"sup": [
"top"
],
"x_origin": "Gluu Flex created objectclass"
}
Comment on lines +66 to 129
Copy link
Contributor

@coderabbitai coderabbitai bot Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify that attributes referenced in new objectClasses exist in base Jans schema

echo "Repository structure and schema files:"
find . -name "*schema*.json" -type f | head -20

echo -e "\n=== Searching for attribute definitions in schema files ==="

# List of attributes used in new objectClasses that should exist in base schema
ATTRS="url httpMethod httpRequestBody httpHeaders jansResource jansAccessType jansEnabled jansScope displayName description inum"

for attr in $ATTRS; do
  echo "=== Checking attribute: $attr ==="
  rg -n "\"$attr\"" --type json -g '*schema*.json' 2>/dev/null | head -3
done

Repository: GluuFederation/flex

Length of output: 2275


🏁 Script executed:

#!/bin/bash
# Check if flex_schema.json contains attribute definitions (not just objectClass references)
# Look for attribute definitions - typically with "kind": "ATTRIBUTE" or similar pattern

echo "=== Structure of flex_schema.json ==="
wc -l flex-linux-setup/flex_linux_setup/flex_schema.json

echo -e "\n=== Checking for attribute definitions in flex_schema.json ==="
# Look for entries that define attributes (may contain "kind": "ATTRIBUTE" or attribute-specific structure)
rg -n '"kind"' flex-linux-setup/flex_linux_setup/flex_schema.json | head -20

echo -e "\n=== Full file structure (first 50 lines) ==="
head -50 flex-linux-setup/flex_linux_setup/flex_schema.json

Repository: GluuFederation/flex

Length of output: 1565


🏁 Script executed:

#!/bin/bash
# Get the full content of flex_schema.json to see all attribute definitions and objectClass references
cat -n flex-linux-setup/flex_linux_setup/flex_schema.json

Repository: GluuFederation/flex

Length of output: 3748


Missing attribute definitions for newly added objectClasses.

The file adds three new objectClasses but references multiple attributes that are not defined in the attributeTypes section:

  • auiWebhooks references: url, httpMethod, httpRequestBody, httpHeaders, description
  • adminUIResourceScopesMapping references: jansResource, jansAccessType
  • adminUISession references: sid, jansUsrDN, creationDate, exp

Only auiFeatureId and webhookId are defined in this schema file. The remaining attributes must exist in the base Jans schema for these objectClasses to function correctly. Add attribute definitions for all undeclared attributes to this file, or document the external dependency explicitly.

🤖 Prompt for AI Agents
In `@flex-linux-setup/flex_linux_setup/flex_schema.json` around lines 66 - 129,
The schema adds new objectClasses (auiFeatures, auiWebhooks,
adminUIResourceScopesMapping, adminUISession) but several attributes they
reference are not defined here; add missing attributeType definitions for url,
httpMethod, httpRequestBody, httpHeaders, description, jansResource,
jansAccessType, sid, jansUsrDN, creationDate, exp (or explicitly document they
come from the Jans base schema). Locate the objectClasses named auiWebhooks,
adminUIResourceScopesMapping, and adminUISession in flex_schema.json and either
insert corresponding attributeTypes for each referenced attribute (with
appropriate OIDs, syntax, and single/multi-valued settings) or add a clear
comment/metadata indicating the external schema provides them; ensure each
attribute name matches exactly the names used in the may/must lists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderabbitai we use jans setup with flex setup, so this file https://raw.githubusercontent.com/JanssenProject/jans/refs/heads/main/jans-linux-setup/jans_setup/schema/jans_schema.json is also included. No need to re-define attributes defined in file jans_schema.json

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Fetch the jans_schema.json file to verify the attributes exist
curl -s "https://raw.githubusercontent.com/JanssenProject/jans/refs/heads/main/jans-linux-setup/jans_setup/schema/jans_schema.json" > /tmp/jans_schema.json

echo "=== Verifying attributes in jans_schema.json ==="
# Check for the attributes I flagged as missing
ATTRS="url httpMethod httpRequestBody httpHeaders description jansResource jansAccessType sid jansUsrDN creationDate exp displayName inum jansEnabled jansScope"

for attr in $ATTRS; do
  echo -n "Checking $attr: "
  if grep -q "\"$attr\"" /tmp/jans_schema.json; then
    echo "✓ Found"
  else
    echo "✗ Not found"
  fi
done

echo -e "\n=== Sample attribute definitions from jans_schema.json ==="
# Show a few examples of how attributes are defined
cat /tmp/jans_schema.json | jq '.attributeTypes[] | select(.names[] | contains("url") or contains("httpMethod") or contains("description"))' 2>/dev/null | head -40

Length of output: 993


@devrimyatar, thank you for the clarification! I've verified that all the attributes I flagged are indeed defined in the jans_schema.json file:

✓ All 15 attributes confirmed: url, httpMethod, httpRequestBody, httpHeaders, description, jansResource, jansAccessType, sid, jansUsrDN, creationDate, exp, displayName, inum, jansEnabled, jansScope

The schema inclusion architecture makes sense now - flex_schema.json only needs to define Flex-specific attributes and objectClasses, while relying on the base Jans schema for common attributes. This approach avoids duplication and maintains consistency across the platform.

    (\(\
    (-.-)
    o_(")(")  *thinking rabbit*

✏️ Learnings added
Learnt from: devrimyatar
Repo: GluuFederation/flex PR: 2614
File: flex-linux-setup/flex_linux_setup/flex_schema.json:66-129
Timestamp: 2026-01-27T14:41:16.193Z
Learning: In the GluuFederation/flex repository, flex setup uses jans setup together, and the jans_schema.json file from the Jans project (https://raw.githubusercontent.com/JanssenProject/jans/refs/heads/main/jans-linux-setup/jans_setup/schema/jans_schema.json) is included during setup. Therefore, attributes defined in jans_schema.json don't need to be redefined in flex_schema.json - only Flex-specific attributes should be added to flex_schema.json.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: devrimyatar
Repo: GluuFederation/flex PR: 2569
File: flex-linux-setup/flex_linux_setup/flex_schema.json:37-37
Timestamp: 2026-01-11T12:22:57.318Z
Learning: In the GluuFederation/flex repository, the flex_schema.json file in flex-linux-setup is used to generate SQL tables, not for creating LDAP attributes/objectclasses. OID values in this schema file don't need to follow strict LDAP OID validation rules since they're only used for SQL table generation.

Learnt from: devrimyatar
Repo: GluuFederation/flex PR: 2569
File: flex-linux-setup/flex_linux_setup/flex_schema.json:23-30
Timestamp: 2026-01-11T16:23:57.231Z
Learning: In GluuFederation/flex repository, when SQL data types are not explicitly defined in schema files like flex_schema.json, the RDBM installer determines column types using two fallback files: ldap_sql_data_type_mapping.json (which maps LDAP syntax OIDs to SQL types) and sql_data_types.json (which maps specific attribute names to SQL types). This fallback mechanism is located in the JanssenProject/jans repository under jans-linux-setup/jans_setup/static/rdbm/.
<!--

Learnt from: devrimyatar
Repo: GluuFederation/flex PR: 2440
File: flex-linux-setup/flex_linux_setup/flex_setup.py:519-519
Timestamp: 2025-11-11T15:17:34.651Z
Learning: In flex-linux-setup/flex_linux_setup/flex_setup.py, the webhook LDIF (aui_webhook.ldif) should only be imported during fresh Admin UI installations, not during updates. The import is correctly guarded by the check `client_check_result['2001.'] == -1` which ensures it only runs when the Admin UI Web Client doesn't already exist. Docker update workflows differ from Linux update workflows in this regard.

],
"oidMacros": {
Expand Down
3 changes: 1 addition & 2 deletions flex-linux-setup/flex_linux_setup/flex_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,9 @@ def get_scope_dn_by_id(self, jansid):


def create_tables(self):
print("self.schema_file", self.schema_file)
self.dbUtils.read_jans_schema(others=[self.schema_file])
rdbm_installer.create_tables([self.schema_file])

self.dbUtils.rdm_automapper(True)

def install_gluu_admin_ui(self):

Expand Down
Loading