ldap.h 1.93 KB
Newer Older
1
/*
2
    SPDX-FileCopyrightText: 2010-2020 Laurent Montel <montel@kde.org>
3

4
    SPDX-License-Identifier: LGPL-2.0-or-later
5
6
7
8
9
10
*/

#ifndef LDAP_H
#define LDAP_H

#include "setupobject.h"
11
#include <KLDAP/LdapServer>
12

13
14
15
class LdapTest;
class KConfig;

Laurent Montel's avatar
Laurent Montel committed
16
namespace KLDAP {
17
class LdapClientSearchConfig;
18
}
19
20
21
22
23

class Ldap : public SetupObject
{
    Q_OBJECT
public:
Laurent Montel's avatar
Laurent Montel committed
24
    explicit Ldap(QObject *parent = nullptr);
Laurent Montel's avatar
Laurent Montel committed
25
    ~Ldap() override;
26
27
    void create() override;
    void destroy() override;
28
    void edit();
Laurent Montel's avatar
Laurent Montel committed
29
public Q_SLOTS:
30
31
32
33
    Q_SCRIPTABLE void setUser(const QString &name);
    Q_SCRIPTABLE void setServer(const QString &server);
    Q_SCRIPTABLE void setAuthenticationMethod(const QString &meth);
    Q_SCRIPTABLE void setBindDn(const QString &bindDn);
34
    Q_SCRIPTABLE void setBaseDn(const QString &baseDn);
35
    Q_SCRIPTABLE void setPassword(const QString &password);
36
37
38
39
40
41
42
43
    Q_SCRIPTABLE void setPort(const int port);
    Q_SCRIPTABLE void setSecurity(const KLDAP::LdapServer::Security security);
    Q_SCRIPTABLE void setSaslMech(const QString &saslmech);
    Q_SCRIPTABLE void setRealm(const QString &realm);
    Q_SCRIPTABLE void setVersion(const int version);
    Q_SCRIPTABLE void setPageSize(const int pageSize);
    Q_SCRIPTABLE void setTimeLimit(const int timeLimit);
    Q_SCRIPTABLE void setSizeLimit(const int sizeLimit);
44
    Q_SCRIPTABLE void setEditMode(const bool editMode);
45

46
protected:
47
48
    virtual KConfig *config() const;

Laurent Montel's avatar
Laurent Montel committed
49
    KLDAP::LdapClientSearchConfig * const m_clientSearchConfig;
50
private:
51
    friend class LdapTest;
52
    QString securityString();
53

54
55
56
57
58
    QString m_user;
    QString m_server;
    QString m_bindDn;
    QString m_authMethod;
    QString m_password;
59
60
    QString m_mech;
    QString m_realm;
61
    QString m_baseDn;
Laurent Montel's avatar
Laurent Montel committed
62
63
64
65
66
67
68
69
    int m_port = 389;
    KLDAP::LdapServer::Security m_security = KLDAP::LdapServer::None;
    int m_version = 3;
    int m_pageSize = 0;
    int m_timeLimit = 0;
    int m_sizeLimit = 0;
    int m_entry = -1;
    bool m_editMode = false;
70
71
72
};

#endif