More restrictions due to authorization system

master
Thomas Hooge 2 years ago
parent 0b2da1f00f
commit f0d187b4c3
  1. 38
      install/mysql.sql
  2. 4
      install/upgrade.txt
  3. 1
      lang/de.php
  4. 1
      lang/en.php
  5. 5
      login.php
  6. 5
      options.php
  7. 6
      tpl/assetclassgroupview.tpl
  8. 8
      tpl/assetclassview.tpl
  9. 8
      tpl/assetview.tpl
  10. 8
      tpl/locationview.tpl
  11. 4
      tpl/nodeview.tpl
  12. 31
      tpl/options.tpl
  13. 8
      tpl/subnetview.tpl
  14. 8
      tpl/vlanview.tpl

@ -97,7 +97,9 @@ CREATE TABLE node (
zone_id int(10) DEFAULT NULL, zone_id int(10) DEFAULT NULL,
node_info text DEFAULT NULL, node_info text DEFAULT NULL,
node_type enum('v4','v6') NOT NULL DEFAULT 'v4', node_type enum('v4','v6') NOT NULL DEFAULT 'v4',
PRIMARY KEY (node_id) PRIMARY KEY (node_id),
INDEX ix_ip (node_ip),
INDEX ix_mac (node_mac)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE subnet ( CREATE TABLE subnet (
@ -109,7 +111,8 @@ CREATE TABLE subnet (
subnet_info text DEFAULT NULL, subnet_info text DEFAULT NULL,
protocol_version tinyint(1) NOT NULL DEFAULT 4, protocol_version tinyint(1) NOT NULL DEFAULT 4,
ntp_server varchar(45) DEFAULT NULL, ntp_server varchar(45) DEFAULT NULL,
PRIMARY KEY (subnet_id) PRIMARY KEY (subnet_id),
UNIQUE INDEX ix_subnet (subnet_address, subnet_mask)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE subnetlocation ( CREATE TABLE subnetlocation (
@ -162,20 +165,21 @@ CREATE TABLE vlan (
CREATE TABLE zone ( CREATE TABLE zone (
zone_id int(10) NOT NULL AUTO_INCREMENT, zone_id int(10) NOT NULL AUTO_INCREMENT,
zone_soa varchar(40) CHARACTER SET utf8 NOT NULL, zone_soa varchar(40) NOT NULL,
zone_hostmaster varchar(40) CHARACTER SET utf8 NOT NULL, zone_hostmaster varchar(40) NOT NULL,
zone_origin varchar(40) CHARACTER SET utf8 NOT NULL, zone_origin varchar(40) NOT NULL,
zone_ttl_default varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '3D', zone_ttl_default varchar(10) NOT NULL DEFAULT '3D',
zone_refresh varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '8H', zone_refresh varchar(10) NOT NULL DEFAULT '8H',
zone_retry varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '2H', zone_retry varchar(10) NOT NULL DEFAULT '2H',
zone_expire varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '4W', zone_expire varchar(10) NOT NULL DEFAULT '4W',
zone_ttl varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '1D', zone_ttl varchar(10) NOT NULL DEFAULT '1D',
zone_serial int(10) unsigned NOT NULL, zone_serial int(10) unsigned NOT NULL,
zone_ns1 varchar(20) CHARACTER SET utf8 NOT NULL, zone_ns1 varchar(20) NOT NULL,
zone_ns2 varchar(20) CHARACTER SET utf8 DEFAULT NULL, zone_ns2 varchar(20) DEFAULT NULL,
zone_ns3 varchar(20) CHARACTER SET utf8 DEFAULT NULL, zone_ns3 varchar(20) DEFAULT NULL,
zone_mx1 varchar(20) CHARACTER SET utf8 DEFAULT NULL, zone_mx1 varchar(20) DEFAULT NULL,
zone_mx2 varchar(20) CHARACTER SET utf8 DEFAULT NULL, zone_mx2 varchar(20) DEFAULT NULL,
zone_info text CHARACTER SET utf8 DEFAULT NULL, zone_info text DEFAULT NULL,
PRIMARY KEY (zone_id) PRIMARY KEY (zone_id),
UNIQUE INDEX ix_zone_origin (zone_origin)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

@ -18,7 +18,7 @@ Compare the configuration to the sample config.
There may be additional settings that you want to customize. There may be additional settings that you want to customize.
3. Switch to new version 3. Switch to new version
Rename the old an new directory. Rename the old and new directory.
4. Done 4. Done
If everything works fine you could remove the old directory. If everything works fine you could remove the old directory.

@ -194,6 +194,7 @@ $lang = array(
'lang_comments_accessdenied' => 'Zugriff verweigert. Keine Berechtigung.', 'lang_comments_accessdenied' => 'Zugriff verweigert. Keine Berechtigung.',
'lang_options_ipreg' => 'IP Reg Optionen', 'lang_options_ipreg' => 'IP Reg Optionen',
'lang_options_profile' => 'Aktuelles Benutzerprofil',
'lang_options_display' => 'Anzeigeeinstellungen', 'lang_options_display' => 'Anzeigeeinstellungen',
'lang_options_password' => 'Kennwort ändern', 'lang_options_password' => 'Kennwort ändern',
'lang_options_imagesize' => 'Bildgröße', 'lang_options_imagesize' => 'Bildgröße',

@ -194,6 +194,7 @@ $lang = array(
'lang_comments_accessdenied' => 'Access denied', 'lang_comments_accessdenied' => 'Access denied',
'lang_options_ipreg' => 'IP Reg options', 'lang_options_ipreg' => 'IP Reg options',
'lang_options_profile' => 'Current user profile',
'lang_options_display' => 'Display options', 'lang_options_display' => 'Display options',
'lang_options_password' => 'Change password', 'lang_options_password' => 'Change password',
'lang_options_imagesize' => 'Imagesize', 'lang_options_imagesize' => 'Imagesize',

@ -10,7 +10,10 @@ SPDX-License-Identifier: GPL-3.0-or-later
session_name('ipreg'); session_name('ipreg');
session_start(); session_start();
include("config.php"); if (! include("config.php")) {
echo "<!DOCTYPE html><html><head><title>IP Reg</title></head><body><h1>IP Reg</h1><h2>No configuration</h2><p>Error loading configuration. Please check your installation.</p></body></html>\n";
exit(1);
}
// connect to database // connect to database
$dbh = new PDO("mysql:host=$config_mysql_host;dbname=$config_mysql_dbname;charset=utf8", $config_mysql_username, $config_mysql_password); $dbh = new PDO("mysql:host=$config_mysql_host;dbname=$config_mysql_dbname;charset=utf8", $config_mysql_username, $config_mysql_password);

@ -10,6 +10,11 @@ SPDX-License-Identifier: GPL-3.0-or-later
include("includes.php"); include("includes.php");
include("header.php"); include("header.php");
$smarty->assign('role_add', $_SESSION['suser_role_add']);
$smarty->assign('role_edit', $_SESSION['suser_role_edit']);
$smarty->assign('role_delete', $_SESSION['suser_role_delete']);
$smarty->assign('role_manage', $_SESSION['suser_role_manage']);
$smarty->assign('role_admin', $_SESSION['suser_role_admin']);
$smarty->display("options.tpl"); $smarty->display("options.tpl");
include("footer.php"); include("footer.php");

@ -5,9 +5,15 @@
{$assetclassgroup->name} {$assetclassgroup->name}
</td> </td>
<td align="right"> <td align="right">
{if $suser_add}
<a href="assetclassgroupadd.php?assetclassgroup_id={$assetclassgroup->id}"><img src="image.php?icon=add" alt="{$lang_assetclassgroup_add}" {if $suser_tooltips}title="{$lang_assetclassgroup_add}" {/if}/></a> <a href="assetclassgroupadd.php?assetclassgroup_id={$assetclassgroup->id}"><img src="image.php?icon=add" alt="{$lang_assetclassgroup_add}" {if $suser_tooltips}title="{$lang_assetclassgroup_add}" {/if}/></a>
{/if}
{if $suser_edit}
<a href="assetclassgroupedit.php?assetclassgroup_id={$assetclassgroup->id}"><img src="image.php?icon=edit" alt="{$lang_assetclassgroup_edit}" {if $suser_tooltips}title="{$lang_assetclassgroup_edit}" {/if}/></a> <a href="assetclassgroupedit.php?assetclassgroup_id={$assetclassgroup->id}"><img src="image.php?icon=edit" alt="{$lang_assetclassgroup_edit}" {if $suser_tooltips}title="{$lang_assetclassgroup_edit}" {/if}/></a>
{/if}
{if $suser_del}
<a href="assetclassgroupdel.php?assetclassgroup_id={$assetclassgroup->id}"><img src="image.php?icon=delete" alt="{$lang_assetclassgroup_del}" {if $suser_tooltips}title="{$lang_assetclassgroup_del}" {/if}/></a> <a href="assetclassgroupdel.php?assetclassgroup_id={$assetclassgroup->id}"><img src="image.php?icon=delete" alt="{$lang_assetclassgroup_del}" {if $suser_tooltips}title="{$lang_assetclassgroup_del}" {/if}/></a>
{/if}
</td> </td>
</tr> </tr>
</table> </table>

@ -5,9 +5,15 @@
{$assetclass->assetclass_name} {$assetclass->assetclass_name}
</td> </td>
<td align="right"> <td align="right">
{if $suser_add}
<a href="assetadd.php?assetclass_id={$assetclass->assetclass_id}"><img src="image.php?icon=add" alt="{$lang_asset_add}" {if $suser_tooltips}title="{$lang_asset_add}" {/if}/></a> <a href="assetadd.php?assetclass_id={$assetclass->assetclass_id}"><img src="image.php?icon=add" alt="{$lang_asset_add}" {if $suser_tooltips}title="{$lang_asset_add}" {/if}/></a>
{/if}
{if $suser_edit}
<a href="assetclassedit.php?assetclass_id={$assetclass->assetclass_id}"><img src="image.php?icon=edit" alt="{$lang_assetclass_edit}" {if $suser_tooltips}title="{$lang_asset_edit}" {/if}/></a> <a href="assetclassedit.php?assetclass_id={$assetclass->assetclass_id}"><img src="image.php?icon=edit" alt="{$lang_assetclass_edit}" {if $suser_tooltips}title="{$lang_asset_edit}" {/if}/></a>
{/if}
{if $suser_del}
<a href="assetclassdel.php?assetclass_id={$assetclass->assetclass_id}"><img src="image.php?icon=delete" alt="{$lang_assetclass_add}" {if $suser_tooltips}title="{$lang_asset_delete}" {/if}/></a> <a href="assetclassdel.php?assetclass_id={$assetclass->assetclass_id}"><img src="image.php?icon=delete" alt="{$lang_assetclass_add}" {if $suser_tooltips}title="{$lang_asset_delete}" {/if}/></a>
{/if}
</td> </td>
</tr> </tr>
</table> </table>
@ -26,7 +32,9 @@
{$lang_assetclass_name} {$lang_assetclass_name}
</td> </td>
<td class="value"> <td class="value">
{if $suser_edit}
<a href="assetclassview.php?assetclass_id={$assetclass->assetclass_id}">{$assetclass->assetclass_name}</a> <a href="assetclassview.php?assetclass_id={$assetclass->assetclass_id}">{$assetclass->assetclass_name}</a>
{/if}
</td> </td>
</tr> </tr>
</table> </table>

@ -5,9 +5,15 @@
{$asset->asset_name} {$asset->asset_name}
</td> </td>
<td align="right"> <td align="right">
{if $suser_add}
<a href="assignnodetoasset.php?asset_id={$asset->asset_id}"><img src="image.php?icon=add" alt="{$lang_assignnodetoasset}"></a> <a href="assignnodetoasset.php?asset_id={$asset->asset_id}"><img src="image.php?icon=add" alt="{$lang_assignnodetoasset}"></a>
{/if}
{if $suser_edit}
<a href="assetedit.php?asset_id={$asset->asset_id}"><img src="image.php?icon=edit" alt="{$lang_asset_edit}"></a> <a href="assetedit.php?asset_id={$asset->asset_id}"><img src="image.php?icon=edit" alt="{$lang_asset_edit}"></a>
{/if}
{if $suser_del}
<a href="assetdel.php?asset_id={$asset->asset_id}"><img src="image.php?icon=delete" alt="{$lang_asset_edit}"></a> <a href="assetdel.php?asset_id={$asset->asset_id}"><img src="image.php?icon=delete" alt="{$lang_asset_edit}"></a>
{/if}
</td> </td>
</tr> </tr>
</table> </table>
@ -89,7 +95,9 @@
{$lang_nodes} {$lang_nodes}
</td> </td>
<td class="header_right"> <td class="header_right">
{if $suser_edit}
<a href="assignnodetoasset.php?asset_id={$asset->asset_id}"><img src="image.php?icon=edit" alt="{$lang_assignnodetoasset}"></a> <a href="assignnodetoasset.php?asset_id={$asset->asset_id}"><img src="image.php?icon=edit" alt="{$lang_assignnodetoasset}"></a>
{/if}
</td> </td>
</tr> </tr>
<tr> <tr>

@ -5,9 +5,15 @@
{$location->name} {$location->name}
</td> </td>
<td align="right"> <td align="right">
{if $suser_add}
<a href="locationadd.php?location_parent={$location->id}"><img src="images/building_add.png" alt="{$lang_sublocation_add}"></a> <a href="locationadd.php?location_parent={$location->id}"><img src="images/building_add.png" alt="{$lang_sublocation_add}"></a>
{/if}
{if $suser_edit}
<a href="locationedit.php?location_id={$location->id}"><img src="images/building_edit.png" alt="{$lang_location_edit}"></a> <a href="locationedit.php?location_id={$location->id}"><img src="images/building_edit.png" alt="{$lang_location_edit}"></a>
{/if}
{if $suser_del}
<a href="locationdel.php?location_id={$location->id}"><img src="images/building_delete.png" alt="{$lang_location_del}"></a> <a href="locationdel.php?location_id={$location->id}"><img src="images/building_delete.png" alt="{$lang_location_del}"></a>
{/if}
</td> </td>
</tr> </tr>
</table> </table>
@ -72,7 +78,9 @@
{$lang_subnet} {$lang_subnet}
</td> </td>
<td class="header_right"> <td class="header_right">
{if $suser_edit}
<a href="locationsubnetedit.php?location_id={$location->id}"><img src="image.php?icon=edit" alt="{$lang_locationsubnet_edit}"></a> <a href="locationsubnetedit.php?location_id={$location->id}"><img src="image.php?icon=edit" alt="{$lang_locationsubnet_edit}"></a>
{/if}
</td> </td>
</tr> </tr>
<tr> <tr>

@ -5,8 +5,12 @@
{$node->ip} {$node->ip}
</td> </td>
<td align="right"> <td align="right">
{if $suser_edit}
<a href="nodeedit.php?node_id={$node->id}"><img src="image.php?icon=edit" alt="{$lang_node_edit}"></a> <a href="nodeedit.php?node_id={$node->id}"><img src="image.php?icon=edit" alt="{$lang_node_edit}"></a>
{/if}
{if $suser_del}
<a href="nodedel.php?node_id={$node->id}"><img src="image.php?icon=delete" alt="{$lang_node_del}"></a> <a href="nodedel.php?node_id={$node->id}"><img src="image.php?icon=delete" alt="{$lang_node_del}"></a>
{/if}
</td> </td>
</tr> </tr>
</table> </table>

@ -9,7 +9,6 @@
</tr> </tr>
</table> </table>
<table class="info"> <table class="info">
<tr> <tr>
<td class="header"> <td class="header">
@ -34,3 +33,33 @@
</tr> </tr>
{/if} {/if}
</table> </table>
<table class="info">
<tr>
<td class="header" colspan="2">
{$lang_options_profile}
</td>
</tr>
<tr>
<td class="label">
{$lang_user_roles}
</td>
<td class="label">
{if $role_add}
<img src="images/page_add.png" alt="[Add]"> {$lang_user_role_add} <br>
{/if}
{if $role_edit}
<img src="images/page_edit.png" alt="[Edit]"> {$lang_user_role_edit} <br>
{/if}
{if $role_edit}
<img src="images/page_delete.png" alt="[Del]"> {$lang_user_role_delete} <br>
{/if}
{if $role_manage}
<img src="images/manage.png" alt="[Manage]"> {$lang_user_role_manage} <br>
{/if}
{if $role_manage}
<img src="images/admin.png" alt="[Admin]"> {$lang_user_role_admin}
{/if}
</td>
</tr>
</table>

@ -5,8 +5,12 @@
{$subnet->address}/{$subnet->mask} {$subnet->address}/{$subnet->mask}
</td> </td>
<td align="right"> <td align="right">
{if $suser_edit}
<a href="subnetedit.php?subnet_id={$subnet->id}"><img src="image.php?icon=edit" alt="{$lang_subnet_edit}"></a> <a href="subnetedit.php?subnet_id={$subnet->id}"><img src="image.php?icon=edit" alt="{$lang_subnet_edit}"></a>
{/if}
{if $suser_del}
<a href="subnetdel.php?subnet_id={$subnet->id}"><img src="image.php?icon=delete" alt="{$lang_subnet_del}"></a> <a href="subnetdel.php?subnet_id={$subnet->id}"><img src="image.php?icon=delete" alt="{$lang_subnet_del}"></a>
{/if}
</td> </td>
</tr> </tr>
</table> </table>
@ -152,7 +156,9 @@
{$lang_vlans} {$lang_vlans}
</td> </td>
<td class="header_right"> <td class="header_right">
{if $suser_edit}
<a href="subnetvlanedit.php?subnet_id={$subnet->id}"><img src="image.php?icon=edit" alt="{$lang_subnetvlan_edit}"></a> <a href="subnetvlanedit.php?subnet_id={$subnet->id}"><img src="image.php?icon=edit" alt="{$lang_subnetvlan_edit}"></a>
{/if}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -173,7 +179,9 @@
{$lang_locations} {$lang_locations}
</td> </td>
<td class="header" align="right"> <td class="header" align="right">
{if $suser_edit}
<a href="subnetlocationedit.php?subnet_id={$subnet->id}"><img src="image.php?icon=edit" alt="{$lang_location_edit}"></a> <a href="subnetlocationedit.php?subnet_id={$subnet->id}"><img src="image.php?icon=edit" alt="{$lang_location_edit}"></a>
{/if}
</td> </td>
</tr> </tr>
<tr> <tr>

@ -5,9 +5,15 @@
{$vlan->name} {$vlan->name}
</td> </td>
<td align="right"> <td align="right">
{if $suser_add}
<a href="assignvlantosubnet.php?vlan_id={$vlan->id}"><img src="image.php?icon=add" alt="{$lang_assignvlantosubnet}"></a> <a href="assignvlantosubnet.php?vlan_id={$vlan->id}"><img src="image.php?icon=add" alt="{$lang_assignvlantosubnet}"></a>
{/if}
{if $suser_edit}
<a href="vlanedit.php?vlan_id={$vlan->id}"><img src="image.php?icon=edit" alt="{$lang_vlan_edit}"></a> <a href="vlanedit.php?vlan_id={$vlan->id}"><img src="image.php?icon=edit" alt="{$lang_vlan_edit}"></a>
{/if}
{if $suser_del}
<a href="vlandel.php?vlan_id={$vlan->id}"><img src="image.php?icon=delete" alt="{$lang_vlan_del}"></a> <a href="vlandel.php?vlan_id={$vlan->id}"><img src="image.php?icon=delete" alt="{$lang_vlan_del}"></a>
{/if}
</td> </td>
</tr> </tr>
</table> </table>
@ -62,7 +68,9 @@
{$lang_subnet} {$lang_subnet}
</td> </td>
<td class="header" align="right"> <td class="header" align="right">
{if $suser_edit}
<a href="vlansubnetedit.php?vlan_id={$vlan->id}"><img src="image.php?icon=edit" alt="{$lang_subnetvlan_edit}"></a> <a href="vlansubnetedit.php?vlan_id={$vlan->id}"><img src="image.php?icon=edit" alt="{$lang_subnetvlan_edit}"></a>
{/if}
</td> </td>
</tr> </tr>
<tr> <tr>