1<?php
2/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
3/**
4 *
5 * LICENSE: GNU Affero General Public License, version 3 (AGPL-3.0-or-later)
6 * Copyright 2001 - 2020 Ampache.org
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 *
21 */
22
23use Ampache\Config\AmpConfig;
24use Ampache\Module\Api\Ajax;
25use Ampache\Module\Application\Admin\Access\Lib\AccessListItemInterface;
26use Ampache\Module\Application\Admin\Access\Lib\AccessListTypeEnum;
27use Ampache\Module\Util\Ui;
28
29?>
30<?php Ui::show_box_top(T_('Access Control'), 'box box_access_control');
31$addcurrent = T_('Add Current Host');
32$addrpc     = T_('Add API / RPC Host');
33$addlocal   = T_('Add Local Network Definition');
34$web_path   = AmpConfig::get('web_path'); ?>
35<div id="information_actions" class="left-column">
36<ul>
37    <li>
38        <a class="option-list" href="<?php echo $web_path; ?>/admin/access.php?action=show_add&add_type=<?php echo AccessListTypeEnum::ADD_TYPE_CURRENT; ?>"><?php echo Ui::get_icon('add_user', $addcurrent) . ' ' . $addcurrent; ?></a>
39    </li>
40    <li>
41        <a class="option-list" href="<?php echo $web_path; ?>/admin/access.php?action=show_add&add_type=<?php echo AccessListTypeEnum::ADD_TYPE_RPC; ?>"><?php echo Ui::get_icon('cog', $addrpc) . ' ' . $addrpc; ?></a>
42    </li>
43    <li>
44        <a class="option-list" href="<?php echo $web_path; ?>/admin/access.php?action=show_add&add_type=<?php echo AccessListTypeEnum::ADD_TYPE_LOCAL ?>"><?php echo Ui::get_icon('home', $addlocal) . ' ' . $addlocal; ?></a>
45    <li>
46        <a class="option-list" href="<?php echo $web_path; ?>/admin/access.php?action=show_add_advanced"><?php echo Ui::get_icon('add_key', T_('Advanced Add')) . ' ' . T_('Advanced Add'); ?></a>
47    </li>
48</ul>
49</div>
50<?php Ui::show_box_bottom(); ?>
51<?php Ui::show_box_top(T_('Access Control Entries'), 'box box_access_entries'); ?>
52<?php Ajax::start_container('browse_content', 'browse_content'); ?>
53<?php if ($list !== []) { ?>
54<table class="tabledata striped-rows">
55<thead>
56    <tr class="th-top">
57        <th><?php echo T_('Name'); ?></th>
58        <th><?php echo T_('Start Address'); ?></th>
59        <th><?php echo T_('End Address'); ?></th>
60        <th><?php echo T_('Level'); ?></th>
61        <th><?php echo T_('User'); ?></th>
62        <th><?php echo T_('Type'); ?></th>
63        <th><?php echo T_('Action'); ?></th>
64    </tr>
65</thead>
66<tbody>
67<?php
68    /* Start foreach List Item */
69    /** @var AccessListItemInterface $access $access */
70    foreach ($list as $access) {
71        ?>
72<tr>
73    <td><?php echo scrub_out($access->getName()); ?></td>
74    <td><?php echo $access->getStartIp(); ?></td>
75    <td><?php echo $access->getEndIp(); ?></td>
76    <td><?php echo $access->getLevelName(); ?></td>
77    <td><?php echo $access->getUserName(); ?></td>
78    <td><?php echo $access->getTypeName(); ?></td>
79    <td>
80        <a href="<?php echo $web_path; ?>/admin/access.php?action=show_edit_record&amp;access_id=<?php echo $access->getId(); ?>"><?php echo Ui::get_icon('edit', T_('Edit')); ?></a>
81        <a href="<?php echo $web_path; ?>/admin/access.php?action=show_delete_record&amp;access_id=<?php echo $access->getId(); ?>"><?php echo Ui::get_icon('delete', T_('Delete')); ?></a>
82    </td>
83</tr>
84    <?php
85    } // end foreach?>
86</tbody>
87</table>
88<?php
89} // end if count?>
90<?php Ajax::end_container(); ?>
91<?php Ui::show_box_bottom(); ?>
92