Skip to content

Commit 77433cd

Browse files
committed
Initial commit of version 1.0.0
1 parent 0a8bdbf commit 77433cd

File tree

161 files changed

+50672
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+50672
-3
lines changed

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,53 @@
1-
im-web
2-
======
3-
41
IM - Infrastructure Manager web GUI
2+
===================================
3+
4+
IM is a tool that ease the access and the usability of IaaS clouds by automating
5+
the VMI selection, deployment, configuration, software installation, monitoring
6+
and update of Virtual Appliances. It supports APIs from a large number of
7+
virtual platforms, making user applications cloud-agnostic. In addition it
8+
integrates a contextualization system to enable the installation and
9+
configuration of all the user required applications providing the user with a
10+
fully functional infrastructure.
11+
12+
13+
1. INSTALLATION
14+
===============
15+
16+
1.1 REQUISITES
17+
--------------
18+
19+
IM web interface is based on PHP, so a web server with PHP support must be installed.
20+
21+
It is also required to install the PHP module to access SQLite databases.
22+
23+
1.2 INSTALLING
24+
--------------
25+
26+
Select a proper path in the document root of the web server to install the IM web interface
27+
(i.e. /var/www/im).
28+
29+
```
30+
$ tar xvzf IM-web-X.XX.tar.gz
31+
$ mv IM-X.XX /var/www/im
32+
$ chown -R www-data /var/www/im
33+
```
34+
35+
1.2 CONFIGURATION
36+
--------------
37+
38+
Adjust the configuration settings in the file config.php:
39+
40+
* Address of the IM host
41+
$im_host="servproject.i3m.upv.es";
42+
* Port of the IM service
43+
$im_port=8899;
44+
* Path of the IM web interface DB. The original path will be /var/www/im/im.db
45+
but is more secure to move it to a path not in the path of the web server.
46+
The file and the directory must have write permissions to the web server user.
47+
$im_db="/home/www-data/im.db";
48+
* In case that the IM service and web interface are in the same host, the Recipes
49+
feature can be activated. Specify the path of the recipes_ansible.db file of the
50+
IM and take care that the file and the directory must have write permissions to
51+
the web server user. In other case set "".
52+
$recipes_db="/usr/local/im/contextualization/recipes_ansible.db";
53+

adduser.php

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10" >
5+
<title>Infrastructure Manager | GRyCAP | UPV</title>
6+
<link rel="shortcut icon" href="images/favicon.ico">
7+
<link href="css/style.css" rel="stylesheet" type="text/css" media="all"/>
8+
<link rel="stylesheet" href="css/style_login2.css">
9+
<link rel="stylesheet" href="css/style_intro2.css">
10+
<link rel="stylesheet" href="css/style_menu2.css">
11+
<link rel="stylesheet" href="css/style_menutab.css">
12+
</head>
13+
<body>
14+
15+
16+
17+
<div id="caja_total_blanca">
18+
19+
20+
<?php include('header.php')?>
21+
22+
23+
<div id="caja_titulo">
24+
<div id="texto_titulo">
25+
Infrastructure Manager > Add User&nbsp&nbsp&nbsp<img class="imagentitulo" src="images/icon_users_gran.png">
26+
</div>
27+
</div>
28+
29+
30+
<div id="caja_contenido_menutab">
31+
32+
<div id='cssmenutab'>
33+
<ul>
34+
<li class='active'><a href='#'><span>Add User</span></a></li>
35+
</ul>
36+
</div>
37+
</div>
38+
39+
40+
<div id="caja_contenido_tab">
41+
42+
43+
44+
45+
46+
<div id="main">
47+
48+
<br>
49+
<div class='h1'>:: Add new User ::</div>
50+
51+
52+
53+
<div id="caja_form_add_users">
54+
55+
<form action="userinfo.php" method="post">
56+
<input type="hidden" name="op" value="register"/>
57+
58+
<table>
59+
<tbody>
60+
<tr>
61+
<th align="left">
62+
Username:
63+
</th>
64+
<td>
65+
<input type="text" name="username" value="<?php echo $username;?>">
66+
</td>
67+
</tr>
68+
<tr>
69+
<th align="left">
70+
Password:
71+
72+
</th>
73+
<td>
74+
<input type="password" name="password" id="password">
75+
</td>
76+
</tr>
77+
<tr>
78+
<th align="left">
79+
Confirm Password:
80+
81+
</th>
82+
<td>
83+
<input type="password" name="password2" id="password2">
84+
</td>
85+
</tr>
86+
<tr>
87+
</tr>
88+
<tr>
89+
<td align="right" colspan="5">
90+
<input type="submit" value="Save"/>
91+
<a href="user_list.php"><input type="button" name="Cancelar" value="Cancel"></a>
92+
</td>
93+
</tr>
94+
</tbody>
95+
</table>
96+
</form>
97+
</div>
98+
</div>
99+
</div>
100+
</div>
101+
<?php include('footer.php')?>
102+
</body>
103+
</html>

config.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/*
3+
IM - Infrastructure Manager
4+
Copyright (C) 2011 - GRyCAP - Universitat Politecnica de Valencia
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
include_once('db.php');
21+
$im_host="servproject.i3m.upv.es";
22+
$im_port=8899;
23+
$im_types = array("OpenNebula","EC2","OpenStack","OCCI","LibVirt","VMRC", "InfrastructureManager");
24+
$im_db="/home/www-data/im.db";
25+
# To use that feature the IM recipes file must accesible to the web server
26+
#$recipes_db="/usr/local/im/contextualization/recipes_ansible.db";
27+
# If not set ""
28+
$recipes_db="";
29+
# To activate the EC3 functionality, currently unavailable
30+
$ec3=False;
31+
$ec3_path="/var/www/im/ec3";
32+
?>

cred.php

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
<?php
2+
/*
3+
IM - Infrastructure Manager
4+
Copyright (C) 2011 - GRyCAP - Universitat Politecnica de Valencia
5+
6+
This program is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
21+
function get_credentials($user) {
22+
include('config.php');
23+
24+
$db = new IMDB();
25+
$res = $db->direct_query("select rowid,* from credentials where imuser = '" . $user . "' order by ord");
26+
$db->close();
27+
return $res;
28+
}
29+
30+
function get_credential($id) {
31+
include('config.php');
32+
33+
$db = new IMDB();
34+
$res = $db->get_items_from_table("credentials", array("rowid" => $id));
35+
$db->close();
36+
if (count($res) > 0)
37+
return $res[0];
38+
else
39+
return NULL;
40+
}
41+
42+
function insert_credential($imuser, $id, $type, $host, $username, $password, $order) {
43+
include('config.php');
44+
45+
$res = "";
46+
$db = new IMDB();
47+
$fields = array();
48+
$fields[] = "'" . $db->escapeString($id) . "'";
49+
$fields[] = "'" . $imuser . "'";
50+
$fields[] = "'" . $type . "'";
51+
$fields[] = "'" . $db->escapeString($host) . "'";
52+
$fields[] = "'" . $db->escapeString($username) . "'";
53+
$fields[] = "'" . $db->escapeString($password) . "'";
54+
$fields[] = 1;
55+
56+
$res = $db->direct_query("select max(ord) as max_ord from credentials where imuser = '" . $imuser . "'");
57+
$fields[] = $res[0]['max_ord']+1;
58+
59+
$res = $db->insert_item_into_table("credentials",$fields);
60+
$db->close();
61+
62+
return $res;
63+
}
64+
65+
function edit_credential($rowid, $id, $type, $host, $username, $password, $order) {
66+
include('config.php');
67+
68+
$res = "";
69+
$db = new IMDB();
70+
$fields = array();
71+
$fields["id"] = "'" . $db->escapeString($id) . "'";
72+
$fields["type"] = "'" . $type . "'";
73+
$fields["host"] = "'" . $db->escapeString($host) . "'";
74+
$fields["username"] = "'" . $db->escapeString($username) . "'";
75+
if (strlen(trim($password)) > 0) {
76+
$fields["password"] = "'" . $db->escapeString($password) . "'";
77+
}
78+
$where = array("rowid" => $rowid);
79+
$res = $db->edit_item_from_table("credentials",$fields,$where);
80+
$db->close();
81+
82+
return $res;
83+
}
84+
85+
function delete_credential($id) {
86+
include('config.php');
87+
88+
$db = new IMDB();
89+
$res = $db->delete_item_from_table("credentials", array("rowid" => $id));
90+
$db->close();
91+
return $res;
92+
}
93+
94+
function enable_credential($id, $enable) {
95+
include('config.php');
96+
97+
$res = "";
98+
$db = new IMDB();
99+
$fields = array("enabled" => $enable);
100+
$where = array("rowid" => $id);
101+
$res = $db->edit_item_from_table("credentials",$fields,$where);
102+
$db->close();
103+
104+
return $res;
105+
}
106+
107+
function change_order($id, $user, $order, $new_order) {
108+
include('config.php');
109+
110+
$res = "";
111+
$db = new IMDB();
112+
$fields = array("ord" => $order);
113+
$where = array("ord" => $new_order, "imuser" => "'" . $user . "'");
114+
$res = $db->edit_item_from_table("credentials",$fields,$where);
115+
116+
if (strlen($res) == 0) {
117+
$fields = array("ord" => $new_order);
118+
$where = array("rowid" => $id);
119+
$res = $db->edit_item_from_table("credentials",$fields,$where);
120+
}
121+
122+
$db->close();
123+
124+
return $res;
125+
}
126+
?>

0 commit comments

Comments
 (0)