1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _CONNECTIVITY_SDBCX_USER_HXX_
25 #define _CONNECTIVITY_SDBCX_USER_HXX_
26 
27 #include <osl/diagnose.h>
28 #include <com/sun/star/sdbcx/XUser.hpp>
29 #include <com/sun/star/sdbcx/XGroupsSupplier.hpp>
30 #include <comphelper/proparrhlp.hxx>
31 #include <cppuhelper/compbase4.hxx>
32 #include "connectivity/CommonTools.hxx"
33 #include <comphelper/broadcasthelper.hxx>
34 #include "connectivity/sdbcx/VCollection.hxx"
35 #include <com/sun/star/container/XNamed.hpp>
36 #include "connectivity/sdbcx/IRefreshable.hxx"
37 #include "connectivity/sdbcx/VDescriptor.hxx"
38 #include "connectivity/dbtoolsdllapi.hxx"
39 
40 namespace connectivity
41 {
42 	namespace sdbcx
43 	{
44 		typedef OCollection OGroups;
45 
46         typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XUser,
47                                                   ::com::sun::star::sdbcx::XGroupsSupplier,
48 												  ::com::sun::star::container::XNamed,
49                                                   ::com::sun::star::lang::XServiceInfo> OUser_BASE;
50 
51 		class OOO_DLLPUBLIC_DBTOOLS OUser :
52                         public comphelper::OBaseMutex,
53 						public OUser_BASE,
54 						public IRefreshableGroups,
55 						public ::comphelper::OPropertyArrayUsageHelper<OUser>,
56 						public ODescriptor
57 		{
58 		protected:
59 			OGroups*		m_pGroups;
60 
61 			using OUser_BASE::rBHelper;
62 
63 			// OPropertyArrayUsageHelper
64 			virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
65 			// OPropertySetHelper
66 			virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
67 		public:
68 			OUser(sal_Bool _bCase);
69 			OUser(const ::rtl::OUString& _Name,sal_Bool _bCase);
70 
71 			virtual ~OUser( );
72 
73 			DECLARE_SERVICE_INFO();
74 
75 			// ::cppu::OComponentHelper
76 			virtual void SAL_CALL disposing(void);
77 			//XInterface
78             virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
79 			virtual void SAL_CALL acquire() throw();
80 			virtual void SAL_CALL release() throw();
81 			//XTypeProvider
82             virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
83 			// XPropertySet
84             virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
85 			// XUser
86             virtual void SAL_CALL changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
87 			// XAuthorizable
88 			virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
89 			virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
90 			virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
91 			virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
92 			// XGroupsSupplier
93             virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getGroups(  ) throw(::com::sun::star::uno::RuntimeException);
94 
95 			// XNamed
96             virtual ::rtl::OUString SAL_CALL getName(  ) throw(::com::sun::star::uno::RuntimeException);
97             virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
98 		};
99 	}
100 }
101 
102 #endif // _CONNECTIVITY_SDBCX_USER_HXX_
103 
104