AntonLV 6 лет назад
Родитель
Сommit
e8901c1101

+ 1 - 1
modules/base/groups/classes/BxBaseModGroupsConfig.php

@@ -21,7 +21,7 @@ class BxBaseModGroupsConfig extends BxBaseModProfileConfig
             'profile-subscribe-add' => 'checkAllowedSubscribeAdd',
             'profile-subscribe-remove' => 'checkAllowedSubscribeRemove',
             'profile-actions-more' => 'checkAllowedViewMoreMenu',
-            'convos-compose' => 'checkAllowedContact',
+            'convos-compose' => 'checkAllowedCompose',
         );
     }
 }

+ 1 - 10
modules/base/groups/classes/BxBaseModGroupsModule.php

@@ -613,23 +613,14 @@ class BxBaseModGroupsModule extends BxBaseModProfileModule
     }
 
     /**
-     * @deprecated since version 11.0.1 use BxBaseModGroupsModule::checkAllowedCompose instead
      * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
      */
     public function checkAllowedCompose(&$aDataEntry, $isPerformAction = false)
-    {
-        return $this->checkAllowedContact($aDataEntry, $isPerformAction);
-    }
-
-    /**
-     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
-     */
-    public function checkAllowedContact($aDataEntry, $isPerformAction = false)
     {
         if(!$this->isFan($aDataEntry[$this->_oConfig->CNF['FIELD_ID']]))
             return _t('_sys_txt_access_denied');
 
-        return parent::checkAllowedContact($aDataEntry, $isPerformAction);
+        return parent::checkAllowedCompose ($aDataEntry, $isPerformAction);
     }
 
     /**

+ 2 - 2
modules/base/profile/classes/BxBaseModProfileConfig.php

@@ -31,8 +31,8 @@ class BxBaseModProfileConfig extends BxBaseModGeneralConfig
             'profile-subscribe-remove' => 'checkAllowedSubscribeRemove',
             'profile-actions-more' => 'checkAllowedViewMoreMenu',
             'profile-set-acl-level' => 'checkAllowedSetMembership',
-            'convos-compose' => 'checkAllowedContact',
-            'messenger' => 'checkAllowedContact',
+            'convos-compose' => 'checkAllowedCompose',
+            'messenger' => 'checkAllowedCompose',
         );        
     }
 }

+ 15 - 4
modules/base/profile/classes/BxBaseModProfileModule.php

@@ -1439,11 +1439,19 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
     }
 
     /**
-     * @deprecated since version 11.0.1 use BxBaseModProfileModule::checkAllowedCompose instead
+     * Compose differs from Contact. For example, a user should NOT be able to start conversation (compose) 
+     * with himself but he should be able to view conversation page where he is one of the participants.
+     * 
      * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden.
      */
-    public function checkAllowedCompose (&$aDataEntry, $isPerformAction = false)
+    public function checkAllowedCompose(&$aDataEntry, $isPerformAction = false)
     {
+        $CNF = &$this->_oConfig->CNF;
+
+        $oProfile = BxDolProfile::getInstanceByContentAndType($aDataEntry[$CNF['FIELD_ID']], $this->getName());
+        if($oProfile && $oProfile->id() == $this->_iProfileId)
+            return _t('_sys_txt_access_denied');
+
         return $this->checkAllowedContact($aDataEntry, $isPerformAction);
     }
 
@@ -1552,10 +1560,13 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
         if(!$iProfileId)
             $iProfileId = $this->_iProfileId;
 
-        // cannot contact myself
+        /*
+         * allow to 'contact myself'. It's needed to allow a user to view conversation page 
+         * where he is one of the participants.
+         */
         $oProfile = BxDolProfile::getInstanceByContentAndType($aDataEntry[$CNF['FIELD_ID']], $this->getName());
         if($oProfile && $oProfile->id() == $iProfileId)
-            return _t('_sys_txt_access_denied');
+            return CHECK_ACTION_RESULT_ALLOWED;
 
         // moderator always has access
         if($this->_isModeratorForProfile($isPerformAction, $iProfileId))

+ 6 - 1
modules/boonex/channels/classes/BxCnlModule.php

@@ -464,7 +464,12 @@ class BxCnlModule extends BxBaseModGroupsModule
         }
         return $a;
     }
-    
+
+    public function checkAllowedCompose(&$aDataEntry, $isPerformAction = false)
+    {
+        return _t('_sys_txt_access_denied');
+    }
+
     public function checkAllowedContact($aDataEntry, $isPerformAction = false)
     {
         return _t('_sys_txt_access_denied');

+ 5 - 0
modules/boonex/organizations/classes/BxOrgsModule.php

@@ -79,6 +79,11 @@ class BxOrgsModule extends BxBaseModGroupsModule
         $oAccount->updateProfileContextAuto();
     }
 
+    public function checkAllowedCompose (&$aDataEntry, $isPerformAction = false)
+    {
+        return BxBaseModProfileModule::checkAllowedCompose ($aDataEntry, $isPerformAction);
+    }
+
     public function checkAllowedContact($aDataEntry, $isPerformAction = false)
     {
         return BxBaseModProfileModule::checkAllowedContact($aDataEntry, $isPerformAction);