1 /***************************************************************************
2 begin : Tue May 17 2003
3 copyright : (C) 2003 by Jan Schäfer
4 email : janschaefer@users.sourceforge.net
5 ***************************************************************************/
7 /******************************************************************************
9 * This file is part of KSambaPlugin. *
11 * KSambaPlugin is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 * KSambaPlugin is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * GNU General Public License for more details. *
21 * You should have received a copy of the GNU General Public License *
22 * along with KSambaPlugin; if not, write to the Free Software *
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
25 ******************************************************************************/
26 #ifndef LINUXPERMISSIONCHECKER_H
27 #define LINUXPERMISSIONCHECKER_H
29 #include <qfileinfo.h>
35 * A class to check if the Samba permissions specified in the SambaShare fit
36 * to the un?x permissions of the directory. E.g. a user specifies a SambaShare as writeable
37 * for the public, but the guest account has no write permissions for the directory of the
38 * SambaShare. This will cause a dialog (which can be turned of) to popup and inform the
39 * user about the missing rights and ask him to continue nevertheless or to cancel.
40 * This class works for all un?x systems not only for Linux, but I couldn't call the
41 * class Un?xPermissionChecker ;-)
42 * @author Jan Schaefer
44 class LinuxPermissionChecker
{
46 LinuxPermissionChecker(SambaShare
*,QWidget
* parent
);
47 ~LinuxPermissionChecker();
50 * Checks all possible errors that the user could made
52 * <li><code>false</code> if the un?x permissions of the directory doesn't fit
53 * to the specified permissions in the Samba share and the user has pushed
54 * the cancel button of one of the dialogs, that informed her.
55 * <li><code>true</code> if either there haven't been any problems with the un?x
56 * permissions, or there have been problems, but the user pressed always the continue button.
58 bool checkAllPermissions();
61 * Checks only the public permissions of the directory. First checks
62 * if the Samba share is specified public and then checks if the guest account
63 * has the appropriate rights.
66 bool checkPublicPermissions();
69 * Checks all permissions of all users specified in
73 bool checkAllUserPermissions();
79 * Checks all permissions of the given un?x user
82 bool checkUserPermissions(const QString
& user
);
85 * Checks the write permissions of the given un?x user
86 * Does not show a dialog if showMessageBox is false
89 bool checkUserWritePermissions(const QString
& user
,bool showMessageBox
= true);
92 * Checks the read permissions of the given un?x user
93 * Does not show a dialog if showMessageBox is false
96 bool checkUserReadPermissions(const QString
& user
,bool showMessageBox
= true);
99 SambaShare
* m_sambaShare
;