foreach (['table','action','args'] as $k) { if (!empty($this->params[$k])) $arg[] = $this->params[$k]; }
$arg = join('/',$arg);
- ## NB 30.01.19: >>>>>
- ## NB 30.01.19: Test with config
- $conf_run = function($conf,$action) use ($arg) {
- foreach ($conf as $cmd) {
- $action_ = $cmd[0];
- $laius = $cmd[1];
- $fct = $cmd[2];
- $perm = empty($cmd[3]) ? 0 : $cmd[3];
-
- if ($action != $action_) continue;
- $this->deniedUnless(!$perm or $this->perm >= $perm);
- #debug($action_);
- $fct();
- }
+/*
+# NB 14.12.22: What use ???
+ $conf = [];
+ $fct_help = function() use ($conf,$arg) {
+ $this->page($this->db,$conf['root']);
};
$conf = [
'root' => [
- [ 'help', 'This help', function() { $this->page($this->db,$conf['root']); } ],
+ [ 'help', 'This help', $fct_help ],
+ # NB 14.12.22 [ 'help', 'This help', function() use ($conf) { $this->page($this->db,$conf['root']); } ],
[ 'ls', 'List configured databases', function() {
$this->page($this->db,'ls',[],function(&$r){
if ($this->perm < self::ADMIN) unset($r['host'],$r['type']);
# NB 30.01.19 }, self::ADMIN ],
],
];
- $conf_run($conf['root'],$action);
- ## NB 30.01.19: <<<<<
-
+ #$conf['root'][0][2] = function() use ($conf) { $this->page($this->db,$conf['root']); };
+ foreach ($conf['root'] as $cmd) {
+ $action_ = $cmd[0];
+ $laius = $cmd[1];
+ $fct = $cmd[2];
+ $perm = empty($cmd[3]) ? 0 : $cmd[3];
+
+ if ($action != $action_) continue;
+ $this->deniedUnless(!$perm or $this->perm >= $perm);
+ #debug($action_);
+ $fct();
+ }
+*/
if ($action == 'help') {
$this->page($this->db,[
[ 'help', 'This help' ],
[ 'ls', 'List configured databases' ],
- [ 'databases', 'List others databases' ],
+ # NB 14.12.22 [ 'databases', 'List others databases' ],
[ 'random_str', 'Generate a random string' ],
[ 'ssha_password', 'Encrypt a password' ],
[ 'ssha512_password', 'Encrypt a password' ],
}
$this->page($types);
+ # NB 14.12.22 } elseif ($action == 'databases') {
+ # NB 14.12.22 $this->deniedUnless($this->perm >= self::ADMIN);
+ # NB 14.12.22 $this->page($this->db->databases());
+
} elseif ($action == 'ldap2') {
$table = $this->params['table'];
$attrs = ($this->params['action'] ? explode(',',$this->params['action']) : ['dn','objectClass']);