Tag: cws_src680_odbmacros2 User: fs Date: 2008-01-24 14:09:42+0000 Modified: dba/dbaccess/source/core/dataaccess/datasource.cxx
Log: during #i49133#: the authentication continuation does not need the 'data source is read-only' flag File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: datasource.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/datasource.cxx?r1=1.74.2.2&r2=1.74.2.3 Delta lines: +20 -16 --------------------- --- datasource.cxx 2008-01-24 10:05:09+0000 1.74.2.2 +++ datasource.cxx 2008-01-24 14:09:38+0000 1.74.2.3 @@ -4,9 +4,9 @@ * * $RCSfile: datasource.cxx,v $ * - * $Revision: 1.74.2.2 $ + * $Revision: 1.74.2.3 $ * - * last change: $Author: fs $ $Date: 2008/01/24 10:05:09 $ + * last change: $Author: fs $ $Date: 2008/01/24 14:09:38 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -52,6 +52,9 @@ #ifndef TOOLS_DIAGNOSE_EX_H #include <tools/diagnose_ex.h> #endif +#ifndef _URLOBJ_HXX +#include <tools/urlobj.hxx> +#endif #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> #endif @@ -279,16 +282,13 @@ //============================================================ class OAuthenticationContinuation : public OInteraction< XInteractionSupplyAuthentication > { - sal_Bool m_bDatasourceReadonly : 1; // if sal_True, the data source using this continuation - // is readonly, which means that no user can be set and - // the password can't be remembered sal_Bool m_bRemberPassword : 1; // remember the password for this session ? ::rtl::OUString m_sUser; // the user ::rtl::OUString m_sPassword; // the user's password public: - OAuthenticationContinuation(sal_Bool _bReadOnlyDS = sal_False); + OAuthenticationContinuation(); sal_Bool SAL_CALL canSetRealm( ) throw(RuntimeException); void SAL_CALL setRealm( const ::rtl::OUString& Realm ) throw(RuntimeException); @@ -309,9 +309,8 @@ }; //-------------------------------------------------------------------------- - OAuthenticationContinuation::OAuthenticationContinuation(sal_Bool _bReadOnlyDS) - :m_bDatasourceReadonly(_bReadOnlyDS) - ,m_bRemberPassword(sal_True) // TODO: a meaningfull default + OAuthenticationContinuation::OAuthenticationContinuation() + :m_bRemberPassword(sal_True) // TODO: a meaningfull default { } @@ -330,7 +329,9 @@ //-------------------------------------------------------------------------- sal_Bool SAL_CALL OAuthenticationContinuation::canSetUserName( ) throw(RuntimeException) { - return !m_bDatasourceReadonly; + // we alwas allow this, even if the database document is read-only. In this case, + // it's simply that the user cannot store the new user name. + return sal_True; } //-------------------------------------------------------------------------- @@ -355,7 +356,7 @@ Sequence< RememberAuthentication > SAL_CALL OAuthenticationContinuation::getRememberPasswordModes( RememberAuthentication& _reDefault ) throw(RuntimeException) { Sequence< RememberAuthentication > aReturn(1); - _reDefault = aReturn[0] = (m_bDatasourceReadonly ? RememberAuthentication_NO : RememberAuthentication_SESSION); + _reDefault = aReturn[0] = RememberAuthentication_SESSION; return aReturn; } @@ -930,9 +931,6 @@ sal_Bool bModified(sal_False); if ( m_pImpl.is() ) { - if (m_pImpl->m_bReadOnly) - throw IllegalArgumentException(); - switch (nHandle) { case PROPERTY_ID_TABLEFILTER: @@ -1264,11 +1262,17 @@ // build an interaction request // two continuations (Ok and Cancel) OInteractionAbort* pAbort = new OInteractionAbort; - OAuthenticationContinuation* pAuthenticate = new OAuthenticationContinuation(m_pImpl->m_bReadOnly); + OAuthenticationContinuation* pAuthenticate = new OAuthenticationContinuation; + + // the name which should be referred in the login dialog + ::rtl::OUString sServerName( m_pImpl->m_sName ); + INetURLObject aURLCheck( sServerName ); + if ( aURLCheck.GetProtocol() != INET_PROT_NOT_VALID ) + sServerName = aURLCheck.getName(); // the request AuthenticationRequest aRequest; - aRequest.ServerName = m_pImpl->m_sName; + aRequest.ServerName = sServerName; aRequest.HasRealm = aRequest.HasAccount = sal_False; aRequest.HasUserName = aRequest.HasPassword = sal_True; aRequest.UserName = m_pImpl->m_sUser; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
