Skip to content

Back each directory group with a core group - #40

Merged
mastacontrola merged 1 commit into
mainfrom
feat/directorygroups-core-groups
Oct 16, 2026
Merged

mastacontrola merged 1 commit into
mainfrom
feat/directorygroups-core-groups

Conversation

@mastacontrola

Copy link
Copy Markdown
Member

Follow-up to FOGProject/fogproject#1879. Needs FOGProject/fogproject#1886 (the ASSOCIATION_UPDATED event and the directoryOUs.doGroupID foreign key).

What changes for an admin

  • A host in a directory group gets everything that group's core group grants: snapins, printers, modules and power schedules.
  • Joining a directory group writes its OU into the host's ADOU, and its domain into ADDomain when the group has one. Leaving changes nothing on the host.
  • A host is in at most one directory group. Joining a second one removes it from the first. This holds on every path: the core Group page, the host's Groups tab, mass edit, CSV import, registration and the API.
  • Deleting a directory group deletes its core group. Deleting the core group deletes the directory group.

Schema (appended, steps 5-7)

  • 5: add directoryOUs.doGroupID.
  • 6: per directory group, create a core group, copy directoryOUAssoc into groupMembers, write each member's OU and domain, then drop directoryOUAssoc.
  • 7: sweep, then add the CASCADE foreign key to groups.

A core group name that is longer than 50 characters, or already taken, ends in #<id>.

Removed

  • DirectoryGroupsChangeItems. It set ADOU at legacy-client check-in. The OU is on the host itself now.
  • directorygroupsassociation from the API class list. groupID is server-owned.

Tests

  • New tests/directorygroups-membership.test.php: both event directions, last-wins on a double join, who leaves which group, and the step order. It fails with the planner changed to first-wins.
  • plugin-id-columns-are-classified now reads ALTER TABLE ... ADD COLUMN too. Before, a column added by a later step was invisible to it. It failed on doGroupID until the pin was added.
  • sh tests/run-all.sh: 19 passed.

Live test (local 1.6 webroot)

The upgrade ran on rows written by the released v1.6.25 code. Every path in "What changes" behaved as described. The host list on the directory group page now shows the same associated/dissociated marks as the core Group page. The test rows were removed afterward.

🤖 Generated with Claude Code

A host in a directory group now gets everything its core group grants:
snapins, printers, modules and power schedules (fogproject ADR 0038).
Joining one also writes the OU, and the domain when the group has one,
onto the host's ADOU and ADDomain. That write is a deliberate exception
to ADR 0038's "a group grants, it does not copy" (GH-1879 follow-up).

- directoryOUs.doGroupID names the backing core group. Schema step 5 adds
  it; step 6 creates a core group per directory group, copies
  directoryOUAssoc into groupMembers, writes each member's OU and domain,
  then drops directoryOUAssoc; step 7 adds the CASCADE foreign key.
- DirectoryGroups::save() creates the core group, keeps its name in step,
  and saves hosts through it. A name that is too long for groupName
  (varchar 50) or already taken ends in " #<id>".
- AddDirectoryGroupsMembership listens to core's ASSOCIATION_UPDATED
  (fogproject #1886). Whichever page or route adds a host to a directory
  group's core group, the host leaves every other directory group and
  takes the new OU. Leaving changes nothing on the host.
- The host tab, mass edit and registration join through the core group.
  Deleting a directory group deletes its core group; deleting the core
  group deletes the directory group.
- DirectoryGroupsChangeItems is removed: it set ADOU at legacy client
  check-in, and the OU is on the host itself now. The API no longer lists
  directorygroupsassociation, and groupID is server-owned.
- plugin-id-columns-are-classified now also reads ALTER TABLE ... ADD
  COLUMN, so an id column added by a later step cannot skip
  classification. It failed on doGroupID until the pin was added.

Live-tested on the local 1.6 webroot: upgrade from v1.6.25 data, core
Group page add, host Groups tab add, mass edit set and clear, new group,
rename, and both deletes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant