}
+ public function page_ldap() {
+ #debug($this->params);
+ $this->deniedUnless($this->perm >= self::READ);
+ $filter = ($this->params['table'] ? $this->params['table'] : '');
+ $attrs = ($this->params['action'] ? explode(',',$this->params['action']) : []);
+
+ if (!strpos($this->params['table'],'=')) {
+ $filter = '';
+ $attrs = explode(',',$this->params['table']);
+ }
+
+ $rows = $this->ldap_search([
+ 'bind_dn_preff' => (!empty($_SERVER['DBQ_LDAP_BIND_DN_PREFF']) ? 'ou='.$_SERVER['DBQ_LDAP_BIND_DN_PREFF'] : 'ou=auth'),
+ 'filter' => $filter,
+ 'attrs' => $attrs,
+ ]);
+
+ #echo $rows[0]['jpegPhoto']; exit;
+ #$rows = [ 'jpegPhoto' => $rows[0]['jpegPhoto'] ];
+ if ($this->is_html
+ or ($this->params['format'] == $this->format_cli)
+ or ($this->params['format'] == 'csv')
+ ) $rows = $this->array_fill_assoc($rows);
+ $this->page($rows);
+ }
+
+ public function page_ls($args) {
+ $this->deniedUnless($this->perm >= self::READ);
+ if (!strpos($args,'=')) $this->table->fields_only = explode(',',$args);
+ $this->page($this,'table_rows');
+ }
+
public function page($obj,$meth=null,$head=[],$fct=null) {
// Defaults
return $this->perm;
}
-# NB 11.12.17 public function can($perm) {
-# NB 11.12.17 if ($perm == 'read') return ($this->perm >= self::READ);
-# NB 11.12.17 if ($perm == 'write') return ($this->perm >= self::WRITE);
-# NB 11.12.17 if ($perm == 'delete') return ($this->perm >= self::DELETE);
-# NB 11.12.17 if ($perm == 'admin') return ($this->perm >= self::ADMIN);
-# NB 11.12.17 return null;
-# NB 11.12.17 }
-
public function status() { #$this->perm--;
$rows = [];
}
// Machine
- if ($this->perm >= self::ADMIN)
- if (function_exists('posix_uname')) {
+ if ($this->perm >= self::ADMIN and function_exists('posix_uname')) {
foreach (posix_uname() as $k => $v) {
if ($k == 'domainname' and $v == '(none)') continue;
$rows[] = [ 'name' => 'posix.uname.'.$k, 'value' => $v ];
}
$this->page($types);
- // NOW ONLY FOR ADMIN !
- } elseif ($this->perm < self::ADMIN) {
-
} elseif ($action == 'ldap') {
- #debug($this->params);
- $rows = $this->ldap_search([
- 'bind_dn_preff' => (!empty($_SERVER['DBQ_LDAP_BIND_DN_PREFF']) ? 'ou='.$_SERVER['DBQ_LDAP_BIND_DN_PREFF'] : 'ou=auth'),
- #'bind_dn' => 'ou=auth',
- 'filter' => ($this->params['table'] ? $this->params['table'] : ''),
- 'attrs' => ($this->params['action'] ? explode(',',$this->params['action']) : []),
- ]);
- #echo $rows[0]['jpegPhoto']; exit;
- #$rows = [ 'jpegPhoto' => $rows[0]['jpegPhoto'] ];
- if ($this->is_html
- or ($this->params['format'] == $this->format_cli)
- or ($this->params['format'] == 'csv')
- ) $rows = $this->array_fill_assoc($rows);
- $this->page($rows);
+ $this->deniedUnless($this->perm >= self::ADMIN);
+ $this->page_ldap();
} elseif ($action == 'phpinfo') {
+ $this->deniedUnless($this->perm >= self::ADMIN);
$this->rows_table($action,$this->phpinfo_rows());
#$this->page(['phpinfo'=>$this->page->phpinfo(true)]);
#$this->page($this->page->phpinfo());
or $action == '_SERVER'
or $action == '_REQUEST'
) {
+ $this->deniedUnless($this->perm >= self::ADMIN);
$rows = [];
foreach ($GLOBALS[$action] as $k=>$v) {
if (preg_match('/^(' . $this->hide_keys_exp . ')/', $k)) $v = $this->hide_keys_value;
}
public function run_db() {
+ $this->deniedUnless($this->perm >= self::READ);
$this->db(true); # Db Connections
$action = $this->params['table'];
if (!$action and self::PARAM_DB_DEFAULT) $action = self::PARAM_DB_DEFAULT;
});
} elseif ($action == 'ls') {
- $this->deniedUnless($this->perm >= self::READ);
- $fields_only = [];
- if (!strpos($this->params['args'],'=')) $this->table->fields_only = explode(',',$this->params['args']);
- $this->page($this,'table_rows');
+ $this->page_ls($this->params['args']);
} elseif ($action == 'fields') {
$this->page($this->table,'fields_rows');
$this->redirect_if_no_referer($this->table->base.'/');
$this->page($info);
- } elseif ($action == 'rm' and $this->perm >= self::DELETE) {
+ } elseif ($action == 'rm') {
+ $this->deniedUnless($this->perm >= self::DELETE);
if (!$this->table->delete($_POST,$info)) $this->error('rm: '.print_r($info,true));
$this->redirect_if_no_referer($this->table->base.'/');
$this->page($info);
} else {
+ if (!strpos($action,'=')) $this->page_ls($action);
$this->notImplemented('Unknown table action'." `$action`");
}