From c27579a6570174d16e356f8f3a3225a96ead8496 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Sat, 30 Jan 2016 18:39:21 +0100
Subject: [PATCH] added translations and metadata

---
 lib/plugins/authpdo/auth.php             |  3 +++
 lib/plugins/authpdo/conf/default.php     | 14 ++++++++++----
 lib/plugins/authpdo/conf/metadata.php    | 18 +++++++++++++++++-
 lib/plugins/authpdo/lang/en/lang.php     | 13 +++++--------
 lib/plugins/authpdo/lang/en/settings.php | 23 +++++++++++++++++------
 5 files changed, 52 insertions(+), 19 deletions(-)

diff --git a/lib/plugins/authpdo/auth.php b/lib/plugins/authpdo/auth.php
index 23ce780d3..45b2ca647 100644
--- a/lib/plugins/authpdo/auth.php
+++ b/lib/plugins/authpdo/auth.php
@@ -48,6 +48,7 @@ class auth_plugin_authpdo extends DokuWiki_Auth_Plugin {
             );
         } catch(PDOException $e) {
             $this->_debug($e);
+            msg($this->getLang('connectfail'), -1);
             $this->success = false;
             return;
         }
@@ -253,6 +254,7 @@ class auth_plugin_authpdo extends DokuWiki_Auth_Plugin {
         FAIL:
         $this->pdo->rollBack();
         $this->_debug('Transaction rolled back', 0, __LINE__);
+        msg($this->getLang('writefail'), -1);
         return null; // return error
     }
 
@@ -342,6 +344,7 @@ class auth_plugin_authpdo extends DokuWiki_Auth_Plugin {
         FAIL:
         $this->pdo->rollBack();
         $this->_debug('Transaction rolled back', 0, __LINE__);
+        msg($this->getLang('writefail'), -1);
         return false; // return error
     }
 
diff --git a/lib/plugins/authpdo/conf/default.php b/lib/plugins/authpdo/conf/default.php
index 50dfbd0c9..4e2503716 100644
--- a/lib/plugins/authpdo/conf/default.php
+++ b/lib/plugins/authpdo/conf/default.php
@@ -5,7 +5,6 @@
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 
-
 $conf['debug'] = 0;
 $conf['dsn'] = '';
 $conf['user'] = '';
@@ -19,12 +18,20 @@ $conf['pass'] = '';
  */
 $conf['select-user'] = '';
 
+/**
+ * statement to select a single user identified by its login name
+ *
+ * input: :user, [uid]
+ * return: group
+ */
+$conf['select-user-groups'] = '';
+
 /**
  * Select all the existing group names
  *
  * return: group, [gid], [*]
  */
-$conf['select-group'] = '';
+$conf['select-groups'] = '';
 
 /**
  * Create a new user
@@ -58,8 +65,7 @@ $conf['list-users'] = '';
  * input: :user, :name, :mail, :group
  * out: count
  */
-$conf['list-users'] = '';
-
+$conf['count-users'] = '';
 
 /**
  * Update user data (except password and user name)
diff --git a/lib/plugins/authpdo/conf/metadata.php b/lib/plugins/authpdo/conf/metadata.php
index e020d5c45..2fb4a86bf 100644
--- a/lib/plugins/authpdo/conf/metadata.php
+++ b/lib/plugins/authpdo/conf/metadata.php
@@ -5,6 +5,22 @@
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 
+$meta['debug']              = array('onoff', '_caution' => 'security');
+$meta['dsn']                = array('string', '_caution' => 'danger');
+$meta['user']               = array('string', '_caution' => 'danger');
+$meta['pass']               = array('password', '_caution' => 'danger');
+$meta['select-user']        = array('', '_caution' => 'danger');
+$meta['select-user-groups'] = array('', '_caution' => 'danger');
+$meta['select-groups']      = array('', '_caution' => 'danger');
+$meta['insert-user']        = array('', '_caution' => 'danger');
+$meta['delete-user']        = array('', '_caution' => 'danger');
+$meta['list-users']         = array('', '_caution' => 'danger');
+$meta['count-users']        = array('', '_caution' => 'danger');
+$meta['update-user-info']   = array('', '_caution' => 'danger');
+$meta['update-user-login']  = array('', '_caution' => 'danger');
+$meta['update-user-pass']   = array('', '_caution' => 'danger');
+$meta['insert-group']       = array('', '_caution' => 'danger');
+$meta['join-group']         = array('', '_caution' => 'danger');
+$meta['leave-group']        = array('', '_caution' => 'danger');
 
-//$meta['fixme'] = array('string');
 
diff --git a/lib/plugins/authpdo/lang/en/lang.php b/lib/plugins/authpdo/lang/en/lang.php
index de9f81252..a0057519b 100644
--- a/lib/plugins/authpdo/lang/en/lang.php
+++ b/lib/plugins/authpdo/lang/en/lang.php
@@ -1,16 +1,13 @@
 <?php
 /**
  * English language file for authpdo plugin
+ * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
  *
- * @author Andreas Gohr <andi@splitbrain.org>
  */
 
-// menu entry for admin plugins
-// $lang['menu'] = 'Your menu entry';
-
-// custom language strings for the plugin
-// $lang['fixme'] = 'FIXME';
-
-
+$lang['connectfail']    = 'Failed to connect to database.';
+$lang['userexists']     = 'Sorry, a user with this login already exists.';
+$lang['usernotexists']  = 'Sorry, that user doesn\'t exist.';
+$lang['writefail']      = 'Unable to modify user data. Please inform the Wiki-Admin';
 
 //Setup VIM: ex: et ts=4 :
diff --git a/lib/plugins/authpdo/lang/en/settings.php b/lib/plugins/authpdo/lang/en/settings.php
index 503511ace..9e700690c 100644
--- a/lib/plugins/authpdo/lang/en/settings.php
+++ b/lib/plugins/authpdo/lang/en/settings.php
@@ -5,9 +5,20 @@
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 
-// keys need to match the config setting name
-// $lang['fixme'] = 'FIXME';
-
-
-
-//Setup VIM: ex: et ts=4 :
+$lang['debug']              = 'Print out detailed error messages. Should be disabled after setup.';
+$lang['dsn']                = 'The DSN to connect to the database.';
+$lang['user']               = 'The user for the above database connection (empty for sqlite)';
+$lang['pass']               = 'The password for the above database connection (empty for sqlite)';
+$lang['select-user']        = 'SQL Statement to select the data of a single user';
+$lang['select-user-groups'] = 'SQL Statement to select all groups of a single user';
+$lang['select-groups']      = 'SQL Statement to select all available groups';
+$lang['insert-user']        = 'SQL Statement to insert a new user into the database';
+$lang['delete-user']        = 'SQL Statement to remove a single user from the database';
+$lang['list-users']         = 'SQL Statement to list users matching a filter';
+$lang['count-users']        = 'SQL Statement to count users matching a filter';
+$lang['update-user-info']   = 'SQL Statement to update the full name and email address of a single user';
+$lang['update-user-login']  = 'SQL Statement to update the login name of a single user';
+$lang['update-user-pass']   = 'SQL Statement to update the password of a single user';
+$lang['insert-group']       = 'SQL Statement to insert a new group into the database';
+$lang['join-group']         = 'SQL Statement to add a user to an exisitng group';
+$lang['leave-group']        = 'SQL Statement to remove a user from a group';
-- 
GitLab