KLdap

ldapclient.h
1/* kldapclient.h - LDAP access
2 * SPDX-FileCopyrightText: 2002 Klarälvdalens Datakonsult AB
3 * SPDX-FileContributor: Steffen Hansen <hansen@kde.org>
4 *
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7
8#pragma once
9
10#include "kldap_core_export.h"
11#include <QObject>
12#include <QStringList>
13#include <memory>
14
15namespace KLDAPCore
16{
17class LdapObject;
18class LdapServer;
19/**
20 * @short An object that represents a configured LDAP server.
21 *
22 * This class represents a client that to an LDAP server that
23 * can be used for LDAP lookups. Every client is identified by
24 * a unique numeric id.
25 *
26 * @since 4.5
27 */
28class KLDAP_CORE_EXPORT LdapClient : public QObject
29{
30 Q_OBJECT
31
32public:
33 /**
34 * Creates a new ldap client.
35 *
36 * @param clientNumber The unique number of this client.
37 * @param parent The parent object.
38 */
39 explicit LdapClient(int clientNumber, QObject *parent = nullptr);
40
41 /**
42 * Destroys the ldap client.
43 */
44 ~LdapClient() override;
45
46 /**
47 * Returns the number of this client.
48 */
49 [[nodiscard]] int clientNumber() const;
50
51 /**
52 * Returns whether this client is currently running
53 * a search query.
54 */
55 [[nodiscard]] bool isActive() const;
56
57 /**
58 * Sets the completion @p weight of this client.
59 *
60 * This value will be used to sort the results of this
61 * client when used for auto completion.
62 */
63 void setCompletionWeight(int weight);
64
65 /**
66 * Returns the completion weight of this client.
67 */
68 [[nodiscard]] int completionWeight() const;
69
70 /**
71 * Sets the LDAP @p server information that shall be
72 * used by this client.
73 */
74 void setServer(const KLDAPCore::LdapServer &server);
75
76 /**
77 * Returns the ldap server information that are used
78 * by this client.
79 */
80 const KLDAPCore::LdapServer server() const;
81
82 /**
83 * Sets the LDAP @p attributes that should be returned
84 * in the query result.
85 *
86 * Pass an empty list to include all available attributes.
87 */
88 void setAttributes(const QStringList &attributes);
89
90 /**
91 * Returns the LDAP attributes that should be returned
92 * in the query result.
93 */
94 [[nodiscard]] QStringList attributes() const;
95
96 /**
97 * Sets the @p scope of the LDAP query.
98 *
99 * Valid values are 'one' or 'sub'.
100 */
101 void setScope(const QString &scope);
102
103 /**
104 * Starts the query with the given @p filter.
105 */
106 void startQuery(const QString &filter);
107
108 /**
109 * Cancels a running query.
110 */
111 void cancelQuery();
112
113Q_SIGNALS:
114 /**
115 * This signal is emitted when the query has finished.
116 */
117 void done();
118
119 /**
120 * This signal is emitted in case of an error.
121 *
122 * @param message A message that describes the error.
123 */
124 void error(const QString &message);
125
126 /**
127 * This signal is emitted once for each object that is
128 * returned from the query
129 */
131
132private:
133 //@cond PRIVATE
134 class LdapClientPrivate;
135 std::unique_ptr<LdapClientPrivate> const d;
136 //@endcond
137};
138}
An object that represents a configured LDAP server.
Definition ldapclient.h:29
void result(const KLDAPCore::LdapClient &client, const KLDAPCore::LdapObject &)
This signal is emitted once for each object that is returned from the query.
void error(const QString &message)
This signal is emitted in case of an error.
void done()
This signal is emitted when the query has finished.
~LdapClient() override
Destroys the ldap client.
This class represents an LDAP Object.
Definition ldapobject.h:31
A class that contains LDAP server connection settings.
Definition ldapserver.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:34:09 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.