Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed issue #17095 : Error of Class 'LimeSurvey\PluginManager\CHttpEx…
…ception' not found

Dev: remove Permission check
  • Loading branch information
Shnoulle committed Feb 16, 2021
1 parent bb02d30 commit 9cbf24f
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions application/libraries/PluginManager/PluginBase.php
Expand Up @@ -2,8 +2,6 @@

namespace LimeSurvey\PluginManager;

use Permission;

/**
* Base class for plugins.
*/
Expand Down Expand Up @@ -64,7 +62,12 @@ abstract class PluginBase implements iPlugin
public $config = null;

/**
* List of allowed public method, null mean all metod are allowed. Else method must be in the list
* List of allowed public method, null mean all method are allowed.
* Else method must be in the list.
* Used in public controller :
* - PluginHelper::ajax (admin/pluginhelper&sa=ajax)
* - PluginHelper::fullpagewrapper (admin/pluginhelper&sa=fullpagewrapper)
* - PluginHelper::sidebody (admin/pluginhelper&sa=sidebody)
* @var string[]|null
*/
public $allowedPublicMethods = null;
Expand Down Expand Up @@ -170,9 +173,6 @@ public function getId()
*/
public function getPluginSettings($getValues = true)
{
if(!Permission::model()->hasGlobalPermission('settings','read')) {
throw new CHttpException(403);
}
$settings = $this->settings;
foreach ($settings as $name => &$setting) {
if ($getValues) {
Expand Down Expand Up @@ -258,9 +258,6 @@ protected function registerSetting($name, $options = array('type' => 'string'))
*/
public function saveSettings($settings)
{
if(!Permission::model()->hasGlobalPermission('settings','update')) {
throw new CHttpException(403);
}
foreach ($settings as $name => $setting) {
$this->set($name, $setting);
}
Expand Down Expand Up @@ -557,18 +554,18 @@ protected function registerScript($relativePathToScript, $parentPlugin = null)
$scriptToRegister = null;
if (file_exists(YiiBase::getPathOfAlias('userdir').'/plugins/'.$parentPlugin.'/'.$relativePathToScript)) {
$scriptToRegister = Yii::app()->getAssetManager()->publish(
YiiBase::getPathOfAlias('userdir').'/plugins/'.$parentPlugin.'/'.$relativePathToScript
\Yii::::getPathOfAlias('userdir').'/plugins/'.$parentPlugin.'/'.$relativePathToScript
);
} elseif (file_exists(Yii::app()->getBasePath().'/plugins/'.$parentPlugin.'/'.$relativePathToScript)) {
$scriptToRegister = Yii::app()->getAssetManager()->publish(
Yii::app()->getBasePath().'/plugins/'.$parentPlugin.'/'.$relativePathToScript
\Yii::::app()->getBasePath().'/plugins/'.$parentPlugin.'/'.$relativePathToScript
);
} elseif (file_exists(Yii::app()->getBasePath().'/application/core/plugins/'.$parentPlugin.'/'.$relativePathToScript)) {
$scriptToRegister = Yii::app()->getAssetManager()->publish(
Yii::app()->getBasePath().'/application/core/plugins/'.$parentPlugin.'/'.$relativePathToScript
\Yii::::app()->getBasePath().'/application/core/plugins/'.$parentPlugin.'/'.$relativePathToScript
);
}
Yii::app()->getClientScript()->registerScriptFile($scriptToRegister);
\Yii::::app()->getClientScript()->registerScriptFile($scriptToRegister);
}

/**
Expand All @@ -583,17 +580,17 @@ protected function registerCss($relativePathToCss, $parentPlugin = null)
$cssToRegister = null;
if (file_exists(YiiBase::getPathOfAlias('userdir').'/plugins/'.$parentPlugin.'/'.$relativePathToCss)) {
$cssToRegister = Yii::app()->getAssetManager()->publish(
YiiBase::getPathOfAlias('userdir').'/plugins/'.$parentPlugin.'/'.$relativePathToCss
\Yii::::getPathOfAlias('userdir').'/plugins/'.$parentPlugin.'/'.$relativePathToCss
);
} elseif (file_exists(YiiBase::getPathOfAlias('webroot').'/plugins/'.$parentPlugin.'/'.$relativePathToCss)) {
$cssToRegister = Yii::app()->getAssetManager()->publish(
YiiBase::getPathOfAlias('webroot').'/plugins/'.$parentPlugin.'/'.$relativePathToCss
\Yii::::getPathOfAlias('webroot').'/plugins/'.$parentPlugin.'/'.$relativePathToCss
);
} elseif (file_exists(Yii::app()->getBasePath().'/application/core/plugins/'.$parentPlugin.'/'.$relativePathToCss)) {
$cssToRegister = Yii::app()->getAssetManager()->publish(
Yii::app()->getBasePath().'/application/core/plugins/'.$parentPlugin.'/'.$relativePathToCss
\Yii::::app()->getBasePath().'/application/core/plugins/'.$parentPlugin.'/'.$relativePathToCss
);
}
Yii::app()->getClientScript()->registerCssFile($cssToRegister);
\Yii::::app()->getClientScript()->registerCssFile($cssToRegister);
}
}

2 comments on commit 9cbf24f

@c-schmitz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Shnoulle
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.