streams/Code/Module/Permcat.php

31 lines
713 B
PHP
Raw Normal View History

<?php
2022-02-16 04:08:28 +00:00
namespace Code\Module;
2022-02-16 04:08:28 +00:00
use Code\Lib as Zlib;
use Code\Web\Controller;
2021-12-03 03:01:39 +00:00
class Permcat extends Controller
{
2021-12-03 03:01:39 +00:00
private $permcats = [];
2021-12-03 03:01:39 +00:00
public function init()
{
2022-02-05 22:07:10 +00:00
if (! (local_channel() && Zlib\Apps::system_app_installed(local_channel(),'Roles'))) {
json_return_and_die([ 'success' => false ]);
}
$abook_id = (argc() > 2) ? argv(2) : EMPTY_STR;
$permcat = new Zlib\Permcat(local_channel(), $abook_id);
2017-02-08 00:43:00 +00:00
2021-12-03 03:01:39 +00:00
if (argc() > 1) {
2022-02-05 22:07:10 +00:00
// logger('fetched ' . argv(1) . ':' . print_r($permcat->fetch(argv(1)),true));
2021-12-03 03:01:39 +00:00
json_return_and_die($permcat->fetch(argv(1)));
}
2017-02-08 00:43:00 +00:00
2021-12-03 03:01:39 +00:00
json_return_and_die($permcat->listing());
}
}