Browse Source

修改由于array_search使用不当造成的对数组首位的用户识别错误问题

docker-svn
witersen 3 years ago
parent
commit
fbb3fe480c
  1. 8
      02.php/app/controller/svngroup.class.php
  2. 2
      02.php/app/controller/svnrep.class.php
  3. 2
      02.php/app/function/svnUser.function.php

8
02.php/app/controller/svngroup.class.php

@ -430,10 +430,10 @@ class svngroup extends controller
$userGroupListBack = $userGroupList; $userGroupListBack = $userGroupList;
foreach ($userGroupList as $group1) { foreach ($userGroupList as $group1) {
$newList = FunGetSvnGroupGroupList($authzContent, $group1); $newList = FunGetSvnGroupGroupList($authzContent, $group1);
foreach ($leftGroupList as $group2) { foreach ($leftGroupList as $key2 => $group2) {
if (in_array($group2, $newList)) { if (in_array($group2, $newList)) {
array_push($userGroupList, $group2); array_push($userGroupList, $group2);
unset($leftGroupList[array_search($group2, $leftGroupList)]); unset($leftGroupList[$key2]);
} }
} }
} }
@ -475,10 +475,10 @@ class svngroup extends controller
$userGroupListBack = $groupGroupList; $userGroupListBack = $groupGroupList;
foreach ($groupGroupList as $group1) { foreach ($groupGroupList as $group1) {
$newList = FunGetSvnGroupGroupList($authzContent, $group1); $newList = FunGetSvnGroupGroupList($authzContent, $group1);
foreach ($leftGroupList as $group2) { foreach ($leftGroupList as $key2 => $group2) {
if (in_array($group2, $newList)) { if (in_array($group2, $newList)) {
array_push($groupGroupList, $group2); array_push($groupGroupList, $group2);
unset($leftGroupList[array_search($group2, $leftGroupList)]); unset($leftGroupList[$key2]);
} }
} }
} }

2
02.php/app/controller/svnrep.class.php

@ -365,7 +365,7 @@ class svnrep extends controller
if ($svnUserPass == '0') { if ($svnUserPass == '0') {
FunMessageExit(200, 0, '文件格式错误(不存在[users]标识)'); FunMessageExit(200, 0, '文件格式错误(不存在[users]标识)');
} else if ($svnUserPass == '1') { } else if ($svnUserPass == '1') {
FunMessageExit(200, 0, '用户不存在'); FunMessageExit(200, 0, '用户不存在'.$this->globalUserName);
} }
//检查权限 //检查权限

2
02.php/app/function/svnUser.function.php

@ -226,7 +226,7 @@ function FunGetPassByUser($passwdContent, $userName, $isDisabledUser = false)
preg_match_all(sprintf(REG_PASSWD_USER_PASSWD, REG_SVN_USER_DISABLED), $passwdContentPreg[1][0], $resultPreg); preg_match_all(sprintf(REG_PASSWD_USER_PASSWD, REG_SVN_USER_DISABLED), $passwdContentPreg[1][0], $resultPreg);
array_walk($resultPreg[1], 'FunArrayValueTrim'); array_walk($resultPreg[1], 'FunArrayValueTrim');
array_walk($resultPreg[3], 'FunArrayValueTrim'); array_walk($resultPreg[3], 'FunArrayValueTrim');
if (array_search($userName, $resultPreg[1])) { if (array_search($userName, $resultPreg[1]) !== false) {
return $resultPreg[3][array_search($userName, $resultPreg[1])]; return $resultPreg[3][array_search($userName, $resultPreg[1])];
} else { } else {
return '1'; return '1';

Loading…
Cancel
Save