Line data Source code
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_EXTENSIONS_SOURCE_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX
21 : #define INCLUDED_EXTENSIONS_SOURCE_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX
22 :
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/compbase2.hxx>
29 :
30 : #include "ldapaccess.hxx"
31 :
32 : namespace com { namespace sun { namespace star { namespace uno {
33 : class XComponentContext;
34 : } } } }
35 :
36 : namespace extensions { namespace config { namespace ldap {
37 :
38 : namespace uno = css::uno ;
39 : namespace lang = css::lang ;
40 : namespace container = css::container;
41 :
42 : struct LdapDefinition;
43 :
44 : typedef cppu::WeakComponentImplHelper2<css::beans::XPropertySet,
45 : lang::XServiceInfo> BackendBase ;
46 :
47 0 : struct LdapProfileMutexHolder { osl::Mutex mMutex; };
48 : /**
49 : Implements the PlatformBackend service, a specialization of the
50 : XPropertySet service for retreiving LDAP user profile
51 : configuration settings from a LDAP repsoitory.
52 : */
53 : class LdapUserProfileBe : private LdapProfileMutexHolder, public BackendBase
54 : {
55 : public :
56 :
57 : LdapUserProfileBe(const uno::Reference<uno::XComponentContext>& xContext);
58 : virtual ~LdapUserProfileBe(void) ;
59 :
60 : // XServiceInfo
61 : virtual OUString SAL_CALL
62 : getImplementationName( )
63 : throw (uno::RuntimeException, std::exception) SAL_OVERRIDE ;
64 :
65 : virtual sal_Bool SAL_CALL
66 : supportsService( const OUString& aServiceName )
67 : throw (uno::RuntimeException, std::exception) SAL_OVERRIDE ;
68 :
69 : virtual uno::Sequence<OUString> SAL_CALL
70 : getSupportedServiceNames( )
71 : throw (uno::RuntimeException, std::exception) SAL_OVERRIDE ;
72 :
73 : // XPropertySet
74 : virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
75 0 : getPropertySetInfo() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
76 0 : { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
77 :
78 : virtual void SAL_CALL setPropertyValue(
79 : OUString const &, css::uno::Any const &)
80 : throw (
81 : css::beans::UnknownPropertyException,
82 : css::beans::PropertyVetoException,
83 : css::lang::IllegalArgumentException,
84 : css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 :
86 : virtual css::uno::Any SAL_CALL getPropertyValue(
87 : OUString const & PropertyName)
88 : throw (
89 : css::beans::UnknownPropertyException,
90 : css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 :
92 0 : virtual void SAL_CALL addPropertyChangeListener(
93 : OUString const &,
94 : css::uno::Reference< css::beans::XPropertyChangeListener > const &)
95 : throw (
96 : css::beans::UnknownPropertyException,
97 : css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
98 0 : {}
99 :
100 0 : virtual void SAL_CALL removePropertyChangeListener(
101 : OUString const &,
102 : css::uno::Reference< css::beans::XPropertyChangeListener > const &)
103 : throw (
104 : css::beans::UnknownPropertyException,
105 : css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
106 0 : {}
107 :
108 0 : virtual void SAL_CALL addVetoableChangeListener(
109 : OUString const &,
110 : css::uno::Reference< css::beans::XVetoableChangeListener > const &)
111 : throw (
112 : css::beans::UnknownPropertyException,
113 : css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
114 0 : {}
115 :
116 0 : virtual void SAL_CALL removeVetoableChangeListener(
117 : OUString const &,
118 : css::uno::Reference< css::beans::XVetoableChangeListener > const &)
119 : throw (
120 : css::beans::UnknownPropertyException,
121 : css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE
122 0 : {}
123 :
124 : /**
125 : Provides the implementation name.
126 : @return implementation name
127 : */
128 : static OUString SAL_CALL getLdapUserProfileBeName(void) ;
129 : /**
130 : Provides the supported services names
131 : @return service names
132 : */
133 : static uno::Sequence<OUString> SAL_CALL
134 : getLdapUserProfileBeServiceNames(void) ;
135 :
136 : private:
137 : /** Check if LDAP is configured */
138 : bool readLdapConfiguration(
139 : uno::Reference<uno::XComponentContext> const & context,
140 : LdapDefinition * definition, OUString * loggedOnUser);
141 :
142 : bool getLdapStringParam(uno::Reference<container::XNameAccess>& xAccess,
143 : const OUString& aLdapSetting,
144 : OUString& aServerParameter);
145 :
146 : LdapData data_;
147 : } ;
148 :
149 : }}}
150 :
151 : #endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_
152 :
153 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|