Kaynağa Gözat

Ticket #3634 - Don't allow to create new profiles when user is switched to another not own profile.

AntonLV 4 yıl önce
ebeveyn
işleme
20a96cfe5f

+ 7 - 3
inc/classes/BxDolAccount.php

@@ -730,11 +730,15 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
     static public function isAllowedCreateMultiple ($iProfileId, $isPerformAction = false)
     {
         $bResult = false;
-        if ((int)getParam('sys_account_limit_profiles_number') != 1)
+        if((int)getParam('sys_account_limit_profiles_number') != 1)
             $bResult = true;
-        
+
+        $oProfile = BxDolProfile::getInstance($iProfileId);
+        if($oProfile && $oProfile->getAccountId() != getLoggedId())
+            $bResult = false;
+
         bx_alert('profile', 'allow_create_another_profile', $iProfileId, 0, array('override_result' => &$bResult));
-        
+
         return $bResult;
     }
 

+ 5 - 1
template/scripts/BxBaseMenuProfileAdd.php

@@ -19,8 +19,12 @@ class BxBaseMenuProfileAdd extends BxTemplMenu
 
     public function getCode ()
     {
+        $oProfile = BxDolProfile::getInstance();
+        if($oProfile && !BxDolAccount::isAllowedCreateMultiple($oProfile->id()))
+            return '';
+
         $oAccount = BxDolAccount::getInstance();
-        if ($oAccount && $oAccount->isProfilesLimitReached())
+        if($oAccount && $oAccount->isProfilesLimitReached())
             return '';
 
         return parent::getCode ();