Kaynağa Gözat

Ticket #5235 - System: Follow button is available for the guests.

AntonLV 1 yıl önce
ebeveyn
işleme
ddc31c98c6

+ 25 - 0
inc/classes/BxDolConnection.php

@@ -240,6 +240,13 @@ class BxDolConnection extends BxDolFactory implements iBxDolFactoryObject
 
         return $aResult['code'] == 0 ? CHECK_ACTION_RESULT_ALLOWED : $aResult['message'];
     }
+    
+    public function checkAllowedConnectByAcl ($iInitiator, $iContent, $isPerformAction = false)
+    {
+        $aResult = $this->_checkAllowedConnectByAcl($iInitiator, $iContent, $isPerformAction);
+
+        return $aResult['code'] == 0 ? CHECK_ACTION_RESULT_ALLOWED : $aResult['message'];
+    }
 
     public function checkAllowedAddConnection ($iInitiator, $iContent, $isPerformAction = false, $isMutual = false, $isInvertResult = false, $isSwap = false, $isCheckExists = true)
     {
@@ -1185,6 +1192,24 @@ class BxDolConnection extends BxDolFactory implements iBxDolFactoryObject
         return ['code' => $iCode, 'message' => $sMessage != '' ? $sMessage : null];
     }
 
+    protected function _checkAllowedConnectByAcl ($iInitiator, $iContent, $isPerformAction = false)
+    {
+        $sErr = _t('_sys_txt_access_denied');
+
+        if(!$iInitiator || !$iContent || $iInitiator == $iContent)
+            return ['code' => 1, 'message' => $sErr];
+
+        $oInitiator = BxDolProfile::getInstance($iInitiator);
+        if(!$oInitiator || !BxDolProfile::getInstance($iContent))
+            return ['code' => 2, 'message' => $sErr];
+
+        // check ACL
+        if(($mixedResult = $this->_checkAllowedConnectInitiator($oInitiator, $isPerformAction)) !== CHECK_ACTION_RESULT_ALLOWED)
+            return ['code' => 3, 'message' => $mixedResult];
+
+        return ['code' => 0];
+    }
+
     protected function _checkAllowedConnectInitiator ($oInitiator, $isPerformAction = false)
     {
         $aCheck = checkActionModule($oInitiator->id(), 'connect', 'system', $isPerformAction);

+ 1 - 1
modules/base/profile/classes/BxBaseModProfileModule.php

@@ -2106,7 +2106,7 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
         if(($sMsg = $this->checkAllowedView($aDataEntry)) !== CHECK_ACTION_RESULT_ALLOWED)
             return $sMsg;
 
-        return CHECK_ACTION_RESULT_ALLOWED;
+        return $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, ['sys_profiles_subscriptions', 'checkAllowedConnectByAcl'], false, false);
     }
 
     /**