146dbaceeSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
346dbaceeSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
446dbaceeSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
546dbaceeSAndrew Rist  * distributed with this work for additional information
646dbaceeSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
746dbaceeSAndrew Rist  * to you under the Apache License, Version 2.0 (the
846dbaceeSAndrew Rist  * "License"); you may not use this file except in compliance
946dbaceeSAndrew Rist  * with the License.  You may obtain a copy of the License at
1046dbaceeSAndrew Rist  *
1146dbaceeSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1246dbaceeSAndrew Rist  *
1346dbaceeSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1446dbaceeSAndrew Rist  * software distributed under the License is distributed on an
1546dbaceeSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1646dbaceeSAndrew Rist  * KIND, either express or implied.  See the License for the
1746dbaceeSAndrew Rist  * specific language governing permissions and limitations
1846dbaceeSAndrew Rist  * under the License.
1946dbaceeSAndrew Rist  *
2046dbaceeSAndrew Rist  *************************************************************/
2146dbaceeSAndrew Rist 
2246dbaceeSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX_
25cdf0e10cSrcweir #define EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
28cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
29cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
33cdf0e10cSrcweir #include <com/sun/star/lang/IllegalArgumentException.hpp>
34cdf0e10cSrcweir #include <cppuhelper/compbase2.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include "ldapaccess.hxx"
37cdf0e10cSrcweir 
38cdf0e10cSrcweir namespace extensions { namespace config { namespace ldap {
39cdf0e10cSrcweir 
40cdf0e10cSrcweir namespace css = com::sun::star ;
41cdf0e10cSrcweir namespace uno = css::uno ;
42cdf0e10cSrcweir namespace lang = css::lang ;
43cdf0e10cSrcweir namespace container = css::container;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir struct LdapDefinition;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir typedef cppu::WeakComponentImplHelper2<css::beans::XPropertySet,
48cdf0e10cSrcweir                                        lang::XServiceInfo> BackendBase ;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir struct LdapProfileMutexHolder { osl::Mutex mMutex; };
51cdf0e10cSrcweir /**
52cdf0e10cSrcweir   Implements the PlatformBackend service, a specialization of the
53*fa386bfdSMatthias Seidel   XPropertySet service for retrieving LDAP user profile
54*fa386bfdSMatthias Seidel   configuration settings from a LDAP repository.
55cdf0e10cSrcweir   */
56cdf0e10cSrcweir class LdapUserProfileBe : private LdapProfileMutexHolder, public BackendBase
57cdf0e10cSrcweir {
58cdf0e10cSrcweir     public :
59cdf0e10cSrcweir 
60cdf0e10cSrcweir         LdapUserProfileBe(const uno::Reference<uno::XComponentContext>& xContext);
61cdf0e10cSrcweir 		~LdapUserProfileBe(void) ;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir         // XServiceInfo
64cdf0e10cSrcweir         virtual rtl::OUString SAL_CALL
65cdf0e10cSrcweir             getImplementationName(  )
66cdf0e10cSrcweir                 throw (uno::RuntimeException) ;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir         virtual sal_Bool SAL_CALL
69cdf0e10cSrcweir             supportsService( const rtl::OUString& aServiceName )
70cdf0e10cSrcweir                 throw (uno::RuntimeException) ;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir         virtual uno::Sequence<rtl::OUString> SAL_CALL
73cdf0e10cSrcweir             getSupportedServiceNames(  )
74cdf0e10cSrcweir                 throw (uno::RuntimeException) ;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir         // XPropertySet
77cdf0e10cSrcweir         virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo()78cdf0e10cSrcweir         getPropertySetInfo() throw (css::uno::RuntimeException)
79cdf0e10cSrcweir         { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir         virtual void SAL_CALL setPropertyValue(
82cdf0e10cSrcweir             rtl::OUString const &, css::uno::Any const &)
83cdf0e10cSrcweir             throw (
84cdf0e10cSrcweir                 css::beans::UnknownPropertyException,
85cdf0e10cSrcweir                 css::beans::PropertyVetoException,
86cdf0e10cSrcweir                 css::lang::IllegalArgumentException,
87cdf0e10cSrcweir                 css::lang::WrappedTargetException, css::uno::RuntimeException);
88cdf0e10cSrcweir 
89cdf0e10cSrcweir         virtual css::uno::Any SAL_CALL getPropertyValue(
90cdf0e10cSrcweir             rtl::OUString const & PropertyName)
91cdf0e10cSrcweir             throw (
92cdf0e10cSrcweir                 css::beans::UnknownPropertyException,
93cdf0e10cSrcweir                 css::lang::WrappedTargetException, css::uno::RuntimeException);
94cdf0e10cSrcweir 
addPropertyChangeListener(rtl::OUString const &,css::uno::Reference<css::beans::XPropertyChangeListener> const &)95cdf0e10cSrcweir         virtual void SAL_CALL addPropertyChangeListener(
96cdf0e10cSrcweir             rtl::OUString const &,
97cdf0e10cSrcweir             css::uno::Reference< css::beans::XPropertyChangeListener > const &)
98cdf0e10cSrcweir             throw (
99cdf0e10cSrcweir                 css::beans::UnknownPropertyException,
100cdf0e10cSrcweir                 css::lang::WrappedTargetException, css::uno::RuntimeException)
101cdf0e10cSrcweir         {}
102cdf0e10cSrcweir 
removePropertyChangeListener(rtl::OUString const &,css::uno::Reference<css::beans::XPropertyChangeListener> const &)103cdf0e10cSrcweir         virtual void SAL_CALL removePropertyChangeListener(
104cdf0e10cSrcweir             rtl::OUString const &,
105cdf0e10cSrcweir             css::uno::Reference< css::beans::XPropertyChangeListener > const &)
106cdf0e10cSrcweir             throw (
107cdf0e10cSrcweir                 css::beans::UnknownPropertyException,
108cdf0e10cSrcweir                 css::lang::WrappedTargetException, css::uno::RuntimeException)
109cdf0e10cSrcweir         {}
110cdf0e10cSrcweir 
addVetoableChangeListener(rtl::OUString const &,css::uno::Reference<css::beans::XVetoableChangeListener> const &)111cdf0e10cSrcweir         virtual void SAL_CALL addVetoableChangeListener(
112cdf0e10cSrcweir             rtl::OUString const &,
113cdf0e10cSrcweir             css::uno::Reference< css::beans::XVetoableChangeListener > const &)
114cdf0e10cSrcweir             throw (
115cdf0e10cSrcweir                 css::beans::UnknownPropertyException,
116cdf0e10cSrcweir                 css::lang::WrappedTargetException, css::uno::RuntimeException)
117cdf0e10cSrcweir         {}
118cdf0e10cSrcweir 
removeVetoableChangeListener(rtl::OUString const &,css::uno::Reference<css::beans::XVetoableChangeListener> const &)119cdf0e10cSrcweir         virtual void SAL_CALL removeVetoableChangeListener(
120cdf0e10cSrcweir             rtl::OUString const &,
121cdf0e10cSrcweir             css::uno::Reference< css::beans::XVetoableChangeListener > const &)
122cdf0e10cSrcweir             throw (
123cdf0e10cSrcweir                 css::beans::UnknownPropertyException,
124cdf0e10cSrcweir                 css::lang::WrappedTargetException, css::uno::RuntimeException)
125cdf0e10cSrcweir         {}
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 		 /**
128cdf0e10cSrcweir           Provides the implementation name.
129cdf0e10cSrcweir 		  @return   implementation name
130cdf0e10cSrcweir           */
131cdf0e10cSrcweir         static rtl::OUString SAL_CALL getLdapUserProfileBeName(void) ;
132cdf0e10cSrcweir         /**
133cdf0e10cSrcweir           Provides the supported services names
134cdf0e10cSrcweir 		  @return   service names
135cdf0e10cSrcweir           */
136cdf0e10cSrcweir         static uno::Sequence<rtl::OUString> SAL_CALL
137cdf0e10cSrcweir 			getLdapUserProfileBeServiceNames(void) ;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     private:
140cdf0e10cSrcweir 		/** Check if LDAP is configured */
141cdf0e10cSrcweir         bool readLdapConfiguration(
142cdf0e10cSrcweir             uno::Reference<lang::XMultiServiceFactory> const & factory,
143cdf0e10cSrcweir             LdapDefinition * definition, rtl::OUString * loggedOnUser);
144cdf0e10cSrcweir 
145cdf0e10cSrcweir         bool getLdapStringParam(uno::Reference<container::XNameAccess>& xAccess,
146cdf0e10cSrcweir 								const rtl::OUString& aLdapSetting,
147cdf0e10cSrcweir 								rtl::OString& aServerParameter);
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     LdapData data_;
150cdf0e10cSrcweir } ;
151cdf0e10cSrcweir //------------------------------------------------------------------------------
152cdf0e10cSrcweir }}}
153cdf0e10cSrcweir 
154cdf0e10cSrcweir #endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_
155