citizenlab icon indicating copy to clipboard operation
citizenlab copied to clipboard

TAN-852 - Permissions service refactor

Open jamesspeake opened this issue 1 year ago • 3 comments

A refactor from 2 services with too many methods and mixed focus:

  • PermissionsService
    • ParticipationPermissionsService

To 4 services - namespaced in Permissions:::

  • PermissionsUpdateService - Dedicated to updating permissions
  • UserRequirementsService - Just the logic for return flexible registration requirements
  • PermissionsService - All logic for whether access to a resource should be allowed/denied - now with many fewer methods
  • ActionDescriptorsService - Generate the action descriptors - instead of doing this in the serializer

Further documentation can be found here - https://www.notion.so/citizenlab/Permissions-service-d0e193dc551949a3bdc60dd0c500d75d

jamesspeake avatar May 08 '24 07:05 jamesspeake

Warnings
:warning: The PR title contains no Jira issue key (case-sensitive)
:warning: The branch name contains no Jira issue key (case-sensitive)
Messages
:book: Changelog provided 🎉
:book:

Run the e2e tests

:book: Check translation progress

Generated by :no_entry_sign: dangerJS against bc13dbecaba584a2730fcc6f26785bc79f8be24a

cl-dev-bot avatar May 08 '24 07:05 cl-dev-bot

@alexander-cit Thoughts on your comments - this is how I might use inheritance which might be clearer:

BasePermissionsService - 2 methods denied_reason_for_action & action_descriptors - all other classes then inherit and extend these methods

  • PhasePermissionsService
    • ProjectPermissionsService
      • IdeaPermissionsService

Initiatives would just use BasePermissionsService

jamesspeake avatar May 13 '24 12:05 jamesspeake