* finish task #2241,2245.

This commit is contained in:
wangyidong
2015-05-08 09:47:39 +08:00
parent ba83f43b15
commit 36a4c32720
15 changed files with 210 additions and 17 deletions
+17 -3
View File
@@ -85,15 +85,29 @@ class common extends control
*/
public static function hasPriv($module, $method)
{
global $app;
global $app, $lang;
/* Check is the super admin or not. */
$account = ',' . $app->user->account . ',';
if(strpos($app->company->admins, $account) !== false) return true;
/* If not super admin, check the rights. */
$rights = $app->user->rights;
if(isset($rights[strtolower($module)][strtolower($method)])) return true;
$rights = $app->user->rights['rights'];
$acls = $app->user->rights['acls'];
$module = strtolower($module);
$method = strtolower($method);
if(isset($rights[$module][$method]))
{
if(empty($acls)) return true;
$menu = isset($lang->menugroup->$module) ? $lang->menugroup->$module : $module;
$menu = strtolower($menu);
if(!isset($lang->$menu->menu)) return true;
if($menu == 'my' or $menu == 'index' or $module == 'tree') return true;
if($module == 'company' and $method == 'dynamic') return true;
if($module == 'action' and $method == 'editcomment') return true;
if(!isset($acls['views'][$menu])) return false;
return true;
}
return false;
}