diff --git a/program/serializers.py b/program/serializers.py index 140b02d3c5132863776f58b0d72a32342cf7b1ce..1f17d0de10095af575e2ebc2f73697de243a6aa2 100644 --- a/program/serializers.py +++ b/program/serializers.py @@ -434,16 +434,16 @@ class ProfileSerializer(serializers.ModelSerializer): user_permissions = set( permission.split("__")[-1] for permission in user.get_all_permissions() - if permission.startswith("program.edit__host") + if permission.startswith("program.edit__profile") ) update_fields = set(validated_data.keys()) - # having the update_host permission overrides the ownership - if not (user.has_perm("program.update_host") or (user_is_owner and user_permissions)): + # having the update_profile permission overrides the ownership + if not (user.has_perm("program.update_profile") or (user_is_owner and user_permissions)): raise exceptions.PermissionDenied(detail="You are not allowed to update this host.") - # without the update_host permission, fields without edit permission are not allowed - if not user.has_perm("program.update_host") and ( + # without the update_profile permission, fields without edit permission are not allowed + if not user.has_perm("program.update_profile") and ( not_allowed := update_fields.difference(user_permissions) ): detail = {field: "You are not allowed to edit this field" for field in not_allowed}