Skip to content

Commit a42ea59

Browse files
committed
[fix] Compare UUID values in password permission check #487
After switching the users API detail routes to uuid converters, ChangePasswordView receives a UUID object in kwargs['pk'] instead of a string. The self-password permission check was still comparing str(self.request.user.id) to that UUID, which broke self password changes and caused API test regressions. Compare UUID values directly so self-password requests keep using the intended IsAuthenticated permission path. Refs #487
1 parent 559e766 commit a42ea59

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

openwisp_users/api/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def get_permissions(self):
158158
class if loggedin user wants to change
159159
his own password.
160160
"""
161-
if str(self.request.user.id) == self.kwargs["pk"]:
161+
if self.request.user.id == self.kwargs["pk"]:
162162
self.permission_classes = [IsAuthenticated]
163163
else:
164164
self.permission_classes = [IsAuthenticated, DjangoModelPermissions]

0 commit comments

Comments
 (0)