SiT! Bugs

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001424SiT!LDAPpublic2010-12-05 03:342013-07-06 17:15
Reporterjohng 
Assigned Topaulh 
PrioritynormalSeverityminorReproducibilitysometimes
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version3.62 LTS 
Target Version3.68Fixed in VersionCurrent SVN 
Summary0001424: LDAP service tries to disable a customer who is already disabled and fails
DescriptionIf a customer account in LDAP is disabled, SIT will try to repeatedly disable the account.
Tagspatch
Attached Files

- Relationships
duplicate of 0001399closedpaulh ldap_logindisabledattribute produces call of non-object in auto.php 
related to 0001843resolvedpaulh LDAP-Sync: Disabling of contacts fails 

-  Notes
(0003498)
johng (reporter)
2010-12-05 03:35

Solution:

# svn diff *
Index: auto.php
===================================================================
--- auto.php (revision 7)
+++ auto.php (working copy)
@@ -944,7 +944,9 @@
                                 if (strtolower($contact_attributes[$CONFIG['ldap_logindisabledattribute']][0]) == strtolower($CONFIG['ldap_logindisabledvalue']))
                                 {
                                     // We want to disable
- $sit_db_contacts[$contact_attributes[$CONFIG['ldap_userattribute']][0]]->disable();
+ if ($sit_db_contacts[$contact_attributes[$CONFIG['ldap_userattribute']][0]]) {
+ $sit_db_contacts[$contact_attributes[$CONFIG['ldap_userattribute']][0]]->disable();
+ }
                                 }
                             }
                         }
@@ -968,7 +970,7 @@
                 // TODO reassign incidents?
                 foreach ($sit_db_contacts AS $c)
                 {
- debug_log ("Disabling {$c->username}", TRUE);
+ debug_log ("Disabling {$c->username} because they don't exist in LDAP", TRUE);
                     $c->disable();
                 }
             }
Index: lib/classes.inc.php
===================================================================
--- lib/classes.inc.php (revision 7)
+++ lib/classes.inc.php (working copy)
@@ -491,19 +495,24 @@
         $toReturn = true;
         if (!empty($this->id))
         {
- $sql = "UPDATE `{$GLOBALS['dbContacts']}` SET active = 'false' WHERE id = {$this->id}";
-
- $result = mysql_query($sql);
- if (mysql_error()) trigger_error(mysql_error(),E_USER_WARNING);
- if (mysql_affected_rows() != 1)
- {
- trigger_error("Failed to disable contact {$this->username}", E_USER_WARNING);
- $toReturn = false;
- }
- else
- {
- $toReturn = true;
- }
+ $sql = "SELECT 1 FROM `{$GLOBALS['dbContacts']}` WHERE id = {$this->id} AND active = 'false'";
+ $result = mysql_query($sql);
+ if (mysql_error()) trigger_error(mysql_error(),E_USER_WARNING);
+ if (mysql_fetch_array($result,MYSQL_NUM)) {
+ debug_log("Failed to disable contact {$this->username}, was already disabled");
+ }
+ else
+ {
+ $sql = "UPDATE `{$GLOBALS['dbContacts']}` SET active = 'false' WHERE id = {$this->id}";
+
+ $result = mysql_query($sql);
+ if (mysql_error()) trigger_error(mysql_error(),E_USER_WARNING);
+ if (mysql_affected_rows() != 1)
+ {
+ trigger_error("Failed to disable contact {$this->username}", E_USER_WARNING);
+ $toReturn = false;
+ }
+ }
         }

         return $toReturn;
User avatar (0003563)
ivan (administrator)
2011-02-10 09:46

Thanks johng
User avatar (0003564)
paulh (administrator)
2011-02-10 09:59

Looks like I merged some of this patch in http://gitorious.org/sit/paulheaneys-sit/commit/b0c685f [^] (see linked bug)
User avatar (0003603)
paulh (administrator)
2011-02-14 21:33

Confirm second issue about sync task becoming disabled
User avatar (0004726)
paulh (administrator)
2013-03-02 13:19

current svn resolves this, see associated bugs

- Issue History
Date Modified Username Field Change
2010-12-05 03:34 johng New Issue
2010-12-05 03:35 johng Note Added: 0003498
2011-02-10 09:46 ivan Tag Attached: patch
2011-02-10 09:46 ivan Note Added: 0003563
2011-02-10 09:46 ivan Status new => acknowledged
2011-02-10 09:59 paulh Relationship added duplicate of 0001399
2011-02-10 09:59 paulh Note Added: 0003564
2011-02-14 21:33 paulh Assigned To => paulh
2011-02-14 21:33 paulh Status acknowledged => assigned
2011-02-14 21:33 paulh Note Added: 0003603
2013-03-01 19:48 paulh Relationship added related to 0001843
2013-03-02 13:19 paulh Note Added: 0004726
2013-03-02 13:19 paulh Status assigned => resolved
2013-03-02 13:19 paulh Resolution open => fixed
2013-03-02 13:19 paulh Fixed in Version => Current SVN
2013-07-06 17:15 ivan Target Version => 3.68


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker