1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_connectivity.hxx"
30*cdf0e10cSrcweir #include "adabas/BUser.hxx"
31*cdf0e10cSrcweir #include "adabas/BGroups.hxx"
32*cdf0e10cSrcweir #include <com/sun/star/sdbc/XRow.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSet.hpp>
34*cdf0e10cSrcweir #include "adabas/BConnection.hxx"
35*cdf0e10cSrcweir #include "connectivity/dbtools.hxx"
36*cdf0e10cSrcweir #include "connectivity/dbexception.hxx"
37*cdf0e10cSrcweir #include <com/sun/star/sdbcx/Privilege.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/sdbcx/PrivilegeObject.hpp>
39*cdf0e10cSrcweir #include "resource/adabas_res.hrc"
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir using namespace connectivity::adabas;
42*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
43*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
44*cdf0e10cSrcweir using namespace ::com::sun::star::sdbcx;
45*cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
46*cdf0e10cSrcweir using namespace ::com::sun::star::container;
47*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
48*cdf0e10cSrcweir // -------------------------------------------------------------------------
49*cdf0e10cSrcweir OAdabasUser::OAdabasUser(	OAdabasConnection* _pConnection) : connectivity::sdbcx::OUser(sal_True)
50*cdf0e10cSrcweir 				,m_pConnection(_pConnection)
51*cdf0e10cSrcweir {
52*cdf0e10cSrcweir 	construct();
53*cdf0e10cSrcweir }
54*cdf0e10cSrcweir // -------------------------------------------------------------------------
55*cdf0e10cSrcweir OAdabasUser::OAdabasUser(   OAdabasConnection* _pConnection,
56*cdf0e10cSrcweir 				const ::rtl::OUString& _Name
57*cdf0e10cSrcweir 			) : connectivity::sdbcx::OUser(_Name,sal_True)
58*cdf0e10cSrcweir 				,m_pConnection(_pConnection)
59*cdf0e10cSrcweir {
60*cdf0e10cSrcweir 	construct();
61*cdf0e10cSrcweir }
62*cdf0e10cSrcweir // -------------------------------------------------------------------------
63*cdf0e10cSrcweir void OAdabasUser::refreshGroups()
64*cdf0e10cSrcweir {
65*cdf0e10cSrcweir 	if(!m_pConnection)
66*cdf0e10cSrcweir 		return;
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir 	TStringVector aVector;
69*cdf0e10cSrcweir 	aVector.reserve(7); // we don't know the excatly count of users but this should fit the normal need
70*cdf0e10cSrcweir 	Reference< XStatement > xStmt = m_pConnection->createStatement(  );
71*cdf0e10cSrcweir 	::rtl::OUString aSql = ::rtl::OUString::createFromAscii("SELECT DISTINCT GROUPNAME FROM DOMAIN.USERS WHERE GROUPNAME IS NOT NULL AND GROUPNAME <> ' ' AND USERNAME = '");
72*cdf0e10cSrcweir 	aSql += getName( );
73*cdf0e10cSrcweir 	aSql += ::rtl::OUString::createFromAscii("'");
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir     Reference< XResultSet > xResult = xStmt->executeQuery(aSql);
76*cdf0e10cSrcweir 	if(xResult.is())
77*cdf0e10cSrcweir 	{
78*cdf0e10cSrcweir                 Reference< XRow > xRow(xResult,UNO_QUERY);
79*cdf0e10cSrcweir 		while(xResult->next())
80*cdf0e10cSrcweir 			aVector.push_back(xRow->getString(1));
81*cdf0e10cSrcweir 		::comphelper::disposeComponent(xResult);
82*cdf0e10cSrcweir 	}
83*cdf0e10cSrcweir 	::comphelper::disposeComponent(xStmt);
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir 	if(m_pGroups)
86*cdf0e10cSrcweir 		m_pGroups->reFill(aVector);
87*cdf0e10cSrcweir 	else
88*cdf0e10cSrcweir 		m_pGroups = new OGroups(*this,m_aMutex,aVector,m_pConnection,this);
89*cdf0e10cSrcweir }
90*cdf0e10cSrcweir // -------------------------------------------------------------------------
91*cdf0e10cSrcweir OUserExtend::OUserExtend(	OAdabasConnection* _pConnection) : OAdabasUser(_pConnection)
92*cdf0e10cSrcweir {
93*cdf0e10cSrcweir 	construct();
94*cdf0e10cSrcweir }
95*cdf0e10cSrcweir // -------------------------------------------------------------------------
96*cdf0e10cSrcweir typedef connectivity::sdbcx::OUser	OUser_TYPEDEF;
97*cdf0e10cSrcweir void OUserExtend::construct()
98*cdf0e10cSrcweir {
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir 	registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD),	PROPERTY_ID_PASSWORD,0,&m_Password,::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
101*cdf0e10cSrcweir }
102*cdf0e10cSrcweir // -----------------------------------------------------------------------------
103*cdf0e10cSrcweir cppu::IPropertyArrayHelper* OUserExtend::createArrayHelper() const
104*cdf0e10cSrcweir {
105*cdf0e10cSrcweir 	Sequence< Property > aProps;
106*cdf0e10cSrcweir 	describeProperties(aProps);
107*cdf0e10cSrcweir 	return new cppu::OPropertyArrayHelper(aProps);
108*cdf0e10cSrcweir }
109*cdf0e10cSrcweir // -------------------------------------------------------------------------
110*cdf0e10cSrcweir cppu::IPropertyArrayHelper & OUserExtend::getInfoHelper()
111*cdf0e10cSrcweir {
112*cdf0e10cSrcweir 	return *OUserExtend_PROP::getArrayHelper();
113*cdf0e10cSrcweir }
114*cdf0e10cSrcweir typedef connectivity::sdbcx::OUser_BASE OUser_BASE_RBHELPER;
115*cdf0e10cSrcweir // -----------------------------------------------------------------------------
116*cdf0e10cSrcweir sal_Int32 SAL_CALL OAdabasUser::getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException)
117*cdf0e10cSrcweir {
118*cdf0e10cSrcweir     if ( objType != PrivilegeObject::TABLE )
119*cdf0e10cSrcweir         return 0;
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
122*cdf0e10cSrcweir 	checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 	sal_Int32 nRights,nRightsWithGrant;
125*cdf0e10cSrcweir 	getAnyTablePrivileges(objName,nRights,nRightsWithGrant);
126*cdf0e10cSrcweir 	return nRights;
127*cdf0e10cSrcweir }
128*cdf0e10cSrcweir // -----------------------------------------------------------------------------
129*cdf0e10cSrcweir void OAdabasUser::getAnyTablePrivileges(const ::rtl::OUString& objName, sal_Int32& nRights,sal_Int32& nRightsWithGrant) throw(SQLException, RuntimeException)
130*cdf0e10cSrcweir {
131*cdf0e10cSrcweir 	nRightsWithGrant = nRights = 0;
132*cdf0e10cSrcweir 	// first we need to create the sql stmt to select the privs
133*cdf0e10cSrcweir 	Reference<XDatabaseMetaData> xMeta = m_pConnection->getMetaData();
134*cdf0e10cSrcweir 	::rtl::OUString sCatalog,sSchema,sTable;
135*cdf0e10cSrcweir 	::dbtools::qualifiedNameComponents(xMeta,objName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation);
136*cdf0e10cSrcweir 	Reference<XStatement> xStmt = m_pConnection->createStatement();
137*cdf0e10cSrcweir 	::rtl::OUString sSql = ::rtl::OUString::createFromAscii("SELECT REFTABLENAME,PRIVILEGES FROM DOMAIN.USR_USES_TAB WHERE REFOBJTYPE <> 'SYSTEM' AND DEFUSERNAME = '");
138*cdf0e10cSrcweir 	sSql += m_Name;
139*cdf0e10cSrcweir 	sSql += ::rtl::OUString::createFromAscii("' AND REFTABLENAME = '");
140*cdf0e10cSrcweir 	sSql += sTable;
141*cdf0e10cSrcweir 	sSql += ::rtl::OUString::createFromAscii("'");
142*cdf0e10cSrcweir 	if(xStmt.is())
143*cdf0e10cSrcweir 	{
144*cdf0e10cSrcweir 		Reference<XResultSet> xRes = xStmt->executeQuery(sSql);
145*cdf0e10cSrcweir 		if(xRes.is())
146*cdf0e10cSrcweir 		{
147*cdf0e10cSrcweir 			Reference<XRow> xRow(xRes,UNO_QUERY);
148*cdf0e10cSrcweir 			if(xRow.is() && xRes->next())
149*cdf0e10cSrcweir 			{
150*cdf0e10cSrcweir 				::rtl::OUString sPrivs = xRow->getString(2);
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir                 struct _priv_nam
153*cdf0e10cSrcweir                 {
154*cdf0e10cSrcweir                     const sal_Char* pAsciiName;
155*cdf0e10cSrcweir                     sal_Int32       nNumericValue;
156*cdf0e10cSrcweir                 } privileges[] =
157*cdf0e10cSrcweir                 {
158*cdf0e10cSrcweir                     { "INS", Privilege::INSERT },
159*cdf0e10cSrcweir                     { "DEL", Privilege::DELETE },
160*cdf0e10cSrcweir                     { "UPD", Privilege::UPDATE },
161*cdf0e10cSrcweir                     { "ALT", Privilege::ALTER },
162*cdf0e10cSrcweir                     { "SEL", Privilege::SELECT },
163*cdf0e10cSrcweir                     { "REF", Privilege::REFERENCE }
164*cdf0e10cSrcweir                 };
165*cdf0e10cSrcweir                 for ( size_t i = 0; i < sizeof( privileges ) / sizeof( privileges[0] ); ++i )
166*cdf0e10cSrcweir                 {
167*cdf0e10cSrcweir                     sal_Int32 nIndex = sPrivs.indexOf( ::rtl::OUString::createFromAscii( privileges[i].pAsciiName ) );
168*cdf0e10cSrcweir                     if ( nIndex == -1 )
169*cdf0e10cSrcweir                         continue;
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir                     nRights |= privileges[i].nNumericValue;
172*cdf0e10cSrcweir                     if ( sPrivs.copy( nIndex + 2, 1 ).equalsAscii( "+" ) )
173*cdf0e10cSrcweir                         nRightsWithGrant |= privileges[i].nNumericValue;
174*cdf0e10cSrcweir                 }
175*cdf0e10cSrcweir 			}
176*cdf0e10cSrcweir 			::comphelper::disposeComponent(xRes);
177*cdf0e10cSrcweir 		}
178*cdf0e10cSrcweir 		::comphelper::disposeComponent(xStmt);
179*cdf0e10cSrcweir 	}
180*cdf0e10cSrcweir }
181*cdf0e10cSrcweir // -------------------------------------------------------------------------
182*cdf0e10cSrcweir sal_Int32 SAL_CALL OAdabasUser::getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(SQLException, RuntimeException)
183*cdf0e10cSrcweir {
184*cdf0e10cSrcweir     if ( objType != PrivilegeObject::TABLE )
185*cdf0e10cSrcweir         return 0;
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
188*cdf0e10cSrcweir 	checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir 	sal_Int32 nRights,nRightsWithGrant;
191*cdf0e10cSrcweir 	getAnyTablePrivileges(objName,nRights,nRightsWithGrant);
192*cdf0e10cSrcweir 	return nRightsWithGrant;
193*cdf0e10cSrcweir }
194*cdf0e10cSrcweir // -------------------------------------------------------------------------
195*cdf0e10cSrcweir void SAL_CALL OAdabasUser::grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException)
196*cdf0e10cSrcweir {
197*cdf0e10cSrcweir     if ( objType != PrivilegeObject::TABLE )
198*cdf0e10cSrcweir         m_pConnection->throwGenericSQLException(STR_PRIVILEGE_NOT_GRANTED,*this);
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
201*cdf0e10cSrcweir 	::rtl::OUString sPrivs = getPrivilegeString(objPrivileges);
202*cdf0e10cSrcweir 	if(sPrivs.getLength())
203*cdf0e10cSrcweir 	{
204*cdf0e10cSrcweir 		::rtl::OUString sGrant;
205*cdf0e10cSrcweir 		sGrant += ::rtl::OUString::createFromAscii("GRANT ");
206*cdf0e10cSrcweir 		sGrant += sPrivs;
207*cdf0e10cSrcweir 		sGrant += ::rtl::OUString::createFromAscii(" ON ");
208*cdf0e10cSrcweir 		Reference<XDatabaseMetaData> xMeta = m_pConnection->getMetaData();
209*cdf0e10cSrcweir 		sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation);
210*cdf0e10cSrcweir 		sGrant += ::rtl::OUString::createFromAscii(" TO ");
211*cdf0e10cSrcweir 		sGrant += m_Name;
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 		Reference<XStatement> xStmt = m_pConnection->createStatement();
214*cdf0e10cSrcweir 		if(xStmt.is())
215*cdf0e10cSrcweir 			xStmt->execute(sGrant);
216*cdf0e10cSrcweir 		::comphelper::disposeComponent(xStmt);
217*cdf0e10cSrcweir 	}
218*cdf0e10cSrcweir }
219*cdf0e10cSrcweir // -------------------------------------------------------------------------
220*cdf0e10cSrcweir void SAL_CALL OAdabasUser::revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(SQLException, RuntimeException)
221*cdf0e10cSrcweir {
222*cdf0e10cSrcweir     if ( objType != PrivilegeObject::TABLE )
223*cdf0e10cSrcweir         m_pConnection->throwGenericSQLException(STR_PRIVILEGE_NOT_REVOKED,*this);
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
226*cdf0e10cSrcweir 	checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
227*cdf0e10cSrcweir     ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges);
228*cdf0e10cSrcweir 	if(sPrivs.getLength())
229*cdf0e10cSrcweir 	{
230*cdf0e10cSrcweir 		::rtl::OUString sGrant;
231*cdf0e10cSrcweir 		sGrant += ::rtl::OUString::createFromAscii("REVOKE ");
232*cdf0e10cSrcweir 		sGrant += sPrivs;
233*cdf0e10cSrcweir 		sGrant += ::rtl::OUString::createFromAscii(" ON ");
234*cdf0e10cSrcweir 		Reference<XDatabaseMetaData> xMeta = m_pConnection->getMetaData();
235*cdf0e10cSrcweir 		sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation);
236*cdf0e10cSrcweir 		sGrant += ::rtl::OUString::createFromAscii(" FROM ");
237*cdf0e10cSrcweir 		sGrant += m_Name;
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir 		Reference<XStatement> xStmt = m_pConnection->createStatement();
240*cdf0e10cSrcweir 		if(xStmt.is())
241*cdf0e10cSrcweir 			xStmt->execute(sGrant);
242*cdf0e10cSrcweir 		::comphelper::disposeComponent(xStmt);
243*cdf0e10cSrcweir 	}
244*cdf0e10cSrcweir }
245*cdf0e10cSrcweir // -----------------------------------------------------------------------------
246*cdf0e10cSrcweir // XUser
247*cdf0e10cSrcweir void SAL_CALL OAdabasUser::changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(SQLException, RuntimeException)
248*cdf0e10cSrcweir {
249*cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
250*cdf0e10cSrcweir 	checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed);
251*cdf0e10cSrcweir 	::rtl::OUString sAlterPwd;
252*cdf0e10cSrcweir 	sAlterPwd = ::rtl::OUString::createFromAscii("ALTER PASSWORD \"");
253*cdf0e10cSrcweir 	sAlterPwd += objPassword.toAsciiUpperCase();
254*cdf0e10cSrcweir 	sAlterPwd += ::rtl::OUString::createFromAscii("\" TO \"") ;
255*cdf0e10cSrcweir 	sAlterPwd += newPassword.toAsciiUpperCase();
256*cdf0e10cSrcweir 	sAlterPwd += ::rtl::OUString::createFromAscii("\"") ;
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir 	sal_Bool bDisposeConnection = sal_False;
259*cdf0e10cSrcweir 	Reference<XConnection> xConnection = m_pConnection;
260*cdf0e10cSrcweir 	if(m_pConnection->getMetaData()->getUserName() != m_Name)
261*cdf0e10cSrcweir 	{
262*cdf0e10cSrcweir 		OAdabasConnection* pNewConnection = new OAdabasConnection(m_pConnection->getDriverHandle(),m_pConnection->getDriver());
263*cdf0e10cSrcweir 		xConnection = pNewConnection;
264*cdf0e10cSrcweir 		if(pNewConnection)
265*cdf0e10cSrcweir 		{
266*cdf0e10cSrcweir 			Sequence< PropertyValue> aSeq(2);
267*cdf0e10cSrcweir 			aSeq.getArray()[0].Name		= ::rtl::OUString::createFromAscii("user") ;
268*cdf0e10cSrcweir 			aSeq.getArray()[0].Value	<<= m_Name;
269*cdf0e10cSrcweir 			aSeq.getArray()[1].Name		= ::rtl::OUString::createFromAscii("password") ;
270*cdf0e10cSrcweir 			aSeq.getArray()[1].Value	<<= objPassword;
271*cdf0e10cSrcweir 			pNewConnection->Construct(m_pConnection->getMetaData()->getURL(),aSeq);
272*cdf0e10cSrcweir 		}
273*cdf0e10cSrcweir 		bDisposeConnection = sal_True;
274*cdf0e10cSrcweir 	}
275*cdf0e10cSrcweir 	if(xConnection.is())
276*cdf0e10cSrcweir 	{
277*cdf0e10cSrcweir 		Reference<XStatement> xStmt = xConnection->createStatement();
278*cdf0e10cSrcweir 		if(xStmt.is())
279*cdf0e10cSrcweir 			xStmt->execute(sAlterPwd);
280*cdf0e10cSrcweir 		::comphelper::disposeComponent(xStmt);
281*cdf0e10cSrcweir 		if(bDisposeConnection)
282*cdf0e10cSrcweir 			::comphelper::disposeComponent(xConnection);
283*cdf0e10cSrcweir 	}
284*cdf0e10cSrcweir 	else
285*cdf0e10cSrcweir 		::dbtools::throwFunctionSequenceException(*this);
286*cdf0e10cSrcweir }
287*cdf0e10cSrcweir // -----------------------------------------------------------------------------
288*cdf0e10cSrcweir ::rtl::OUString OAdabasUser::getPrivilegeString(sal_Int32 nRights) const
289*cdf0e10cSrcweir {
290*cdf0e10cSrcweir 	::rtl::OUString sPrivs;
291*cdf0e10cSrcweir 	if((nRights & Privilege::INSERT) == Privilege::INSERT)
292*cdf0e10cSrcweir 		sPrivs += ::rtl::OUString::createFromAscii("INSERT");
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 	if((nRights & Privilege::DELETE) == Privilege::DELETE)
295*cdf0e10cSrcweir 	{
296*cdf0e10cSrcweir 		if(sPrivs.getLength())
297*cdf0e10cSrcweir 			sPrivs += ::rtl::OUString::createFromAscii(",");
298*cdf0e10cSrcweir 		sPrivs += ::rtl::OUString::createFromAscii("DELETE");
299*cdf0e10cSrcweir 	}
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir 	if((nRights & Privilege::UPDATE) == Privilege::UPDATE)
302*cdf0e10cSrcweir 	{
303*cdf0e10cSrcweir 		if(sPrivs.getLength())
304*cdf0e10cSrcweir 			sPrivs += ::rtl::OUString::createFromAscii(",");
305*cdf0e10cSrcweir 		sPrivs += ::rtl::OUString::createFromAscii("UPDATE");
306*cdf0e10cSrcweir 	}
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir 	if((nRights & Privilege::ALTER) == Privilege::ALTER)
309*cdf0e10cSrcweir 	{
310*cdf0e10cSrcweir 		if(sPrivs.getLength())
311*cdf0e10cSrcweir 			sPrivs += ::rtl::OUString::createFromAscii(",");
312*cdf0e10cSrcweir 		sPrivs += ::rtl::OUString::createFromAscii("ALTER");
313*cdf0e10cSrcweir 	}
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 	if((nRights & Privilege::SELECT) == Privilege::SELECT)
316*cdf0e10cSrcweir 	{
317*cdf0e10cSrcweir 		if(sPrivs.getLength())
318*cdf0e10cSrcweir 			sPrivs += ::rtl::OUString::createFromAscii(",");
319*cdf0e10cSrcweir 		sPrivs += ::rtl::OUString::createFromAscii("SELECT");
320*cdf0e10cSrcweir 	}
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir 	if((nRights & Privilege::REFERENCE) == Privilege::REFERENCE)
323*cdf0e10cSrcweir 	{
324*cdf0e10cSrcweir 		if(sPrivs.getLength())
325*cdf0e10cSrcweir 			sPrivs += ::rtl::OUString::createFromAscii(",");
326*cdf0e10cSrcweir 		sPrivs += ::rtl::OUString::createFromAscii("REFERENCES");
327*cdf0e10cSrcweir 	}
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir 	return sPrivs;
330*cdf0e10cSrcweir }
331*cdf0e10cSrcweir // -----------------------------------------------------------------------------
332*cdf0e10cSrcweir 
333