Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / extensions / source / config / ldap / ldapuserprofilebe.hxx
blob100a6061d615bd12de35d7d693a42152112956f0
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 .
20 #ifndef INCLUDED_EXTENSIONS_SOURCE_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/lang/XInitialization.hpp>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/container/XNameAccess.hpp>
27 #include <com/sun/star/lang/IllegalArgumentException.hpp>
28 #include <cppuhelper/compbase.hxx>
30 #include "ldapaccess.hxx"
32 namespace com { namespace sun { namespace star { namespace uno {
33 class XComponentContext;
34 } } } }
36 namespace extensions { namespace config { namespace ldap {
38 namespace uno = css::uno ;
39 namespace lang = css::lang ;
40 namespace container = css::container;
42 struct LdapDefinition;
44 typedef cppu::WeakComponentImplHelper<css::beans::XPropertySet,
45 lang::XServiceInfo> BackendBase ;
47 struct LdapProfileMutexHolder { osl::Mutex mMutex; };
48 /**
49 Implements the PlatformBackend service, a specialization of the
50 XPropertySet service for retrieving LDAP user profile
51 configuration settings from an LDAP repository.
53 class LdapUserProfileBe : private LdapProfileMutexHolder, public BackendBase
55 public:
57 explicit LdapUserProfileBe(const uno::Reference<uno::XComponentContext>& xContext);
58 virtual ~LdapUserProfileBe() override ;
60 // XServiceInfo
61 virtual OUString SAL_CALL
62 getImplementationName( ) override ;
64 virtual sal_Bool SAL_CALL
65 supportsService( const OUString& aServiceName ) override ;
67 virtual uno::Sequence<OUString> SAL_CALL
68 getSupportedServiceNames( ) override ;
70 // XPropertySet
71 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
72 getPropertySetInfo() override
73 { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
75 virtual void SAL_CALL setPropertyValue(
76 OUString const &, css::uno::Any const &) override;
78 virtual css::uno::Any SAL_CALL getPropertyValue(
79 OUString const & PropertyName) override;
81 virtual void SAL_CALL addPropertyChangeListener(
82 OUString const &,
83 css::uno::Reference< css::beans::XPropertyChangeListener > const &) override
86 virtual void SAL_CALL removePropertyChangeListener(
87 OUString const &,
88 css::uno::Reference< css::beans::XPropertyChangeListener > const &) override
91 virtual void SAL_CALL addVetoableChangeListener(
92 OUString const &,
93 css::uno::Reference< css::beans::XVetoableChangeListener > const &) override
96 virtual void SAL_CALL removeVetoableChangeListener(
97 OUString const &,
98 css::uno::Reference< css::beans::XVetoableChangeListener > const &) override
102 Provides the implementation name.
103 @return implementation name
105 static OUString getLdapUserProfileBeName() ;
107 Provides the supported services names
108 @return service names
110 static uno::Sequence<OUString>
111 getLdapUserProfileBeServiceNames() ;
113 private:
114 /** Check if LDAP is configured */
115 static bool readLdapConfiguration(
116 uno::Reference<uno::XComponentContext> const & context,
117 LdapDefinition * definition, OUString * loggedOnUser);
119 static bool getLdapStringParam(uno::Reference<container::XNameAccess> const & xAccess,
120 const OUString& aLdapSetting,
121 OUString& aServerParameter);
123 LdapData data_;
128 #endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */