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