source: src-qt4/pc-usermanager/usermanagerback.h @ 87d35b7

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since 87d35b7 was 87d35b7, checked in by Kris Moore <kris@…>, 17 months ago

Add ability to PEFS encrypt users home-directories when we
create a new user via the user-manager GUI

  • Property mode set to 100755
File size: 3.8 KB
Line 
1/***************************************************************************
2 *   Copyright (C) 2005 - 2007 by Tim McCormick   *
3 *   tim@pcbsd.org   *
4 *                                                                         *
5 *   Permission is hereby granted, free of charge, to any person obtaining *
6 *   a copy of this software and associated documentation files (the       *
7 *   "Software"), to deal in the Software without restriction, including   *
8 *   without limitation the rights to use, copy, modify, merge, publish,   *
9 *   distribute, sublicense, and/or sell copies of the Software, and to    *
10 *   permit persons to whom the Software is furnished to do so, subject to *
11 *   the following conditions:                                             *
12 *                                                                         *
13 *   The above copyright notice and this permission notice shall be        *
14 *   included in all copies or substantial portions of the Software.       *
15 *                                                                         *
16 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
17 *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
18 *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
20 *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
21 *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
22 *   OTHER DEALINGS IN THE SOFTWARE.                                       *
23 ***************************************************************************/
24
25#include <qapplication.h>
26#include <qfile.h>
27#include <user.h>
28#include <qmap.h>
29#include <group.h>
30#include <qregexp.h>
31#include <QProcess>
32#include <qmessagebox.h>
33
34#ifndef INC_USERMANAGERBACKEND_H
35#define INC_USERMANAGERBACKEND_H
36
37class UserManagerBackend : public QObject {
38    Q_OBJECT
39public:
40    UserManagerBackend(QString);
41    void programInit();
42    QStringList getAllUsers(int minId = 1000, int maxId = 65532); //Set variables to -1 to ignore
43    User* getUser(const QString &user);
44    QStringList getShells();
45    QStringList getAllGroups(int minId = 1000, int maxId = 65532); //Set variables to -1 to ignore
46    Group* getGroup(int gid);
47    Group* getGroup(QString groupname);
48    void deleteUser(QString username);
49    void addUser(QString username, QString fullname, QString home, QString shell, QString group, QString password);
50    int validatePassword(QString password, QString confirmPassword); //0 = OK, 1 = Empty, 2 = No match, 3 = Invalid input
51    int validateFullname(QString fullname); //0 = OK, 1 = Empty, 2 = Invalid input
52    int validateHome(QString home); //0 = OK, 1 = Empty, 2 = Invalid Path, 3 = Not a directory, 4 = Not a recommended path, 5 = File selected (not directory)
53    int validateUsername(QString username); //0 = OK, 1 = Empty, 2 = Invalid input, 3 = Username already in use
54    int validateGroupname(QString groupname); //0 = OK, 1 = Empty, 2 = Invalid input, 3 Groupname already in use
55    void changePassword(QString username, QString password);
56    void setEnc(QString username, bool nEnc);
57    void deleteGroup(QString groupname);
58    void addGroup(QString groupname);
59    void addUserToGroup(QString user, QString group);
60    void removeUserFromGroup(QString user, QString group);
61    bool commit();
62   
63private:
64    QMap<QString, User> userList;
65    void refreshUsers();
66    QMap<int, Group> groupList;
67    void refreshGroups();
68    QRegExp fullnameRegExp;
69    QRegExp homeLocRegExp;
70    QRegExp usernameRegExp;
71    QRegExp passwordRegExp;
72    QRegExp groupnameRegExp;
73    QProcess *pw;
74    QString chroot;
75   
76signals:
77    void usersChanged();
78    void groupsChanged();
79};
80
81#endif // INC_USERMANAGER_H
Note: See TracBrowser for help on using the repository browser.