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

KDE's Doxygen guidelines are available online.