* Fix priv of workflow menus.
This commit is contained in:
+29
-47
@@ -1842,39 +1842,28 @@ class groupModel extends model
|
||||
if(!empty($version) and strpos($versionPrivs, ",$privCode,") === false) continue;
|
||||
|
||||
/* Remove privs unused in the edition. */
|
||||
if(!isset($this->lang->resource->$moduleName) || !isset($this->lang->resource->$moduleName->$methodName)) continue;
|
||||
$methodLang = $this->lang->resource->$moduleName->$methodName;
|
||||
if(!isset($this->lang->$moduleName->$methodLang))
|
||||
if(isset($this->lang->$moduleName->menus) && isset($this->lang->$moduleName->menus[$methodName]))
|
||||
{
|
||||
$this->app->loadLang($moduleName);
|
||||
if($moduleName == 'requirement') $this->app->loadLang('story');
|
||||
$privName = $this->lang->$moduleName->menus[$methodName];
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!isset($this->lang->resource->$moduleName) || !isset($this->lang->resource->$moduleName->$methodName)) continue;
|
||||
$methodLang = $this->lang->resource->$moduleName->$methodName;
|
||||
if(!isset($this->lang->$moduleName->$methodLang))
|
||||
{
|
||||
$this->app->loadLang($moduleName);
|
||||
if($moduleName == 'requirement') $this->app->loadLang('story');
|
||||
}
|
||||
$privName = isset($this->lang->$moduleName) && isset($this->lang->$moduleName->$methodLang) ? $this->lang->$moduleName->$methodLang : $privCode;
|
||||
}
|
||||
|
||||
$privName = isset($this->lang->$moduleName) && isset($this->lang->$moduleName->$methodLang) ? $this->lang->$moduleName->$methodLang : $privCode;
|
||||
$priv = (object)array('subset' => $packageData->subset, 'package' => $packageCode, 'module' => $moduleName, 'method' => $methodName, 'selected' => false, 'name' => $privName);
|
||||
|
||||
$privList[$privCode] = $priv;
|
||||
}
|
||||
}
|
||||
|
||||
if($version) return $privList;
|
||||
|
||||
/* Privs in resource but not in package. */
|
||||
foreach($this->lang->resource as $module => $methodList)
|
||||
{
|
||||
foreach($methodList as $method => $methodLang)
|
||||
{
|
||||
if(isset($allPrivs["$module-$method"])) continue;
|
||||
|
||||
if(!$this->checkNavModule($nav, $module)) continue;
|
||||
|
||||
if(!isset($this->lang->$module->$methodLang)) $this->app->loadLang($module);
|
||||
$priv = (object)array('subset' => $module, 'package' => 'other', 'module' => $module, 'method' => $method, 'selected' => false, 'name' => $this->lang->$module->$methodLang);
|
||||
|
||||
$privList["$module-$method"] = $priv;
|
||||
}
|
||||
}
|
||||
|
||||
return $privList;
|
||||
}
|
||||
|
||||
@@ -2577,7 +2566,21 @@ class groupModel extends model
|
||||
list($moduleName, $methodName) = explode('-', $privCode);
|
||||
|
||||
/* Remove privs unused in the edition. */
|
||||
if(!isset($this->lang->resource->$moduleName) || !isset($this->lang->resource->$moduleName->$methodName)) continue;
|
||||
if(isset($this->lang->$moduleName->menus) && isset($this->lang->$moduleName->menus[$methodName]))
|
||||
{
|
||||
$privName = $this->lang->$moduleName->menus[$methodName];
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!isset($this->lang->resource->$moduleName) || !isset($this->lang->resource->$moduleName->$methodName)) continue;
|
||||
$methodLang = $this->lang->resource->$moduleName->$methodName;
|
||||
if(!isset($this->lang->$moduleName->$methodLang))
|
||||
{
|
||||
$this->app->loadLang($moduleName);
|
||||
if($moduleName == 'requirement') $this->app->loadLang('story');
|
||||
}
|
||||
$privName = isset($this->lang->$moduleName) && isset($this->lang->$moduleName->$methodLang) ? $this->lang->$moduleName->$methodLang : "$moduleName-$methodName";
|
||||
}
|
||||
|
||||
$allPrivs[$privCode] = $privCode;
|
||||
|
||||
@@ -2586,28 +2589,7 @@ class groupModel extends model
|
||||
|
||||
if($selectedPackages && strpos($selectedPackages, "|$packageCode|") === false) continue;
|
||||
|
||||
$methodLang = $this->lang->resource->$moduleName->$methodName;
|
||||
if(!isset($this->lang->$moduleName->$methodLang)) $this->app->loadLang($moduleName);
|
||||
|
||||
$privs[$privCode] = isset($this->lang->$moduleName) && isset($this->lang->$moduleName->$methodLang) ? $this->lang->$moduleName->$methodLang : $privCode;
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($selectedPackages) || strpos($selectedPackages, '|other|') !== false)
|
||||
{
|
||||
/* Privs in resource but not in package. */
|
||||
$this->sortResource();
|
||||
foreach($this->lang->resource as $module => $methodList)
|
||||
{
|
||||
foreach($methodList as $method => $methodLang)
|
||||
{
|
||||
if($module != $selectedSubset) continue;
|
||||
|
||||
if(isset($allPrivs["$module-$method"])) continue;
|
||||
|
||||
if(!isset($this->lang->$module->$methodLang)) $this->app->loadLang($module);
|
||||
$privs["$module-$method"] = isset($this->lang->$module) && isset($this->lang->$module->$methodLang) ? $this->lang->$module->$methodLang : "$module-$method";
|
||||
}
|
||||
$privs[$privCode] = $privName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user