Răsfoiți Sursa

#846 Privacy isn't working correctly in profile based modules

Alex Trofimov 9 ani în urmă
părinte
comite
558261c25b

+ 6 - 1
inc/classes/BxDolPrivacy.php

@@ -241,7 +241,7 @@ class BxDolPrivacy extends BxDolFactory implements iBxDolFactoryObject
         if(empty($iViewerId))
             $iViewerId = (int)bx_get_logged_profile_id();
 
-        $aObject = $this->_oDb->getObjectInfo($this->convertActionToField($this->_aObject['action']), $iObjectId);
+        $aObject = $this->getObjectInfo($this->convertActionToField($this->_aObject['action']), $iObjectId);
         if(empty($aObject) || !is_array($aObject))
             return false;
 
@@ -288,6 +288,11 @@ class BxDolPrivacy extends BxDolFactory implements iBxDolFactoryObject
         $this->_oDb->init($this->_aObject);
     }
 
+    protected function getObjectInfo($sAction, $iObjectId)
+    {
+        return $this->_oDb->getObjectInfo($sAction, $iObjectId);
+    }
+
 	protected function getPrivacyGroupsForContentPublic($iProfileIdOwner = 0, $aCustomGroups = array())
     {
     	$aGroups = array(BX_DOL_PG_ALL);

+ 5 - 0
modules/base/groups/classes/BxBaseModGroupsPrivacy.php

@@ -62,6 +62,11 @@ class BxBaseModGroupsPrivacy extends BxBaseModProfilePrivacy
 
         return parent::getGroupChooser($sObject, $iOwnerId, $aParams);
     }
+
+    protected function getObjectInfo($sAction, $iObjectId)
+    {
+        return BxDolPrivacy::getObjectInfo($sAction, $iObjectId);
+    }
 }
 
 /** @} */

+ 11 - 0
modules/base/profile/classes/BxBaseModProfilePrivacy.php

@@ -33,6 +33,17 @@ class BxBaseModProfilePrivacy extends BxTemplPrivacy
     {
         return $this->_aPrivacyParticallyVisible;
     }
+
+    protected function getObjectInfo($sAction, $iObjectId)
+    {
+        $a = $this->_oDb->getObjectInfo($sAction, $iObjectId);
+        $oProfile = BxDolProfile::getInstanceByContentAndType($iObjectId, $this->MODULE);
+        if (!$oProfile)
+            return false;
+
+        $a['owner_id'] = $oProfile->id();        
+        return $a;
+    }
 }
 
 /** @} */