Commit fc26a2e8d1377ef2ac3a430a0f0b0ef9f24d7220
1 parent
650cfd59
merge in 5980:5982 from RELEASE_3_1_BRANCH
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5983 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
16 additions
and
4 deletions
lib/users/User.inc
| @@ -315,10 +315,20 @@ class User extends KTEntity { | @@ -315,10 +315,20 @@ class User extends KTEntity { | ||
| 315 | $this->update(); | 315 | $this->update(); |
| 316 | if (KTPluginUtil::pluginIsActive('ktdms.wintools')) { | 316 | if (KTPluginUtil::pluginIsActive('ktdms.wintools')) { |
| 317 | require_once(KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php'); | 317 | require_once(KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php'); |
| 318 | - BaobabKeyUtil::deallocate($this); | 318 | + BaobabKeyUtil::deallocateUser($this); |
| 319 | } | 319 | } |
| 320 | return; | 320 | return; |
| 321 | } | 321 | } |
| 322 | + | ||
| 323 | + function enable() { | ||
| 324 | + $this->setDisabled(false); | ||
| 325 | + $this->update(); | ||
| 326 | + if (KTPluginUtil::pluginIsActive('ktdms.wintools')) { | ||
| 327 | + require_once(KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php'); | ||
| 328 | + BaobabKeyUtil::allocateUser($this); | ||
| 329 | + } | ||
| 330 | + return; | ||
| 331 | + } | ||
| 322 | 332 | ||
| 323 | function create() { | 333 | function create() { |
| 324 | if (KTPluginUtil::pluginIsActive('ktdms.wintools')) { | 334 | if (KTPluginUtil::pluginIsActive('ktdms.wintools')) { |
plugins/ktcore/admin/userManagement.php
| @@ -635,9 +635,11 @@ class KTUserAdminDispatcher extends KTAdminDispatcher { | @@ -635,9 +635,11 @@ class KTUserAdminDispatcher extends KTAdminDispatcher { | ||
| 635 | function do_change_enabled() { | 635 | function do_change_enabled() { |
| 636 | $this->startTransaction(); | 636 | $this->startTransaction(); |
| 637 | $iLicenses = 0; | 637 | $iLicenses = 0; |
| 638 | + $bRequireLicenses = false; | ||
| 638 | if (KTPluginUtil::pluginIsActive('ktdms.wintools')) { | 639 | if (KTPluginUtil::pluginIsActive('ktdms.wintools')) { |
| 639 | require_once(KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php'); | 640 | require_once(KT_DIR . '/plugins/wintools/baobabkeyutil.inc.php'); |
| 640 | $iLicenses = BaobabKeyUtil::getLicenseCount(); | 641 | $iLicenses = BaobabKeyUtil::getLicenseCount(); |
| 642 | + $bRequireLicenses = true; | ||
| 641 | } | 643 | } |
| 642 | // admin and anonymous are automatically ignored here. | 644 | // admin and anonymous are automatically ignored here. |
| 643 | $iEnabledUsers = User::getNumberEnabledUsers(); | 645 | $iEnabledUsers = User::getNumberEnabledUsers(); |
| @@ -645,7 +647,7 @@ class KTUserAdminDispatcher extends KTAdminDispatcher { | @@ -645,7 +647,7 @@ class KTUserAdminDispatcher extends KTAdminDispatcher { | ||
| 645 | foreach(KTUtil::arrayGet($_REQUEST, 'disable_user', array()) as $sUserId => $v) { | 647 | foreach(KTUtil::arrayGet($_REQUEST, 'disable_user', array()) as $sUserId => $v) { |
| 646 | $oUser = User::get((int)$sUserId); | 648 | $oUser = User::get((int)$sUserId); |
| 647 | if(PEAR::isError($oUser)) { $this->errorRedirectToMain(_kt('Error getting user object')); } | 649 | if(PEAR::isError($oUser)) { $this->errorRedirectToMain(_kt('Error getting user object')); } |
| 648 | - $oUser->setDisabled(True); | 650 | + $oUser->disable(); |
| 649 | $res = $oUser->update(); | 651 | $res = $oUser->update(); |
| 650 | if(PEAR::isError($res)) { $this->errorRedirectToMain(_kt('Error updating user')); } | 652 | if(PEAR::isError($res)) { $this->errorRedirectToMain(_kt('Error updating user')); } |
| 651 | $iEnabledUsers--; | 653 | $iEnabledUsers--; |
| @@ -653,7 +655,7 @@ class KTUserAdminDispatcher extends KTAdminDispatcher { | @@ -653,7 +655,7 @@ class KTUserAdminDispatcher extends KTAdminDispatcher { | ||
| 653 | 655 | ||
| 654 | foreach(KTUtil::arrayGet($_REQUEST, 'enable_user', array()) as $sUserId => $v) { | 656 | foreach(KTUtil::arrayGet($_REQUEST, 'enable_user', array()) as $sUserId => $v) { |
| 655 | // check that we haven't hit max user limit | 657 | // check that we haven't hit max user limit |
| 656 | - if($iLicenses !== 0 && $iEnabledUsers >= $iLicenses) { | 658 | + if($bRequireLicenses && $iEnabledUsers >= $iLicenses) { |
| 657 | // if so, add to error messages, but commit transaction (break this loop) | 659 | // if so, add to error messages, but commit transaction (break this loop) |
| 658 | $_SESSION['KTErrorMessage'][] = _kt('You may only have ') . $iLicenses . _kt(' users enabled at one time.'); | 660 | $_SESSION['KTErrorMessage'][] = _kt('You may only have ') . $iLicenses . _kt(' users enabled at one time.'); |
| 659 | break; | 661 | break; |
| @@ -662,7 +664,7 @@ class KTUserAdminDispatcher extends KTAdminDispatcher { | @@ -662,7 +664,7 @@ class KTUserAdminDispatcher extends KTAdminDispatcher { | ||
| 662 | // else enable user | 664 | // else enable user |
| 663 | $oUser = User::get((int)$sUserId); | 665 | $oUser = User::get((int)$sUserId); |
| 664 | if(PEAR::isError($oUser)) { $this->errorRedirectToMain(_kt('Error getting user object')); } | 666 | if(PEAR::isError($oUser)) { $this->errorRedirectToMain(_kt('Error getting user object')); } |
| 665 | - $oUser->setDisabled(False); | 667 | + $oUser->enable(); |
| 666 | $res = $oUser->update(); | 668 | $res = $oUser->update(); |
| 667 | if(PEAR::isError($res)) { $this->errorRedirectToMain(_kt('Error updating user')); } | 669 | if(PEAR::isError($res)) { $this->errorRedirectToMain(_kt('Error updating user')); } |
| 668 | $iEnabledUsers++; | 670 | $iEnabledUsers++; |