Avoid potential negative array index access to cached text.
[LibreOffice.git] / extensions / source / config / ldap / ldapuserprofilebe.hxx
blob2f05365328db6034fdb4d2f5ca56fbd289563948
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 #pragma once
22 #include <com/sun/star/beans/XPropertySet.hpp>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/container/XNameAccess.hpp>
25 #include <cppuhelper/compbase.hxx>
26 #include <cppuhelper/basemutex.hxx>
28 #include "ldapaccess.hxx"
30 namespace com::sun::star::uno {
31 class XComponentContext;
34 namespace extensions::config::ldap {
36 namespace uno = css::uno ;
37 namespace lang = css::lang ;
38 namespace container = css::container;
40 struct LdapDefinition;
42 typedef cppu::WeakComponentImplHelper<css::beans::XPropertySet,
43 lang::XServiceInfo> BackendBase ;
45 /**
46 Implements the PlatformBackend service, a specialization of the
47 XPropertySet service for retrieving LDAP user profile
48 configuration settings from an LDAP repository.
50 class LdapUserProfileBe : private cppu::BaseMutex, public BackendBase
52 public:
54 explicit LdapUserProfileBe(const uno::Reference<uno::XComponentContext>& xContext);
55 virtual ~LdapUserProfileBe() override ;
57 // XServiceInfo
58 virtual OUString SAL_CALL
59 getImplementationName( ) override ;
61 virtual sal_Bool SAL_CALL
62 supportsService( const OUString& aServiceName ) override ;
64 virtual uno::Sequence<OUString> SAL_CALL
65 getSupportedServiceNames( ) override ;
67 // XPropertySet
68 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
69 getPropertySetInfo() override
70 { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
72 virtual void SAL_CALL setPropertyValue(
73 OUString const &, css::uno::Any const &) override;
75 virtual css::uno::Any SAL_CALL getPropertyValue(
76 OUString const & PropertyName) override;
78 virtual void SAL_CALL addPropertyChangeListener(
79 OUString const &,
80 css::uno::Reference< css::beans::XPropertyChangeListener > const &) override
83 virtual void SAL_CALL removePropertyChangeListener(
84 OUString const &,
85 css::uno::Reference< css::beans::XPropertyChangeListener > const &) override
88 virtual void SAL_CALL addVetoableChangeListener(
89 OUString const &,
90 css::uno::Reference< css::beans::XVetoableChangeListener > const &) override
93 virtual void SAL_CALL removeVetoableChangeListener(
94 OUString const &,
95 css::uno::Reference< css::beans::XVetoableChangeListener > const &) override
98 private:
99 /** Check if LDAP is configured */
100 static bool readLdapConfiguration(
101 uno::Reference<uno::XComponentContext> const & context,
102 LdapDefinition * definition, OUString * loggedOnUser);
104 static bool getLdapStringParam(uno::Reference<container::XNameAccess> const & xAccess,
105 const OUString& aLdapSetting,
106 OUString& aServerParameter);
108 LdapData data_;
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */