LCOV - code coverage report
Current view: top level - extensions/source/config/ldap - ldapaccess.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 6 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          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_LDAPACCESS_HXX
      21             : #define INCLUDED_EXTENSIONS_SOURCE_CONFIG_LDAP_LDAPACCESS_HXX
      22             : 
      23             : #include "sal/config.h"
      24             : 
      25             : #include <map>
      26             : 
      27             : #ifdef WNT
      28             : #include <windows.h>
      29             : #include <winldap.h>
      30             : #else // !defined WNT
      31             : #include <ldap.h>
      32             : #endif // WNT
      33             : 
      34             : #include <com/sun/star/ldap/LdapGenericException.hpp>
      35             : 
      36             : #include <com/sun/star/ldap/LdapConnectionException.hpp>
      37             : #include <com/sun/star/lang/IllegalArgumentException.hpp>
      38             : #include <osl/module.h>
      39             : 
      40             : namespace extensions { namespace config { namespace ldap {
      41             : 
      42             : namespace uno = css::uno ;
      43             : namespace lang = css::lang ;
      44             : namespace ldap = css::ldap ;
      45             : 
      46             : struct LdapUserProfile;
      47             : 
      48             : 
      49             : /** Struct containing the information on LDAP connection */
      50           0 : struct LdapDefinition
      51             : {
      52             :     /** LDAP server name */
      53             :     OUString mServer ;
      54             :     /** LDAP server port number */
      55             :     sal_Int32 mPort ;
      56             :     /** Repository base DN */
      57             :     OUString mBaseDN ;
      58             :     /** DN to use for "anonymous" connection */
      59             :     OUString mAnonUser ;
      60             :     /** Credentials to use for "anonymous" connection */
      61             :     OUString mAnonCredentials ;
      62             :     /** User Entity Object Class */
      63             :     OUString mUserObjectClass;
      64             :     /** User Entity Unique Attribute */
      65             :     OUString mUserUniqueAttr;
      66             : 
      67           0 :     LdapDefinition()
      68           0 :         : mPort(0)
      69             :     {
      70           0 :     }
      71             : };
      72             : 
      73             : typedef std::map< OUString, OUString > LdapData; // key/value pairs
      74             : 
      75             : /** Class encapulating all LDAP functionality */
      76             : class LdapConnection
      77             : {
      78             :     friend struct LdapMessageHolder;
      79             : public:
      80             : 
      81             :     /** Default constructor */
      82           0 :     LdapConnection() : mConnection(NULL),mLdapDefinition() {}
      83             :     /** Destructor, releases the connection */
      84             :     ~LdapConnection() ;
      85             :     /** Make connection to LDAP server */
      86             :     void  connectSimple(const LdapDefinition& aDefinition)
      87             :         throw (ldap::LdapConnectionException,
      88             :                 ldap::LdapGenericException);
      89             : 
      90             :     /**
      91             :         Gets LdapUserProfile from LDAP repository for specified user
      92             :         @param aUser    name of logged on user
      93             :         @param aUserProfileMap  Map containing LDAP->00o mapping
      94             :        @param aUserProfile     struct for holding OOo values
      95             : 
      96             :          @throws com::sun::star::ldap::LdapGenericException
      97             :                   if an LDAP error occurs.
      98             :     */
      99             :     void getUserProfile(const OUString& aUser, LdapData * data)
     100             :          throw (lang::IllegalArgumentException,
     101             :                  ldap::LdapConnectionException,
     102             :                  ldap::LdapGenericException);
     103             : 
     104             :     /** finds DN of user
     105             :         @return  DN of User
     106             :     */
     107             :     OUString findUserDn(const OUString& aUser)
     108             :         throw (lang::IllegalArgumentException,
     109             :                 ldap::LdapConnectionException,
     110             :                 ldap::LdapGenericException);
     111             : 
     112             : private:
     113             : 
     114             :     void initConnection()
     115             :          throw (ldap::LdapConnectionException);
     116             :     void disconnect();
     117             :     /**
     118             :       Indicates whether the connection is in a valid state.
     119             :       @return   sal_True if connection is valid, sal_False otherwise
     120             :       */
     121           0 :     bool isValid() const { return mConnection != NULL ; }
     122             : 
     123             :     void  connectSimple()
     124             :         throw (ldap::LdapConnectionException,
     125             :                 ldap::LdapGenericException);
     126             : 
     127             :     /** LDAP connection object */
     128             :     LDAP* mConnection ;
     129             :     LdapDefinition mLdapDefinition;
     130             : } ;
     131             : 
     132             : 
     133             : }} }
     134             : 
     135             : #endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11