Skip to content
Snippets Groups Projects
Commit 24f38b42 authored by vogelor's avatar vogelor
Browse files

Enhancement of the Website-List. The user can only select the server as...

Enhancement of the Website-List. The user can only select the server as filter, he has some sites at (and not ALL Servers of the server-farm)
parent 3aa0c3c5
No related branches found
No related tags found
No related merge requests found
...@@ -91,6 +91,8 @@ class listform { ...@@ -91,6 +91,8 @@ class listform {
//$querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring); //$querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring);
$app->uses('tform'); $app->uses('tform');
$querystring = str_replace("{AUTHSQL}",$app->tform->getAuthSQL('r'),$querystring); $querystring = str_replace("{AUTHSQL}",$app->tform->getAuthSQL('r'),$querystring);
$querystring = str_replace("{AUTHSQL-A}",$app->tform->getAuthSQL('r','a'),$querystring);
$querystring = str_replace("{AUTHSQL-B}",$app->tform->getAuthSQL('r','b'),$querystring);
//* Getting the records //* Getting the records
$tmp_records = $app->db->queryAllRecords($querystring); $tmp_records = $app->db->queryAllRecords($querystring);
......
...@@ -1125,15 +1125,18 @@ class tform { ...@@ -1125,15 +1125,18 @@ class tform {
} }
function getAuthSQL($perm) { function getAuthSQL($perm, $table = '') {
if($_SESSION["s"]["user"]["typ"] == 'admin') { if($_SESSION["s"]["user"]["typ"] == 'admin') {
return '1'; return '1';
} else { } else {
if ($table != ''){
$table = ' ' . $table . '.';
}
$groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0; $groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
$sql = '('; $sql = '(';
$sql .= "(sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND sys_perm_user like '%$perm%') OR "; $sql .= "(" . $table . "sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND " . $table . "sys_perm_user like '%$perm%') OR ";
$sql .= "(sys_groupid IN (".$groups.") AND sys_perm_group like '%$perm%') OR "; $sql .= "(" . $table . "sys_groupid IN (".$groups.") AND " . $table ."sys_perm_group like '%$perm%') OR ";
$sql .= "sys_perm_other like '%$perm%'"; $sql .= $table . "sys_perm_other like '%$perm%'";
$sql .= ')'; $sql .= ')';
return $sql; return $sql;
......
...@@ -74,7 +74,7 @@ $liste["item"][] = array( 'field' => "server_id", ...@@ -74,7 +74,7 @@ $liste["item"][] = array( 'field' => "server_id",
'prefix' => "%", 'prefix' => "%",
'suffix' => "%", 'suffix' => "%",
'datasource' => array ( 'type' => 'SQL', 'datasource' => array ( 'type' => 'SQL',
'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name', 'querystring' => 'SELECT a.server_id, a.server_name FROM server a, web_domain b WHERE (a.server_id = b.server_id) AND ({AUTHSQL-B}) ORDER BY a.server_name',
'keyfield'=> 'server_id', 'keyfield'=> 'server_id',
'valuefield'=> 'server_name' 'valuefield'=> 'server_name'
), ),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment