jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373709 )

Change subject: Guard against LDAP modify with no changes for maintainers
......................................................................


Guard against LDAP modify with no changes for maintainers

LDAP gets angry when you tell it that you are updating a collection but
the collection actually does not change. Check to ensure that the list
of maintainers for a tool has actually changed before saving to the
directory.

Change-Id: I06758d77f86fa14ffcb1f56aebe8ac9c2153122b
---
M striker/tools/views/tool.py
1 file changed, 11 insertions(+), 4 deletions(-)

Approvals:
  BryanDavis: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/striker/tools/views/tool.py b/striker/tools/views/tool.py
index 8cc44ba..bf2e309 100644
--- a/striker/tools/views/tool.py
+++ b/striker/tools/views/tool.py
@@ -168,6 +168,13 @@
                     form.cleaned_data['tools']
                 )
             )
+
+            # LDAP doesn't like it when we change the list to be the same
+            # list, so make sure there is some delta before saving
+            if old_members == new_members:
+                messages.warning(req, _('Maintainers unchanged'))
+                return shortcuts.redirect(tool.get_absolute_url())
+
             tool.members = new_members
             tool.save()
 
@@ -186,8 +193,8 @@
                 else:
                     # Add user to the mirrored group
                     added.groups.add(maintainers.id)
-                    # Do not set tool as the notification target because the
-                    # framework does not understand LDAP models.
+                    # Do not set tool as the notification target because
+                    # the framework does not understand LDAP models.
                     notify.send(
                         recipient=added,
                         sender=req.user,
@@ -216,8 +223,8 @@
                 else:
                     # Add user to the mirrored group
                     removed.groups.remove(maintainers.id)
-                    # Do not set tool as the notification target because the
-                    # framework does not understand LDAP models.
+                    # Do not set tool as the notification target because
+                    # the framework does not understand LDAP models.
                     notify.send(
                         recipient=removed,
                         sender=req.user,

-- 
To view, visit https://gerrit.wikimedia.org/r/373709
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I06758d77f86fa14ffcb1f56aebe8ac9c2153122b
Gerrit-PatchSet: 1
Gerrit-Project: labs/striker
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to