-
Notifications
You must be signed in to change notification settings - Fork 22
feat(flex-linux-setup): move flex schema to flex setup #2614
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
Conversation
Signed-off-by: Mustafa Baser <mbaser@mail.com>
📝 WalkthroughWalkthroughThis PR adds new LDAP schema entries for Admin UI features and webhooks (uiFeatureId, webhookId attributes and auiFeatures, auiWebhooks, adminUIResourceScopesMapping object classes) to flex_schema.json, and modifies the schema setup process to call an automapper function after table creation in flex_setup.py. Changes
Possibly Related PRs
Suggested Reviewers
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@flex-linux-setup/flex_linux_setup/flex_schema.json`:
- Around line 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.
| { | ||
| "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" | ||
| } |
There was a problem hiding this comment.
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
# 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
doneRepository: 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.jsonRepository: 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.jsonRepository: 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:
auiWebhooksreferences:url,httpMethod,httpRequestBody,httpHeaders,descriptionadminUIResourceScopesMappingreferences:jansResource,jansAccessTypeadminUISessionreferences: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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.



closes #2593
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.