Skip to content

Group recursion and user authorizations through the v1 API (0.6.7) - #46

Merged
baraline merged 3 commits into
mainfrom
feat/v1-recursion-authorizations
Oct 31, 2026
Merged

baraline merged 3 commits into
mainfrom
feat/v1-recursion-authorizations

Conversation

@baraline

Copy link
Copy Markdown
Owner

GLPI's v2 API cannot make a group recursive or touch a user's authorizations. This PR adds both through the legacy v1 session, the way document uploads and KB category writes already work.

What was checked against GLPI 11 preprod (2026-10-30):

  • The v2.3 spec preprod serves (and GLPI's main branch) has no is_recursive on Group, though 123 other schemas carry one, and no Profile_User route.
  • A v2 group create with is_recursive in the body silently drops it.
  • v1 PUT Group/{id} sets it, and v1 PUT Profile_User/{id} moves an authorization.

Added

  • set_group_recursive(group_id, recursive=True): v1 PUT Group/{id}.
  • User authorizations (v1 Profile_User), as the new UserAuthorization model:
    • list_user_authorizations(user_id)
    • add_user_authorization(user_id, *, profile_id, entity_id, recursive=False)
    • update_user_authorization(authorization_id, *, entity_id=None, recursive=None)
    • delete_user_authorization(authorization_id)
  • ensure_v1_write_accepted: a v1 write answered false now raises GlpiProtocolError instead of passing silently. This applies to the new writes only; existing ones are unchanged.
  • Like every v1-backed method, each one raises RuntimeError when the client has no v1 session.

Not measured on a server

POST Profile_User and DELETE Profile_User/{id} are GLPI's standard v1 item routes but were tested against fakes only.

Release and checks

  • Docs, user guide, provisioning skill and CHANGELOG are updated, and the version is 0.6.7 everywhere.
  • 2222 tests pass with 98% coverage. ruff, mypy (strict) and sphinx -W are clean.
  • vulture reports 6 findings, all in files this PR does not touch.

The itsm_synchronisation sync needs this release to make the groups it creates recursive and to place the users it creates in their entity.

🤖 Generated with Claude Code

baraline and others added 3 commits October 30, 2026 20:51
…: set_group_recursive, list/add/update/delete_user_authorization and the UserAuthorization model

The GLPI v2 API has no is_recursive on Group and no route for a user's profile and entity authorizations, so these helpers use the v1 session. A v1 write answered false is a refusal and raises GlpiProtocolError with the server message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…PI reference, user guide, provisioning skill and CHANGELOG, version bumped in pyproject, __version__ and every skill

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.05%. Comparing base (085ec07) to head (e636788).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #46      +/-   ##
==========================================
+ Coverage   98.02%   98.05%   +0.03%     
==========================================
  Files          93       94       +1     
  Lines        3637     3700      +63     
==========================================
+ Hits         3565     3628      +63     
  Misses         72       72              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@baraline
baraline merged commit 18d113e into main Oct 31, 2026
7 checks passed
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.

2 participants