1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
27 using namespace connectivity
;
28 using namespace connectivity::sdbcx
;
29 using namespace ::com::sun::star::sdbc
;
30 using namespace ::com::sun::star::beans
;
31 using namespace ::com::sun::star::uno
;
32 using namespace ::com::sun::star::container
;
33 using namespace ::com::sun::star::lang
;
35 IMPLEMENT_SERVICE_INFO(OUser
,"com.sun.star.sdbcx.VUser","com.sun.star.sdbcx.User");
37 OUser::OUser(bool _bCase
) : OUser_BASE(m_aMutex
)
38 , ODescriptor(OUser_BASE::rBHelper
,_bCase
,true)
42 OUser::OUser(const OUString
& Name
, bool _bCase
) : OUser_BASE(m_aMutex
)
43 ,ODescriptor(OUser_BASE::rBHelper
,_bCase
)
52 void OUser::disposing()
54 OPropertySetHelper::disposing();
55 ::osl::MutexGuard
aGuard(m_aMutex
);
57 m_pGroups
->disposing();
60 Any SAL_CALL
OUser::queryInterface( const Type
& rType
)
62 Any aRet
= ODescriptor::queryInterface( rType
);
63 return aRet
.hasValue() ? aRet
: OUser_BASE::queryInterface( rType
);
66 Sequence
< Type
> SAL_CALL
OUser::getTypes( )
68 return ::comphelper::concatSequences(ODescriptor::getTypes(),OUser_BASE::getTypes());
71 ::cppu::IPropertyArrayHelper
* OUser::createArrayHelper( ) const
73 Sequence
< Property
> aProps
;
74 describeProperties(aProps
);
75 return new ::cppu::OPropertyArrayHelper(aProps
);
79 ::cppu::IPropertyArrayHelper
& OUser::getInfoHelper()
81 return *getArrayHelper();
85 void SAL_CALL
OUser::changePassword( const OUString
& /*objPassword*/, const OUString
& /*newPassword*/ )
87 ::osl::MutexGuard
aGuard(m_aMutex
);
88 checkDisposed(OUser_BASE::rBHelper
.bDisposed
);
89 ::dbtools::throwFeatureNotImplementedSQLException( "XUser::changePassword", *this );
93 Reference
< XNameAccess
> SAL_CALL
OUser::getGroups( )
95 ::osl::MutexGuard
aGuard(m_aMutex
);
96 checkDisposed(OUser_BASE::rBHelper
.bDisposed
);
103 catch( const RuntimeException
& )
105 // allowed to leave this method
108 catch( const Exception
& )
113 return m_pGroups
.get();
117 SAL_WNOUNREACHABLE_CODE_PUSH
119 sal_Int32 SAL_CALL
OUser::getPrivileges( const OUString
& /*objName*/, sal_Int32
/*objType*/ )
121 ::osl::MutexGuard
aGuard(m_aMutex
);
122 checkDisposed(OUser_BASE::rBHelper
.bDisposed
);
123 ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::changePassword", *this );
127 sal_Int32 SAL_CALL
OUser::getGrantablePrivileges( const OUString
& /*objName*/, sal_Int32
/*objType*/ )
129 ::osl::MutexGuard
aGuard(m_aMutex
);
130 checkDisposed(OUser_BASE::rBHelper
.bDisposed
);
131 ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::getGrantablePrivileges", *this );
135 SAL_WNOUNREACHABLE_CODE_POP
138 void SAL_CALL
OUser::grantPrivileges( const OUString
& /*objName*/, sal_Int32
/*objType*/, sal_Int32
/*objPrivileges*/ )
140 ::osl::MutexGuard
aGuard(m_aMutex
);
141 checkDisposed(OUser_BASE::rBHelper
.bDisposed
);
142 ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::grantPrivileges", *this );
145 void SAL_CALL
OUser::revokePrivileges( const OUString
& /*objName*/, sal_Int32
/*objType*/, sal_Int32
/*objPrivileges*/ )
147 ::osl::MutexGuard
aGuard(m_aMutex
);
148 checkDisposed(OUser_BASE::rBHelper
.bDisposed
);
149 ::dbtools::throwFeatureNotImplementedSQLException( "XAuthorizable::revokePrivileges", *this );
152 css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
OUser::getPropertySetInfo( )
154 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
157 OUString SAL_CALL
OUser::getName( )
162 void SAL_CALL
OUser::setName( const OUString
& /*aName*/ )
164 OSL_FAIL( "OUser::setName: not implemented!" );
165 // not allowed to throw an SQLException here ...
169 void SAL_CALL
OUser::acquire() throw()
171 OUser_BASE::acquire();
174 void SAL_CALL
OUser::release() throw()
176 OUser_BASE::release();
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */