bump product version to 6.3.0.0.beta1
[LibreOffice.git] / connectivity / source / sdbcx / VUser.cxx
blob87b450951121bd2a80e1345ff0e3866d0fdf403e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <connectivity/sdbcx/VUser.hxx>
22 #include <com/sun/star/lang/DisposedException.hpp>
23 #include <com/sun/star/sdbcx/Privilege.hpp>
24 #include <com/sun/star/sdbcx/PrivilegeObject.hpp>
25 #include <TConnection.hxx>
26 #include <connectivity/sdbcx/VCollection.hxx>
27 #include <connectivity/dbexception.hxx>
28 #include <comphelper/sequence.hxx>
31 using namespace connectivity;
32 using namespace connectivity::sdbcx;
33 using namespace ::com::sun::star::sdbc;
34 using namespace ::com::sun::star::beans;
35 using namespace ::com::sun::star::uno;
36 using namespace ::com::sun::star::container;
37 using namespace ::com::sun::star::lang;
39 IMPLEMENT_SERVICE_INFO(OUser,"com.sun.star.sdbcx.VUser","com.sun.star.sdbcx.User");
41 OUser::OUser(bool _bCase) : OUser_BASE(m_aMutex)
42 , ODescriptor(OUser_BASE::rBHelper,_bCase,true)
46 OUser::OUser(const OUString& Name, bool _bCase) : OUser_BASE(m_aMutex)
47 ,ODescriptor(OUser_BASE::rBHelper,_bCase)
49 m_Name = Name;
52 OUser::~OUser( )
56 void OUser::disposing()
58 OPropertySetHelper::disposing();
59 ::osl::MutexGuard aGuard(m_aMutex);
60 if(m_pGroups)
61 m_pGroups->disposing();
64 Any SAL_CALL OUser::queryInterface( const Type & rType )
66 Any aRet = ODescriptor::queryInterface( rType);
67 return aRet.hasValue() ? aRet : OUser_BASE::queryInterface( rType);
70 Sequence< Type > SAL_CALL OUser::getTypes( )
72 return ::comphelper::concatSequences(ODescriptor::getTypes(),OUser_BASE::getTypes());
75 ::cppu::IPropertyArrayHelper* OUser::createArrayHelper( ) const
77 Sequence< Property > aProps;
78 describeProperties(aProps);
79 return new ::cppu::OPropertyArrayHelper(aProps);
83 ::cppu::IPropertyArrayHelper & OUser::getInfoHelper()
85 return *getArrayHelper();
88 // XUser
89 void SAL_CALL OUser::changePassword( const OUString& /*objPassword*/, const OUString& /*newPassword*/ )
91 ::osl::MutexGuard aGuard(m_aMutex);
92 checkDisposed(OUser_BASE::rBHelper.bDisposed);
93 ::dbtools::throwFeatureNotImplementedSQLException( "XUser::changePassword", *this );
96 // XGroupsSupplier
97 Reference< XNameAccess > SAL_CALL OUser::getGroups( )
99 ::osl::MutexGuard aGuard(m_aMutex);
100 checkDisposed(OUser_BASE::rBHelper.bDisposed);
104 if ( !m_pGroups )
105 refreshGroups();
107 catch( const RuntimeException& )
109 // allowed to leave this method
110 throw;
112 catch( const Exception& )
114 // allowed
117 return m_pGroups.get();
121 SAL_WNOUNREACHABLE_CODE_PUSH
123 sal_Int32 SAL_CALL OUser::getPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ )
125 ::osl::MutexGuard aGuard(m_aMutex);
126 checkDisposed(OUser_BASE::rBHelper.bDisposed);
127 ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::changePassword", *this );
128 return 0;
131 sal_Int32 SAL_CALL OUser::getGrantablePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ )
133 ::osl::MutexGuard aGuard(m_aMutex);
134 checkDisposed(OUser_BASE::rBHelper.bDisposed);
135 ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::getGrantablePrivileges", *this );
136 return 0;
139 SAL_WNOUNREACHABLE_CODE_POP
142 void SAL_CALL OUser::grantPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ )
144 ::osl::MutexGuard aGuard(m_aMutex);
145 checkDisposed(OUser_BASE::rBHelper.bDisposed);
146 ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::grantPrivileges", *this );
149 void SAL_CALL OUser::revokePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ )
151 ::osl::MutexGuard aGuard(m_aMutex);
152 checkDisposed(OUser_BASE::rBHelper.bDisposed);
153 ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::revokePrivileges", *this );
156 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OUser::getPropertySetInfo( )
158 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
161 OUString SAL_CALL OUser::getName( )
163 return m_Name;
166 void SAL_CALL OUser::setName( const OUString& /*aName*/ )
168 OSL_FAIL( "OUser::setName: not implemented!" );
169 // not allowed to throw an SQLException here ...
172 // XInterface
173 void SAL_CALL OUser::acquire() throw()
175 OUser_BASE::acquire();
178 void SAL_CALL OUser::release() throw()
180 OUser_BASE::release();
184 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */