Add support for roles - #167
Conversation
$client->role() If you create a user you can specify role_ids but there's no way to get those ids.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (9)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change adds Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to No actionable issue is established; the role support is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Role operations reuse the existing authenticated connection rather than granting additional privileges locally. No authorization bypass was established. Remaining uncertainty concerns server-enforced permissions, recovery after interrupted mutations, and the complete comparison with behavior before this PR. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 65.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 8 files. (3 skipped: 3 unsupported.)
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 |
Covers the roles support added in PR zammad#167 with unit and integration tests and documents the endpoint: - RoleRepositoryTest: all(), find(), create(), patch(), search() and the BadMethodCallException from the unsupported delete() - RoleDTO added to the shared DTO provider, role accessor to the repository accessor provider - RoleIntegrationTest: listing, default roles, find(), pagination and the motivating use case (resolve a role name to the id used in role_ids) - Restore the house-style docblocks on RoleDTO/RoleRepository, including the @extends annotation phpstan needs - README: role accessor, Roles section, RoleDTO reference, delete table entry, admin permission note for integration tests; CHANGELOG and migration examples Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Verified against the Zammad server source instead of assuming: - No DELETE route exists for roles (config/routes/role.rb maps index, search, show, create and update only), so the non-deletable documentation holds. - /api/v1/roles/search does exist and supports with_total_count, so totalCount() works — covered by an integration test. - index and show are permitted to ticket.agent, admin.role and ticket.customer, not admin-only as documented before. A customer sees a reduced role whose name Zammad masks as "Role_<id>" (Role::Assets#filter_unauthorized_attributes), so name resolution needs an agent or admin token; search, create and patch need admin.role. - permission_ids and group_ids are applied on create and update via associations_from_param, and group_ids is a group-ID-to-access map rather than a flat list. RoleDTO therefore gains default_at_signup, permission_ids and group_ids, with unit tests for hydration of the map shape, the reduced customer view and payload construction, plus the corrected README and docblocks. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Thanks a lot for this — really useful addition. I've added unit and integration tests plus the docs on top of your commits, so this is good to go from my side. Thanks again! |
Covers the roles support added in PR #167 with unit and integration tests and documents the endpoint: - RoleRepositoryTest: all(), find(), create(), patch(), search() and the BadMethodCallException from the unsupported delete() - RoleDTO added to the shared DTO provider, role accessor to the repository accessor provider - RoleIntegrationTest: listing, default roles, find(), pagination and the motivating use case (resolve a role name to the id used in role_ids) - Restore the house-style docblocks on RoleDTO/RoleRepository, including the @extends annotation phpstan needs - README: role accessor, Roles section, RoleDTO reference, delete table entry, admin permission note for integration tests; CHANGELOG and migration examples Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Wanted to add a user to Zammad with certain role_ids but couldn't get the defined roles.
This adds support for /api/v1/roles and presents them in $client->role()
Summary by CodeRabbit