Repository navigation
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff itself looks correct and is a good security/permission fix: a read-only
GETshould requirePORTAL_READ, notPORTAL_EDIT. No syntax or obvious functional irregularity is introduced by this change.Things to verify:
@has_permissionssemanticsPORTAL_READandADMINare both required. That may be intentional, but confirm it does not accidentally restrict access to admins only.ADMINbypassesPORTAL_READ. Confirm that is acceptable.PermissionConstants.PORTAL_READexists and is registeredRead permission is sufficient
PortalSerializer().one()should be truly read-only. If it has side effects such as writes, cache invalidation, audit logging, or lazy creation, thenPORTAL_READmay be semantically wrong.Sensitive data exposure
PORTAL_READare allowed to see all fields returned byPortalSerializer.Tests
Add/update tests for:
PORTAL_READaccessPORTAL_EDITdeniedOptimization suggestions, if applicable:
PortalSerializer().one()is called frequently and returns a singleton portal configuration, consider caching it.select_related/prefetch_relatedto avoid N+1 queries.@extend_schema.Overall: the change is appropriate. The main risk is only in the exact semantics of
@has_permissionsand whether mixingPORTAL_READwithRoleConstants.ADMINmatches the intended access policy.