-
Notifications
You must be signed in to change notification settings - Fork 1
Map to webchart schema #74
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR maps the existing WebChart MySQL schema to LDAP-required format by updating field mappings and adding numeric ID derivation logic.
- Derives uidNumber and gidNumber from WebChart database fields (user_id and realm id) with +10000 offset
- Updates LDAP user entry creation to use WebChart schema fields (first_name, last_name, email)
- Refactors MySQL queries to work with WebChart's users, realms, and user_realms tables
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
File | Description |
---|---|
src/utils/ldapUtils.js | Maps WebChart user fields to LDAP entry format and derives numeric IDs |
src/db/drivers/mysql.js | Updates database queries to use WebChart schema tables and relationships |
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.
I'm fine with this merging as-is, but I don't want to close the related Issue until we can figure out chart types with observations for at least uidNumber and gidNumber
const uidNumber = user.uid_number !== undefined && user.uid_number !== null ? user.uid_number.toString() : "0"; | ||
const gidNumber = user.gid_number !== undefined && user.gid_number !== null ? user.gid_number.toString() : "0"; | ||
// 1) Prefer observation-mapped UID (ldap_uid_number) | ||
// 2) Fallback: old behavior (user_id + 10000) |
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.
We don't have to worry about maintaining this compatibility. It should log a warning if the user entry in webchart doesn't have a matching uid observation and either return a LDAP entry without a uidNumber or fail and return no entry.
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.
On second thought, uidNumber is a MUST for posixAccount in the LDAP schema. As such, a user that doesn't have a uidNumber observation should be considered invalid and no entry should ever be returned for them. This also has the benefit of giving an implicit way to distinguish between LDAP and non-LDAP users in the Webchart system.
DONE