Skip to content

Commit

Permalink
add server_id field to tokens and statically limit the ddns_token rec…
Browse files Browse the repository at this point in the history
…ords to the current server only (issue #11)
  • Loading branch information
Marcel Hofer committed Jul 26, 2023
1 parent 61d4d31 commit 0facc82
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
5 changes: 4 additions & 1 deletion ddns_token_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ function onShowEnd() {
}

function onSubmit() {
global $app;
global $app, $conf;

# statically limit the record to this server only (issue #11)
$this->dataRecord['server_id'] = $conf['server_id'];

if($_SESSION['s']['user']['typ'] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]);

Expand Down
10 changes: 8 additions & 2 deletions form/ddns_token.tform.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,15 @@
'width' => 150, // Tab width
'template' => 'templates/ddns_token_edit.htm', // Template file name
'fields' => array(

//*** BEGIN Datatable columns **********************************

'server_id' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'token' => array(
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
Expand Down
3 changes: 3 additions & 0 deletions migration_1.4.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

ALTER TABLE `ddns_token`
ADD COLUMN `server_id` int(11) unsigned NOT NULL DEFAULT 0 AFTER id;
1 change: 1 addition & 0 deletions setup.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-- DROP TABLE IF EXISTS `ddns_token`;
CREATE TABLE `ddns_token` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL DEFAULT 0,
`sys_userid` int(11) unsigned NOT NULL DEFAULT 0,
`sys_groupid` int(11) unsigned NOT NULL DEFAULT 0,
`sys_perm_user` varchar(5) NOT NULL DEFAULT '',
Expand Down

0 comments on commit 0facc82

Please sign in to comment.