summaryrefslogtreecommitdiff
path: root/installer/helpers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-01-12 01:34:36 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-01-12 01:34:36 +0000
commitdf44265401f7c45ba833335e7b00d477d3e63797 (patch)
treea639c2622fe2a543d874bc973bf653f22ef1cc97 /installer/helpers
parent59202b943e4e0a6d29fdda922e670cc4e5f8beb7 (diff)
Check to insure that the supplied user had the required permissions
Diffstat (limited to 'installer/helpers')
-rw-r--r--installer/helpers/installer.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/installer/helpers/installer.php b/installer/helpers/installer.php
index e510cf49..8bc73619 100644
--- a/installer/helpers/installer.php
+++ b/installer/helpers/installer.php
@@ -257,6 +257,11 @@ class installer {
self::$database =
new $class(self::$config["host"], self::$config["user"], self::$config["password"]);
+ /*
+ * If we got this far, then the user/password combination is valid and we can now
+ * a little more information for the individual that is running the script. We can also
+ * connect to the database and ask for more information
+ */
$databases = self::$database->list_dbs();
$dbname = self::$config["dbname"];
$db_config_valid = true;
@@ -268,6 +273,25 @@ class installer {
$section["msgs"]["Database"] = array("text" => "Database '$dbname' is defined",
"error" => false);
}
+
+ $missing = array();
+ $rights = self::$database->get_access_rights($dbname);
+
+ foreach (array("create", "delete", "insert", "select", "update", "alter") as $priviledge) {
+ if (empty($rights[$priviledge])) {
+ $missing[] = $priviledge;
+ }
+ }
+ if (!empty($missing)) {
+ $db_config_valid = false;
+ $section["msgs"]["Privileges"] =
+ array("text" => "The following required priviledges have not been granted: " .
+ implode(", ", $missing), "error" => true);
+ } else {
+ $section["msgs"]["Privileges"] = array("text" => "Required priviledges defined.",
+ "error" => false);
+ }
+
self::$messages[] = $section;