aboutsummaryrefslogtreecommitdiff
path: root/sqlite3.go
diff options
context:
space:
mode:
authorGert-Jan Timmer <gjr.timmer@gmail.com>2018-05-31 14:55:22 +0200
committerGert-Jan Timmer <gjr.timmer@gmail.com>2018-05-31 14:55:22 +0200
commit183e7d61d12d767363bf91073584300a2d470507 (patch)
tree533348da9033332bc41610bf81d543c49fe9b2bf /sqlite3.go
parentFix: Free memory (diff)
downloadgolite-183e7d61d12d767363bf91073584300a2d470507.tar.gz
golite-183e7d61d12d767363bf91073584300a2d470507.tar.xz
UPD: User Authentication
Implemented table check; only activate User Authentication on a database which has no UA enabled. Closes #582
Diffstat (limited to 'sqlite3.go')
-rw-r--r--sqlite3.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/sqlite3.go b/sqlite3.go
index 8a15696..56cb262 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -1368,14 +1368,8 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
return nil, fmt.Errorf("Missing '_auth_pass' while user authentication was requested with '_auth'")
}
- // TODO: Table exists check for table 'sqlite_user'
- // replace 'authExists := false' with return value of table exists check
- //
- // REPLACE BY RESULT FROM TABLE EXISTS
- // SELECT count(type) as exists FROM sqlite_master WHERE type='table' AND name='sqlite_user';
- // Scan result 'exists' and use it instead of boolean below.
- authExists := false
-
+ // Check if User Authentication is Enabled
+ authExists := conn.AuthIsEnabled()
if !authExists {
if err := conn.AuthUserAdd(authUser, authPass, true); err != nil {
return nil, err