mirror of
https://github.com/silverstripe/silverstripe-postgresql
synced 2024-10-22 17:05:45 +02:00
Fixes alter table problem
If you can log in (with write permissons), you can alter tables.
This commit is contained in:
parent
1aeb7b1436
commit
7bb29a9288
@ -177,16 +177,16 @@ class PostgreSQLDatabaseConfigurationHelper implements DatabaseConfigurationHelp
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function requireDatabaseAlterPermissions($databaseConfig) {
|
public function requireDatabaseAlterPermissions($databaseConfig) {
|
||||||
$success = false;
|
|
||||||
$conn = $this->createConnection($databaseConfig, $error);
|
$conn = $this->createConnection($databaseConfig, $error);
|
||||||
if($conn) {
|
if($conn) {
|
||||||
// Check if this user has create privileges on the default tablespace
|
// if the account can even log in, it can alter tables
|
||||||
$sqlUsername = $this->quote($conn, $databaseConfig['username']);
|
return array(
|
||||||
$permissions = $this->query($conn, "select * from has_tablespace_privilege($sqlUsername, 'pg_default', 'create')");
|
'success' => true,
|
||||||
$success = $permissions && (reset($permissions) == 't');
|
'applies' => true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return array(
|
return array(
|
||||||
'success' => $success,
|
'success' => false,
|
||||||
'applies' => true
|
'applies' => true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user