浏览代码

#988 Could not change the case of a login (cosmetic improvement to make sure this piece of code is the right example that can be shared amongst the developpers community)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3342 a333f486-631f-4898-b8df-5754b55c2be0
romainq 10 年之前
父节点
当前提交
76edd219e4
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      core/userrights.class.inc.php

+ 4 - 1
core/userrights.class.inc.php

@@ -238,6 +238,10 @@ abstract class User extends cmdbAbstractObject
 			{
 				$sNewLogin = $aChanges['login'];
 				$oSearch = DBObjectSearch::FromOQL_AllData("SELECT User WHERE login = :newlogin");
+				if (!$this->IsNew())
+				{
+					$oSearch->AddCondition('id', $this->GetKey(), '!=');
+				}
 				$oSet = new DBObjectSet($oSearch, array(), array('newlogin' => $sNewLogin));
 				if ($oSet->Count() > 0)
 				{
@@ -251,7 +255,6 @@ abstract class User extends cmdbAbstractObject
 		{
 			$this->m_aCheckIssues[] = Dict::Format('Class:User/Error:AtLeastOneProfileIsNeeded');
 		}
-		
 	}
 
 	function GetGrantAsHtml($sClass, $iAction)