Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/RestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,10 @@ protected function _detect_api_key()
return false;
}

if ($this->config->item('rest_keys_expire') === true && $row->{$this->config->item('rest_keys_expiry_column')} < time()) {
return false;
}

isset($row->user_id) && $this->rest->user_id = $row->user_id;
isset($row->level) && $this->rest->level = $row->level;
isset($row->ignore_limits) && $this->rest->ignore_limits = $row->ignore_limits;
Expand Down
15 changes: 15 additions & 0 deletions src/rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@
| `is_private_key` TINYINT(1) NOT NULL DEFAULT '0',
| `ip_addresses` TEXT NULL DEFAULT NULL,
| `date_created` INT(11) NOT NULL,
| `expires` INT(11) NOT NULL
| PRIMARY KEY (`id`)
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
Expand All @@ -332,6 +333,7 @@
| is_private_key SMALLINT NOT NULL DEFAULT '0',
| ip_addresses TEXT NULL DEFAULT NULL,
| date_created INT NOT NULL,
| expires INT NOT NULL,
| PRIMARY KEY (id)
| ) ;
| |
Expand All @@ -348,6 +350,19 @@
|
*/
$config['rest_key_column'] = 'key';
/*
|--------------------------------------------------------------------------
| REST Table Key Expiry Config and Column Name
|--------------------------------------------------------------------------
|
| Configure wether or not api keys should expire, and the column name to
| match e.g. expires
| Note: the value in the column will be treated as a unix timestamp and
| compared with php function time()
|
*/
$config['rest_keys_expire'] = false;
$config['rest_keys_expiry_column'] = 'expires';

/*
|--------------------------------------------------------------------------
Expand Down