Skip to content
Permalink
Browse files

User project role check for Editor plugin (for new gisportal)

  • Loading branch information...
uprel committed May 13, 2019
1 parent e66f5fa commit 42c045bf47170831d6669cc8277fdcc56626cfd6
Showing with 42 additions and 8 deletions.
  1. +35 −4 admin/class.Helpers.php
  2. +1 −1 client/eqwc_load.php
  3. +1 −1 client_mobile/eqwc_mobile_load.php
  4. +5 −2 index.php
@@ -523,18 +523,16 @@ public static function loadGoogle() {
public static function getEqwcVersion() {
$version = '0';
if (file_exists('../version.txt')) {
$version = trim(file_get_contents('../version.txt',null,null,null,7));
$version = trim(file_get_contents('../version.txt',null,null,null,9));
}
return $version;
}
public static function getPluginVersion($name) {
$version = '0';
$dir = dirname(dirname(__FILE__)) . "/plugins/";
if (self::checkModulexist($name)) {
if (file_exists($dir . $name . '/changelog.txt')) {
if (file_exists($dir . $name . '/changelog.txt')) {
$version = trim(file_get_contents($dir . $name . '/changelog.txt',null,null,null,5));
}
}
return $version;
}
@@ -577,4 +575,37 @@ public function checkReferer($project) {
return TRUE;
}
public static function hasPluginAccess($plugin) {
//check only for editing plugin
if($plugin !== 'editing') {
return TRUE;
}
$role = null;
if (isset($_SESSION['role'])) {
$role = $_SESSION['role'];
}
switch($role) {
case null :
return TRUE;
case 'admin' :
return TRUE;
case 'editor' :
return TRUE;
case 'user' :
return FALSE;
case 'public' :
return FALSE;
default :
return FALSE;
}
}
}
@@ -49,7 +49,7 @@
//add into array all js files in plugins/xxx/js subfolder
if (!(empty($plugin_list))) {
foreach ($plugin_list as $item) {
if (is_dir($dir . $item)) {
if (is_dir($dir . $item) && \GisApp\Helpers::hasPluginAccess($item)) {
$plugin_path = $dir . $item;
//plugin language file
@@ -56,7 +56,7 @@
//add into array all js files in plugins/xxx/src_mobile subfolder
if (!(empty($plugin_list))) {
foreach ($plugin_list as $item) {
if (is_dir($dir . $item)) {
if (is_dir($dir . $item) && \GisApp\Helpers::hasPluginAccess($item)) {
$plugin_path = $dir . $item;
//plugin language file
@@ -212,8 +212,11 @@ function goMobile($lang) {
if ($login_check->isValidUserProj($helpers->getMapFromUrl())) {
$edit = $helpers->checkModulexist("editing");
$editVer = $helpers->getPluginVersion("editing");
$edit = $helpers->checkModulexist("editing") && $helpers->hasPluginAccess("editing");
$editVer = 0;
if($edit) {
$helpers->getPluginVersion("editing");
}
$google = $helpers->loadGoogle();
//OK open application

0 comments on commit 42c045b

Please sign in to comment.
You can’t perform that action at this time.