1/* This file is part of the KDE libraries
2 Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
3 Copyright (c) 1998, 1999 Waldo Bastian <bastian@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KAUTHORIZED_H
22#define KAUTHORIZED_H
23
24#include <kdecore_export.h>
25
26class KUrl;
27class QString;
28class QStringList;
29
30/**
31* Extracted from kapplication (3.x). Kiosk authorization framework
32*/
33namespace KAuthorized
34{
35 /**
36 * Returns whether a certain action is authorized
37 * @param genericAction The name of a generic action
38 * @return true if the action is authorized
39 * @todo what are the generic actions?
40 */
41 KDE_EXPORT bool authorize(const QString& genericAction);
42
43 /**
44 * Returns whether a certain KAction is authorized.
45 *
46 * @param action The name of a KAction action. The name is prepended
47 * with "action/" before being passed to authorize()
48 * @return true if the KAction is authorized
49 */
50 KDE_EXPORT bool authorizeKAction(const QString& action);
51
52 /**
53 * Returns whether a certain URL related action is authorized.
54 *
55 * @param action The name of the action. Known actions are
56 * - list (may be listed (e.g. in file selection dialog)),
57 * - link (may be linked to),
58 * - open (may open) and
59 * - redirect (may be redirected to)
60 * @param baseUrl The url where the action originates from
61 * @param destUrl The object of the action
62 * @return true when the action is authorized, false otherwise.
63 */
64 KDE_EXPORT bool authorizeUrlAction(const QString& action, const KUrl& baseUrl, const KUrl& destUrl);
65
66 /**
67 * Allow a certain URL action. This can be useful if your application
68 * needs to ensure access to an application specific directory that may
69 * otherwise be subject to KIOSK restrictions.
70 * @param action The name of the action.
71 * @param baseUrl The url where the action originates from
72 * @param _destUrl The object of the action
73 */
74 KDE_EXPORT void allowUrlAction(const QString& action, const KUrl& baseUrl, const KUrl& _destUrl);
75
76 /**
77 * Returns whether access to a certain control module is authorized.
78 *
79 * @param menuId identifying the control module, e.g. kde-mouse.desktop
80 * @return true if access to the module is authorized, false otherwise.
81 */
82 KDE_EXPORT bool authorizeControlModule(const QString& menuId);
83
84 /**
85 * Returns which control modules from a given list are authorized for access.
86 *
87 * @param menuIds list of menu-ids of control modules;
88 * an example of a menu-id is kde-mouse.desktop.
89 * @return Those control modules for which access has been authorized.
90 */
91 KDE_EXPORT QStringList authorizeControlModules(const QStringList& menuIds);
92
93}
94
95#endif
96