bug 9873: create default security group for the default admin

status 9873: resolved fixed

Conflicts:

	setup/db/create-schema.sql
This commit is contained in:
alena 2011-05-17 15:13:48 -07:00
parent 550a4cda66
commit 629140af2d
2 changed files with 15 additions and 1 deletions

View File

@ -367,6 +367,19 @@ public class ConfigurationServerImpl implements ConfigurationServer {
// now insert the user
insertSql = "INSERT INTO `cloud`.`user` (id, username, password, account_id, firstname, lastname, created) " +
"VALUES (" + id + ",'" + username + "','" + sb.toString() + "', 2, '" + firstname + "','" + lastname + "',now())";
txn = Transaction.currentTxn();
try {
PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
stmt.executeUpdate();
} catch (SQLException ex) {
}
//save default security group
insertSql = "INSERT INTO `cloud`.`security_group` (name, description, account_id, domain_id, account_name) " +
"VALUES ('default', 'Default Security Group', 2, 1, 'admin')";
txn = Transaction.currentTxn();
try {
@ -864,5 +877,5 @@ public class ConfigurationServerImpl implements ConfigurationServer {
}
return networks.get(0).getId();
}
}

View File

@ -1282,6 +1282,7 @@ CREATE TABLE `cloud`.`security_group` (
`domain_id` bigint unsigned NOT NULL,
`account_id` bigint unsigned NOT NULL,
`account_name` varchar(100) NOT NULL,
UNIQUE (`name`, `account_id`),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;