Skip to content

Access Services Design

Ed Mozley edited this page Dec 1, 2026 · 1 revision

Access through directory groups - design (#505)

Status: PROPOSAL - nothing built yet (1 December 2026). Waiting on @bigtrodat's answers to the questions in section 9. Anyone else who manages access through Entra ID or Active Directory groups is welcome to join in on issue #505: this should fit more than one organisation.

The request, from @bigtrodat on issue #505:

"This service item could be something like 'Access to Service XYZ'. This service has an owner (and probably a substitute) defined. Also there is an Entra-ID or LDAP group assigned to this service. All members of that group have access. Once the service article request have been approved, requester is added as a member to the group."

Add-on 1: "User can see his assigned services and request cancellation / de-provisioning. Once cancellation / de-provisioning have been approved (to be defined by whom), user is removed from group."

Add-on 2: "Service Owner (what is not necessarily a member of IT department) can see services he/she is responsible for and can see members when a group is assigned. Adding or Removing a member should be possible for the service owner as well."

"This would reduce work load, because maintaining group membership is ~20% of our workload."

In plain words

Today somebody asks for access, the request is approved, and then an analyst opens Entra or Active Directory and adds the person to a group by hand. This design makes FreeITSM do the last step itself, and keeps a record of who has which access and why.

It is built from five parts. Each one is useful on its own, and each reuses something FreeITSM already has.

Part What it does Reuses Size
A. Access services A list of things people can have access to. Each has an owner, a deputy and a directory group The owner and deputy of cost centres; the groups the Entra import already brings in Medium
B. Writing to the directory Add a person to a group, or take them out, in Entra ID (and later Active Directory) The Entra connection the import already uses, plus a permission it does not have today Medium
C. Who has what One record per person per service: granted when, by which request, removed when and why The way licence seats keep their history Small
D. The owner approves A catalogue item's approval step can be the service's owner, with the deputy standing in The approval steps and the portal Approvals page from #160 Small
E. The portal People see the access they have and ask for it to be removed (add-on 1); owners see who has their services and add or remove people (add-on 2) The portal's Your requests and Approvals pages Medium

Five rules run through all of it:

  1. Nothing changes on upgrade, and nothing is written to a directory until an administrator switches it on. Directory writes are off by default, per directory connection.
  2. Nobody is added or removed without a reason on record: an approved request, or the owner's own action. FreeITSM never adds a person because a sync or a guess says so.
  3. A write that fails is never silent. It is logged, the request says so, and the service owner and the service desk are told, the same way every other failure in FreeITSM is surfaced (Email send log, failed workflow runs on Watchtower).
  4. The directory stays the truth about membership. FreeITSM records why it made each change, and compares that with the group after every import. Someone added in Entra directly is shown as added in the directory, not hidden and not removed.
  5. Choosing, not typing. The group is picked from a list, the owner from the people directory. There are no group ids or LDAP paths to type.

1. What FreeITSM has today

Piece Where State
Entra groups and their members directory_groups, directory_group_members, filled by the Entra import (includes/entra_sync.php) βœ… Read every import. Read-only - the app registration has User.Read.All and GroupMember.Read.All
A person's Entra object id user_sso_identities.source_ref βœ… What a Graph add-member call needs. The OIDC subject must not be used - it is a different value (identity rules)
LDAP / Active Directory includes/ldap.php, includes/directory_sync.php ⚠️ People are imported; groups are not - they are read only at sign-in, to decide who may log in. A person's DN is in source_ref
Catalogue item approval forms.approval_steps, catalogueFinishDecision() βœ… Ordered steps; deciders can be a person, a team, the requester's manager or the cost centre owner
Portal approvals self-service/approvals.php βœ… Portal people decide there, with deputy and away handling
Owner + deputy cost_centres.owner_user_id / owner_group_id / deputy_user_id βœ… The pattern to copy
Writing to Entra or AD - ❌ None anywhere. The Starters & leavers module even refuses to change directory-managed people ("disable the account there")
A "service" with an owner - ❌ Neither the CMDB nor Service Status has an owner
Who has which access - ❌ A request is one-way; only a pending request can be cancelled

2. Part A - access services

A new list, Forms -> Access services (beside the catalogue). Each row:

Field Notes
Name and description "Access to the finance share", "SAP - read only"
Owner A person from the people directory, or a people group - exactly as a cost centre's owner. Need not be IT staff: owners act from the portal
Deputy A person. Stands in for the owner the same way as on cost centres (any time, or only when the owner is away)
Directory group Picked from the groups the import brought in, with their member counts. One group per service to begin with (question 5)
Company On a multi-company install, the service belongs to one company; its owner, deputy and members must be in it
Active A retired service keeps its history; nobody can request it

A catalogue item grants a service: a new choice in the item's settings, When approved, give access to: [service]. The item keeps everything it has today - its questions, its approval steps, its ticket. Granting access is one more thing that happens on approval. One service can be granted by more than one item (an English and a German form, say).

The service's page shows its members (part C), its open requests, and the history of every change.

3. Part B - writing to the directory

Entra ID

Two Microsoft Graph calls:

What Call
Add POST /groups/{group-id}/members/$ref with {"@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/{user-object-id}"}
Remove DELETE /groups/{group-id}/members/{user-object-id}/$ref

They need the application permission GroupMember.ReadWrite.All. That is a much stronger permission than today's read-only ones: it lets the app change the membership of almost any group in the tenant. So:

  • It goes on a separate app registration, used only for writes - Directory writes on the Entra connection, with its own client id and secret. The import keeps its read-only registration. If the write secret ever leaked, the import's would not be the one at risk, and the other way round.
  • Test on that screen asks Microsoft for a token and reads the permissions it carries (the token's roles), without changing anything, and says plainly when GroupMember.ReadWrite.All is missing or has not been granted admin consent.
  • FreeITSM only ever writes to groups that are chosen on an access service. It never offers a write to any other group, whatever the permission would allow.

⚠️ Microsoft refuses two kinds of group, and the design has to say so rather than fail mysteriously:

  • Groups synced from on-premises Active Directory (onPremisesSyncEnabled). Their membership can only be changed in AD; Entra rejects the write. The group picker marks these, and they need the Active Directory path.
  • Role-assignable groups (isAssignableToRole) need a far stronger permission. They are marked and not offered.

Which kind MHB's access groups are decides whether Entra alone is enough (question 1).

Active Directory (LDAP) - later stage

  1. Import groups first. Today an LDAP connection brings in people only. It gains Import groups (a base DN and a filter, like the existing ones), filling the same directory_groups table, so the picker works the same for both.
  2. Writes use the service account, with ldap_mod_add / ldap_mod_del on the group's member attribute and the person's DN from source_ref. The account needs Write Members on the groups (or the OU that holds them) - delegated in AD, and nothing more.
  3. Plain LDAP (ldap://) sends the change unencrypted. Directory writes require LDAPS or StartTLS.

Every write

  • Runs after the approval is committed, never inside it - a slow or failing directory cannot undo a decision.
  • Is recorded in a directory change log (who, which group, add or remove, which request or which owner, the result and Microsoft's or AD's own error text) - like the Email send log.
  • On failure: the grant shows Failed - not added, with the reason and a Try again button; the service owner and the service desk get a bell notification; it counts on Watchtower. The request stays approved - the decision was right, the directory said no.
  • Updates directory_group_members straight away, so the screens do not wait for the next import to show the change.

4. Part C - who has what

One row per person per service:

State Being added -> Has access -> Being removed -> Removed, or Failed at either step
Why The approved request (linked), the owner who added them, or found in the directory
When and by whom Granted, removed, and the reason for a removal

Removed rows are kept, so a service always has its history ("who had access to the finance share in March?").

After every import FreeITSM compares each service's rows with the group's real members:

  • In the group, no row -> a row found in the directory. Shown to the owner; never removed by FreeITSM on its own.
  • A row says Has access, but they are no longer in the group -> marked removed in the directory.

5. Part D - the owner approves

A catalogue item's approval steps gain one more kind of decider: The access service's owner. It works exactly like The cost centre's owner: the owner (or anyone in the owning group) decides on the portal Approvals page, the deputy stands in, and an owner with no portal sign-in falls back as other steps do.

So "the manager says they need it, then the service owner agrees" is two steps on the item, and no new approval machinery.

6. Part E - the portal

Add-on 1 - My access. A new portal page lists the services the signed-in person has, with when and why. Each has Ask to remove. Removal is a request like any other, approved by whoever the service says (question 3); once approved, they are taken out of the group, and the row shows it.

Add-on 2 - Services I own. The owner and deputy see their services, and for each one:

  • the members - from FreeITSM's rows and from the group itself, with found in the directory marked;
  • Add a person (picked from the people directory) and Remove, with a reason. The owner's action is the approval: nothing waits on anyone else (question 4);
  • the history.

People who are not IT staff never need an analyst account for any of this - the same reason the #160 approvals were put on the portal.

7. Worked example

Access to the finance share - owner: the head of finance; deputy: the finance office manager; group: SG-Finance-Share in Entra.

  1. A member of staff orders Finance share access from the catalogue. Steps: their manager, then the access service's owner.
  2. The manager approves on the portal; then the head of finance approves.
  3. FreeITSM adds them to SG-Finance-Share. Their My access page shows Finance share - since 3 December, request #1234.
  4. Six months later they move team and press Ask to remove. The owner approves; they are taken out of the group.
  5. The head of finance opens Services I own, sees eleven members - one marked found in the directory, added by IT in Entra last year - and removes them with the reason "left the department".

8. Not in this design

  • Time-limited access ("for 90 days") and access reviews (the owner confirms every member each quarter). Both are common in access management and both fit on part C later; they are only worth building if they are wanted (question 6).
  • Creating groups in Entra or AD. FreeITSM only changes the membership of groups that already exist.
  • Licences, mailboxes, application roles. Only group membership. Most of those are granted through groups anyway.

9. Questions for @bigtrodat

  1. Where do your access groups live? Cloud-only groups in Entra, or groups in your on-premises Active Directory that are synced to Entra? Entra cannot change a synced group, so this decides which part is built first.
  2. The Graph permission. Is GroupMember.ReadWrite.All on a separate app registration, used only for these writes, acceptable to your security team? (For Active Directory: a service account with Write Members on the groups' OU.)
  3. Removing access (add-on 1): who approves? The service owner; the same steps as granting it; or nobody, because giving access up is always allowed?
  4. The owner adding or removing people (add-on 2): should that need anyone else's approval, or is the owner's own action enough?
  5. One group per service? Or does a service sometimes mean two groups - an application group and a VPN group, say?
  6. Time-limited access and regular access reviews: wanted now, later, or not at all?
  7. Who is the owner - always a person, or sometimes a group of people (a team that owns a system together)?

10. Build order (proposed)

Stage Parts Why first
1 A, B (the directory your groups live in), C, D The core: approve a request, the person is in the group, and it is on record
2 E - My access and Services I own Removal and owner management, on top of stage 1's records
3 B for the other directory (with LDAP group import, if needed) Only if both kinds of group are in use

For developers

Schema (proposed): access_services (name, description, owner_user_id / owner_group_id, deputy_user_id, directory_group_id, tenant_id, is_active); access_grants (service_id, user_id, state, source request / owner / directory, submission_id, granted_*, removed_*, last_error); directory_change_log; forms.access_service_id - which must be carried by createVersion() or saving an item drops it. Directory write credentials as new encrypted columns on auth_providers, apart from the import's.

Reuse: entraConfig() / entraToken() / GraphHttpError for Graph; ldapOpen() / ldapBindService() for AD; catalogueStepPeople() + catalogueNormaliseStepPolicy() for the owner step (as cc_owner); catalogueAfterDecision() (after commit) for the grant; the portal Approvals page for owners.

Traps to carry into the build:

  • The object id is source_ref, never subject - the identity TRAP.
  • Every write sits inside the sync's $preview guards if it ever runs from a sync (Extending directory sync Β§4).
  • A first comparison after an import would mark every existing member found in the directory - correct, but the owner should see it as "already in the group when the service was set up", not as something to act on.
  • The catalogue_request.approved payload has no requester user_id today; the grant needs the submission's submitted_by_user_id, not an email answer.

See also

FreeITSM

Getting Started

Modules

Multi-tenancy (planned)

Responses to feedback

Blue sky thinking

Bugs resolved

Pull requests

Links

Clone this wiki locally