Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / connectivity / source / sdbcx / VUser.cxx
blob51d05b9387be167b92cecd79ba5eafd10684338d
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 <sdbcx/VUser.hxx>
22 #include <connectivity/sdbcx/VCollection.hxx>
23 #include <connectivity/dbexception.hxx>
24 #include <comphelper/sequence.hxx>
25 #include <o3tl/unreachable.hxx>
28 using namespace connectivity;
29 using namespace connectivity::sdbcx;
30 using namespace ::com::sun::star::sdbc;
31 using namespace ::com::sun::star::beans;
32 using namespace ::com::sun::star::uno;
33 using namespace ::com::sun::star::container;
34 using namespace ::com::sun::star::lang;
36 IMPLEMENT_SERVICE_INFO(OUser,"com.sun.star.sdbcx.VUser","com.sun.star.sdbcx.User");
38 OUser::OUser(bool _bCase) : OUser_BASE(m_aMutex)
39 , ODescriptor(OUser_BASE::rBHelper,_bCase,true)
43 OUser::OUser(const OUString& Name, bool _bCase) : OUser_BASE(m_aMutex)
44 ,ODescriptor(OUser_BASE::rBHelper,_bCase)
46 m_Name = Name;
49 OUser::~OUser( )
53 void OUser::disposing()
55 OPropertySetHelper::disposing();
56 ::osl::MutexGuard aGuard(m_aMutex);
57 if(m_pGroups)
58 m_pGroups->disposing();
61 Any SAL_CALL OUser::queryInterface( const Type & rType )
63 Any aRet = ODescriptor::queryInterface( rType);
64 return aRet.hasValue() ? aRet : OUser_BASE::queryInterface( rType);
67 Sequence< Type > SAL_CALL OUser::getTypes( )
69 return ::comphelper::concatSequences(ODescriptor::getTypes(),OUser_BASE::getTypes());
72 ::cppu::IPropertyArrayHelper* OUser::createArrayHelper( ) const
74 Sequence< Property > aProps;
75 describeProperties(aProps);
76 return new ::cppu::OPropertyArrayHelper(aProps);
80 ::cppu::IPropertyArrayHelper & OUser::getInfoHelper()
82 return *getArrayHelper();
85 // XUser
86 void SAL_CALL OUser::changePassword( const OUString& /*objPassword*/, const OUString& /*newPassword*/ )
88 ::osl::MutexGuard aGuard(m_aMutex);
89 checkDisposed(OUser_BASE::rBHelper.bDisposed);
90 ::dbtools::throwFeatureNotImplementedSQLException( "XUser::changePassword", *this );
93 // XGroupsSupplier
94 Reference< XNameAccess > SAL_CALL OUser::getGroups( )
96 ::osl::MutexGuard aGuard(m_aMutex);
97 checkDisposed(OUser_BASE::rBHelper.bDisposed);
99 try
101 if ( !m_pGroups )
102 refreshGroups();
104 catch( const RuntimeException& )
106 // allowed to leave this method
107 throw;
109 catch( const Exception& )
111 // allowed
114 return m_pGroups.get();
117 sal_Int32 SAL_CALL OUser::getPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ )
119 ::osl::MutexGuard aGuard(m_aMutex);
120 checkDisposed(OUser_BASE::rBHelper.bDisposed);
121 ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::changePassword", *this );
122 O3TL_UNREACHABLE;
125 sal_Int32 SAL_CALL OUser::getGrantablePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/ )
127 ::osl::MutexGuard aGuard(m_aMutex);
128 checkDisposed(OUser_BASE::rBHelper.bDisposed);
129 ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::getGrantablePrivileges", *this );
130 O3TL_UNREACHABLE;
133 void SAL_CALL OUser::grantPrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ )
135 ::osl::MutexGuard aGuard(m_aMutex);
136 checkDisposed(OUser_BASE::rBHelper.bDisposed);
137 ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::grantPrivileges", *this );
140 void SAL_CALL OUser::revokePrivileges( const OUString& /*objName*/, sal_Int32 /*objType*/, sal_Int32 /*objPrivileges*/ )
142 ::osl::MutexGuard aGuard(m_aMutex);
143 checkDisposed(OUser_BASE::rBHelper.bDisposed);
144 ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::revokePrivileges", *this );
147 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OUser::getPropertySetInfo( )
149 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
152 OUString SAL_CALL OUser::getName( )
154 return m_Name;
157 void SAL_CALL OUser::setName( const OUString& /*aName*/ )
159 OSL_FAIL( "OUser::setName: not implemented!" );
160 // not allowed to throw an SQLException here ...
163 // XInterface
164 void SAL_CALL OUser::acquire() noexcept
166 OUser_BASE::acquire();
169 void SAL_CALL OUser::release() noexcept
171 OUser_BASE::release();
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */