diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2020-03-07 23:15:13 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-03-08 07:12:03 +0100 |
commit | 08334285ec9c7d5356f4b89192a5fba6e6733328 (patch) | |
tree | baa80b75845d7b497370b119b8f1e9bdf278778e | |
parent | 4bca67d21e418eb3981cd63390bf2cb401dabe13 (diff) |
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@collabora.co.uk>
-rw-r--r-- | connectivity/source/drivers/firebird/User.cxx | 11 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/User.hxx | 7 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Users.cxx | 4 |
3 files changed, 16 insertions, 6 deletions
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 cb1690cd997c..fe2f97dcdb54 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 <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 4225b490aa8c..fc8914250ee6 100644 --- a/connectivity/source/drivers/firebird/Users.cxx +++ b/connectivity/source/drivers/firebird/Users.cxx @@ -43,7 +43,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() @@ -51,7 +51,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 --------------------------------------------------------------- |