-
rksuma@Ramakrishnans-MacBook-Pro sztab % git checkout -b feature/REST-API-access-controls-based-on-internal-external-user-classification Switched to a new branch 'feature/REST-API-access-controls-based-on-internal-external-user-classification' rksuma@Ramakrishnans-MacBook-Pro sztab %
| Type |
New Feature
|
| Priority |
Normal
|
| Assignee | |
| Version |
1.9.2
|
| Sprints |
n/a
|
| Customer |
n/a
|
Issue Votes (0)
Relates to: SZ-76 (Support for guests and community/customer users)
Summary
Implement server-side enforcement of permissions based on
user_type, restricting external users (CUSTOMER, PARTNER, GUEST, COMMUNITY) to a defined set of read and limited write operations across the REST API.Builds on the
user_typefield, comment visibility controls, and watermark UI delivered in 1.9.x. This issue closes the gap where an external user with a valid account could currently perform any operation an internal team member can.Background
The
userstable already carries auser_typecolumn (INTERNAL, CUSTOMER, PARTNER, GUEST, COMMUNITY) introduced in V06. Comment visibility is already filtered server-side based on this value. However, no other API endpoints currently checkuser_type, meaning an external user can create issues, merge pull requests, and delete repositories.Permitted operations for external users
Implementation
New component:
ExternalUserPolicyA single Spring
@Componentthat is the sole enforcement point across all controllers. No inlineuser_typechecks scattered through business logic.IssueUpdateDtoAdd an overloaded
applyTo(Issue, UserType)method. For external callers only thepriorityfield is applied; all other fields in the request body are silently ignored. Internal callers delegate to the existingapplyTo(Issue)— no behaviour change.Controllers updated
IssueControllerPOST /api/issues— blocked for external usersGET /api/issues,GET /api/issues/{id},GET /api/issues/by-key/{key}— allowed,requesterTypethreaded through toIssueDto.fromEntity(fixes comment visibility drift introduced since the original implementation)PATCH /api/issues/{id}— allowed, but delegates to priority-onlyapplyTooverloadDELETE /api/issues/{id}— blocked for external usersGET /api/issues/{id}/comments— allowed,requesterTypeappliedPOST /api/issues/{id}/comments— allowed (visibility enforcement already in place)PullRequestControllerPOST /api/pullrequests— blockedPUT /api/pullrequests/{id}— blockedPOST /api/pullrequests/{id}/merge— blockedPOST /api/pullrequests/{prId}/reviews— blockedPUT /api/pullrequests/{prId}/comments/{commentId}— blockedGETendpoints — allowed unchangedGitRepoControllerPOST /api/repos— blockedDELETE /api/repos/{id}— blockedGETendpoints — allowed unchangedOut of scope
The following are tracked separately under the GitHub-style authorisation design issue:
Acceptance criteria
403 Forbiddenon any blocked endpoint regardless of other role assignmentsPATCH /api/issues/{id}with a body containingseverity,status, andpriority— onlypriorityis applied; severity and status unchangeduser_typechecks exist outsideExternalUserPolicyTime estimate
ExternalUserPolicycomponent +IssueUpdateDtooverloadIssueController— 7 methods updated, requesterType drift fixedPullRequestController— 5 write endpoints blockedGitRepoController— 2 write endpoints blocked