1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_CONNECTIVITY_SDBCX_VUSER_HXX
21 #define INCLUDED_CONNECTIVITY_SDBCX_VUSER_HXX
22 
23 #include <com/sun/star/sdbcx/XUser.hpp>
24 #include <com/sun/star/sdbcx/XGroupsSupplier.hpp>
25 #include <comphelper/proparrhlp.hxx>
26 #include <cppuhelper/compbase.hxx>
27 #include <cppuhelper/basemutex.hxx>
28 #include <connectivity/CommonTools.hxx>
29 #include <connectivity/sdbcx/VCollection.hxx>
30 #include <com/sun/star/container/XNamed.hpp>
31 #include <connectivity/sdbcx/IRefreshable.hxx>
32 #include <connectivity/sdbcx/VDescriptor.hxx>
33 #include <connectivity/dbtoolsdllapi.hxx>
34 
35 namespace connectivity
36 {
37     namespace sdbcx
38     {
39         typedef OCollection OGroups;
40 
41         typedef ::cppu::WeakComponentImplHelper< css::sdbcx::XUser,
42                                                  css::sdbcx::XGroupsSupplier,
43                                                  css::container::XNamed,
44                                                  css::lang::XServiceInfo> OUser_BASE;
45 
46         class OOO_DLLPUBLIC_DBTOOLS OUser :
47                         public cppu::BaseMutex,
48                         public OUser_BASE,
49                         public IRefreshableGroups,
50                         public ::comphelper::OPropertyArrayUsageHelper<OUser>,
51                         public ODescriptor
52         {
53         protected:
54             // no Reference! see OCollection::acquire
55             std::unique_ptr<OGroups> m_pGroups;
56 
57             using OUser_BASE::rBHelper;
58 
59             // OPropertyArrayUsageHelper
60             virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
61             // OPropertySetHelper
62             virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
63         public:
64             OUser(bool _bCase);
65             OUser(const OUString& Name,bool _bCase);
66 
67             virtual ~OUser( ) override;
68 
69             DECLARE_SERVICE_INFO();
70 
71             // ::cppu::OComponentHelper
72             virtual void SAL_CALL disposing() override;
73             //XInterface
74             virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
75             virtual void SAL_CALL acquire() throw() override;
76             virtual void SAL_CALL release() throw() override;
77             //XTypeProvider
78             virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes(  ) override;
79             // XPropertySet
80             virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) override;
81             // XUser
82             virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) override;
83             // XAuthorizable
84             virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) override;
85             virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) override;
86             virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override;
87             virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) override;
88             // XGroupsSupplier
89             virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getGroups(  ) override;
90 
91             // XNamed
92             virtual OUString SAL_CALL getName(  ) override;
93             virtual void SAL_CALL setName( const OUString& aName ) override;
94         };
95     }
96 }
97 
98 #endif // INCLUDED_CONNECTIVITY_SDBCX_VUSER_HXX
99 
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
101