RomanL 5 лет назад
Родитель
Сommit
879cf2f609

+ 1 - 1
modules/base/general/classes/BxBaseModGeneralGridAdministration.php

@@ -110,7 +110,7 @@ class BxBaseModGeneralGridAdministration extends BxTemplGrid
 
     protected function _getActionDelete($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
     {
-		if($this->_sManageType == BX_DOL_MANAGE_TOOLS_ADMINISTRATION && $this->_oModule->checkAllowedEditAnyEntry() !== CHECK_ACTION_RESULT_ALLOWED)
+		if($this->_sManageType == BX_DOL_MANAGE_TOOLS_ADMINISTRATION && !$this->_oModule->_isAdministrator())
 			return '';
 
     	return $this->_getActionDefault($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);

+ 35 - 1
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -1289,6 +1289,7 @@ class BxBaseModGeneralModule extends BxDolModule
         return $oMenu ? $oMenu->getCode() : false;
     }
 
+    
     /**
      * @page service Service Calls
      * @section bx_base_general Base General
@@ -2193,7 +2194,7 @@ class BxBaseModGeneralModule extends BxDolModule
     public function checkAllowedDelete (&$aDataEntry, $isPerformAction = false)
     {
         // moderator always has access
-        if ($this->_isModerator($isPerformAction))
+        if ($this->_isAdministrator($isPerformAction))
             return CHECK_ACTION_RESULT_ALLOWED;
 
         // check ACL
@@ -2243,6 +2244,14 @@ class BxBaseModGeneralModule extends BxDolModule
     	return $this->checkAllowedEditAnyEntryForProfile($isPerformAction, $this->_iProfileId);
     }
     
+    /**
+     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. So make sure to make strict(===) checking.
+     */
+    public function checkAllowedDeleteAnyEntry ($isPerformAction = false)
+    {
+    	return $this->checkAllowedDeleteAnyEntryForProfile($isPerformAction, $this->_iProfileId);
+    }
+    
     /**
      * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. So make sure to make strict(===) checking.
      */
@@ -2257,6 +2266,21 @@ class BxBaseModGeneralModule extends BxDolModule
 
     	return _t('_sys_txt_access_denied');
     }
+    
+    /**
+     * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. So make sure to make strict(===) checking.
+     */
+    public function checkAllowedDeleteAnyEntryForProfile ($isPerformAction = false, $iProfileId = false)
+    {
+        if(!$iProfileId)
+            $iProfileId = $this->_iProfileId;
+
+    	$aCheck = checkActionModule($iProfileId, 'delete any entry', $this->getName(), $isPerformAction);
+    	if($aCheck[CHECK_ACTION_RESULT] === CHECK_ACTION_RESULT_ALLOWED)
+    		return CHECK_ACTION_RESULT_ALLOWED;
+
+    	return _t('_sys_txt_access_denied');
+    }
 
     /**
      * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. So make sure to make "true === " checking.
@@ -2590,6 +2614,16 @@ class BxBaseModGeneralModule extends BxDolModule
     {
         return CHECK_ACTION_RESULT_ALLOWED === $this->checkAllowedEditAnyEntryForProfile ($isPerformAction, $iProfileId);
     }
+    
+    public function _isAdministrator ($isPerformAction = false)
+    {
+        return $this->_isAdministratorForProfile($isPerformAction, $this->_iProfileId);
+    }
+
+    public function _isAdministratorForProfile($isPerformAction = false, $iProfileId = false)
+    {
+        return CHECK_ACTION_RESULT_ALLOWED === $this->checkAllowedDeleteAnyEntryForProfile ($isPerformAction, $iProfileId);
+    }
 
     public function _prepareAuditParams($aContentInfo, $bIsSaveData = true, $aOverrideAuditParams  = array())
     {

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

@@ -108,7 +108,7 @@ class BxBaseModProfileGridAdministration extends BxBaseModGeneralGridAdministrat
 
 	protected function _getActionDeleteWithContent($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
     {
-		if($this->_sManageType == BX_DOL_MANAGE_TOOLS_ADMINISTRATION && $this->_oModule->checkAllowedEditAnyEntry() !== CHECK_ACTION_RESULT_ALLOWED)
+		if($this->_sManageType == BX_DOL_MANAGE_TOOLS_ADMINISTRATION && $this->_oModule->_isAdministrator() !== CHECK_ACTION_RESULT_ALLOWED)
 			return '';
 
     	return $this->_getActionDefault($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);