Sluggo-Issue-Tracker / Sluggo-API

Sluggo, a flexible issue tracker for teams. Backend server developed with Django and Django REST Framework
Apache License 2.0
7 stars 1 forks source link

Tdimhcsleumas/dj rest auth #8

Closed tdimhcsleumas closed 4 years ago

tdimhcsleumas commented 4 years ago

Once again I am reminded that I need to make another branch. Maybe next time. Permissions are being revamped making use of the fact that most of our records will have a team reference somewhere.

Changes to permissions:

Permissions inheriting from BaseMemberPermission should only be used with tables that reference a team. These permissions calculate the member primary key from the team.id and username pair in order to retrieve a member record where the permission classes can do further processing.

MemberViewSet now inherits from mixins. This is so that the endpoints requiring the same level of permission are defined by the permission_classes. Endpoints that require a different set of permissions are defined with the @action decorator similar to bottle. With these changes:

  1. creation of member records requires only that the user is authenticated
  2. reading member list / detailed record is only allowed for team members
  3. approving members is only allowed for admins
  4. updating the member profile is only allowed for the owner of that record
  5. we are using a custom deactivate endpoint rather than a hard deletion