blob: e4d3f4b4cd6feefd46f049d1688dee4b3ab98e56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
<?php
class Step00219WebserviceAccess extends Migration
{
public function description()
{
return 'Step00219: new table webservice_access_rules';
}
public function up()
{
$db = DBManager::get();
$db->exec("CREATE TABLE `webservice_access_rules` (
`api_key` VARCHAR( 100 ) NOT NULL DEFAULT '',
`method` VARCHAR( 100 ) NOT NULL DEFAULT '',
`ip_range` VARCHAR( 200 ) NOT NULL DEFAULT '',
`type` ENUM( 'allow', 'deny' ) NOT NULL DEFAULT 'allow',
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY
) ENGINE=MyISAM;");
if ($GLOBALS['STUDIP_API_KEY'] && $GLOBALS['WEBSERVICES_ENABLE']) {
$db->exec("INSERT INTO `webservice_access_rules` (`api_key`, `method`, `ip_range`, `type`) VALUES (".$db->quote($GLOBALS['STUDIP_API_KEY']).", '', '', 'allow')");
}
}
public function down()
{
$db = DBManager::get();
$db->exec("DROP TABLE `webservice_access_rules` ");
}
}
|