[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - connectivity/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 8 13:43:32 UTC 2020


 connectivity/source/drivers/firebird/User.cxx  |   11 +++++++++--
 connectivity/source/drivers/firebird/User.hxx  |    7 +++++--
 connectivity/source/drivers/firebird/Users.cxx |    4 ++--
 3 files changed, 16 insertions(+), 6 deletions(-)

New commits:
commit 877b67f5d69306beb6ceca5b3d75349c2716c77e
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sat Mar 7 23:15:13 2020 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Wed Apr 8 15:43:01 2020 +0200

    tdf#131212: Implement change user password in Firebird
    
    Command retrieved from https://firebirdsql.org/refdocs/langrefupd25-security-sql-user-mgmt.html
    
    Change-Id: Idd16c74cd3b00f8a5c9cc135e11ac032811557f3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90177
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90182
    (cherry picked from commit 358d34e12d8f88543ddca8c0e852712e6ef1b10c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90283
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/connectivity/source/drivers/firebird/User.cxx b/connectivity/source/drivers/firebird/User.cxx
index 024d7eb4958a..a2e6f71e3bed 100644
--- a/connectivity/source/drivers/firebird/User.cxx
+++ b/connectivity/source/drivers/firebird/User.cxx
@@ -16,15 +16,22 @@ using namespace ::connectivity::sdbcx;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::sdbc;
 
-User::User():
+User::User(const css::uno::Reference< css::sdbc::XConnection >& rConnection):
     OUser(true) // Case Sensitive
+    , m_xConnection(rConnection)
 {}
 
-User::User(const OUString& rName):
+User::User(const css::uno::Reference< css::sdbc::XConnection >& rConnection, const OUString& rName):
     OUser(rName,
           true) // Case Sensitive
+    , m_xConnection(rConnection)
 {}
 
+void User::changePassword(const OUString&, const OUString& newPassword)
+{
+    m_xConnection->createStatement()->execute("ALTER USER " + m_Name + " PASSWORD '" + newPassword + "'");
+}
+
 //----- IRefreshableGroups ----------------------------------------------------
 void User::refreshGroups()
 {
diff --git a/connectivity/source/drivers/firebird/User.hxx b/connectivity/source/drivers/firebird/User.hxx
index d2cc091000b9..ff1de34ea5fb 100644
--- a/connectivity/source/drivers/firebird/User.hxx
+++ b/connectivity/source/drivers/firebird/User.hxx
@@ -11,6 +11,7 @@
 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_USER_HXX
 
 #include <connectivity/sdbcx/VUser.hxx>
+#include <com/sun/star/sdbc/XConnection.hpp>
 
 namespace connectivity
 {
@@ -22,17 +23,19 @@ namespace connectivity
          */
         class User: public ::connectivity::sdbcx::OUser
         {
+            css::uno::Reference< css::sdbc::XConnection > m_xConnection;
 
         public:
             /**
              * Create a "new" descriptor, which isn't yet in the database.
              */
-            User();
+            User(const css::uno::Reference< css::sdbc::XConnection >& rConnection);
             /**
              * For a user that already exists in the db.
              */
-            User(const OUString& rName);
+            User(const css::uno::Reference< css::sdbc::XConnection >& rConnection, const OUString& rName);
 
+            virtual void SAL_CALL changePassword(const OUString&, const OUString& newPassword) override;
             // IRefreshableGroups::
             virtual void refreshGroups() override;
         };
diff --git a/connectivity/source/drivers/firebird/Users.cxx b/connectivity/source/drivers/firebird/Users.cxx
index 0423d9c33181..061200fde5d3 100644
--- a/connectivity/source/drivers/firebird/Users.cxx
+++ b/connectivity/source/drivers/firebird/Users.cxx
@@ -47,7 +47,7 @@ void Users::impl_refresh()
 
 ObjectType Users::createObject(const OUString& rName)
 {
-    return new User(rName);
+    return new User(m_xMetaData->getConnection(), rName);
 }
 
 uno::Reference< XPropertySet > Users::createDescriptor()
@@ -55,7 +55,7 @@ uno::Reference< XPropertySet > Users::createDescriptor()
     // There is some internal magic so that the same class can be used as either
     // a descriptor or as a normal user. See VUser.cxx for the details. In our
     // case we just need to ensure we use the correct constructor.
-    return new User;
+    return new User(m_xMetaData->getConnection());
 }
 
 //----- XAppend ---------------------------------------------------------------


More information about the Libreoffice-commits mailing list