File indexing completed on 2025-01-05 04:35:36
0001 /* 0002 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0003 SPDX-FileCopyrightText: 2011 Rodrigo Belem <rclbelem@gmail.com> 0004 SPDX-FileCopyrightText: 2020 Harald Sitter <sitter@kde.org> 0005 SPDX-FileCopyrightText: 2021 Slava Aseev <nullptrnine@basealt.ru> 0006 */ 0007 0008 #ifndef model_h 0009 #define model_h 0010 0011 #include <QAbstractTableModel> 0012 #include <ksambasharedata.h> 0013 0014 class KSambaShareData; 0015 class UserManager; 0016 0017 class UserPermissionModel : public QAbstractTableModel 0018 { 0019 Q_OBJECT 0020 public: 0021 using SambaACEHashMap = QHash<QString, QString>; 0022 0023 enum Column { 0024 ColumnUsername, 0025 ColumnAccess 0026 }; 0027 Q_ENUM(Column) 0028 0029 explicit UserPermissionModel(const KSambaShareData &shareData, UserManager *userManager, QObject *parent = nullptr); 0030 0031 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0032 int columnCount(const QModelIndex &parent = QModelIndex()) const override; 0033 0034 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0035 0036 Qt::ItemFlags flags(const QModelIndex & index) const override; 0037 bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole) override; 0038 0039 QString getAcl() const; 0040 0041 SambaACEHashMap getUsersACEs() const; 0042 0043 private: 0044 UserManager const *m_userManager = nullptr; 0045 const KSambaShareData m_shareData; 0046 QVariantMap m_usersAcl; 0047 0048 Q_INVOKABLE void setupData(); 0049 }; 0050 0051 #endif