KAuthorized

KAuthorized Namespace Reference

Enumerations

enum  GenericAction {
  OPEN_WITH = 1, EDITFILETYPE, OPTIONS_SHOW_TOOLBAR, SWITCH_APPLICATION_LANGUAGE,
  BOOKMARKS
}
 
enum  GenericRestriction {
  SHELL_ACCESS = 1, GHNS, LINEEDIT_REVEAL_PASSWORD, LINEEDIT_TEXT_COMPLETION,
  MOVABLE_TOOLBARS, RUN_DESKTOP_FILES
}
 

Functions

KCONFIGCORE_EXPORT bool authorize (const QString &action)
 
KCONFIGCORE_EXPORT bool authorize (GenericRestriction action)
 
KCONFIGCORE_EXPORT bool authorizeAction (const QString &action)
 
KCONFIGCORE_EXPORT bool authorizeAction (GenericAction action)
 
KCONFIGCORE_EXPORT bool authorizeControlModule (const QString &menuId)
 
KCONFIGCORE_EXPORT QStringList authorizeControlModules (const QStringList &menuIds)
 
KCONFIGCORE_EXPORT bool authorizeKAction (const QString &action)
 

Detailed Description

The functions in this namespace provide the core of the Kiosk action restriction system; the KIO and KXMLGui frameworks build on this.

The relevant settings are read from the application's KSharedConfig instance, so actions can be disabled on a per-application or global basis (by using the kdeglobals file).

Enumeration Type Documentation

◆ GenericAction

Since
5.88
Enumerator
EDITFILETYPE 

if the open-with menu should be shown for files etc.

OPTIONS_SHOW_TOOLBAR 

if mime-type accociations are allowed to be configured

SWITCH_APPLICATION_LANGUAGE 

if the toolbar should be displayed in apps

BOOKMARKS 

if an action to switch the app language should be shown

Definition at line 54 of file kauthorized.h.

◆ GenericRestriction

The enum values lower cased represent the action that is authorized For example the SHELL_ACCESS value is converted to the "shell_access" string.

Since
5.88
Enumerator
LINEEDIT_REVEAL_PASSWORD 

if the collaborative data sharing framework KNewStuff is authorized

LINEEDIT_TEXT_COMPLETION 

if typed characters in password fields can be made visible

MOVABLE_TOOLBARS 

if line edits should be allowed to display completions

RUN_DESKTOP_FILES 

if toolbars of of apps should be movable

Definition at line 39 of file kauthorized.h.

Function Documentation

◆ authorize() [1/2]

bool KAuthorized::authorize ( const QString action)

Returns whether the user is permitted to perform a certain action.

All settings are read from the "[KDE Action Restrictions]" group. For example, if kdeglobals contains

[KDE Action Restrictions][$i]
shell_access=false

then

KAuthorized::authorize("shell_access");

will return false.

This method is intended for actions that do not necessarily have a one-to-one correspondence with a menu or toolbar item (ie: a QAction in a KXMLGui application). "shell_access" is an example of such a "generic" action.

The convention for actions like "File->New" is to prepend the action name with "action/", for example "action/file_new". This is what authorizeAction() does.

Parameters
actionThe name of the action.
Returns
true if the action is authorized, false otherwise.
See also
authorizeAction()

Definition at line 210 of file kauthorized.cpp.

◆ authorize() [2/2]

bool KAuthorized::authorize ( KAuthorized::GenericRestriction  action)

Returns whether the user is permitted to perform a common action.

The enum values lower cased represent the action that is passed in to authorize(QString)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.88

Definition at line 225 of file kauthorized.cpp.

◆ authorizeAction() [1/2]

bool KAuthorized::authorizeAction ( const QString action)

Returns whether the user is permitted to perform a certain action.

This behaves like authorize(), except that "action/" is prepended to action. So if kdeglobals contains

[KDE Action Restrictions][$i]
action/file_new=false

then

will return false.

KXMLGui-based applications should not normally need to call this function, as KActionCollection will do it automatically.

Parameters
actionThe name of a QAction action.
Returns
true if the QAction is authorized, false otherwise.
Since
5.24
See also
authorize()

Definition at line 236 of file kauthorized.cpp.

◆ authorizeAction() [2/2]

bool KAuthorized::authorizeAction ( KAuthorized::GenericAction  action)

Overload to authorize common actions.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
5.88

Definition at line 249 of file kauthorized.cpp.

◆ authorizeControlModule()

bool KAuthorized::authorizeControlModule ( const QString menuId)

Returns whether the user is permitted to use a certain control module.

All settings are read from the "[KDE Control Module Restrictions]" group. For example, if kdeglobals contains

[KDE Control Module Restrictions][$i]
desktop-settings.desktop=false

then

KAuthorized::authorizeControlModule("desktop-settings.desktop");

will return false.

Parameters
menuIdThe desktop menu ID for the control module.
Returns
true if access to the module is authorized, false otherwise.
See also
authorizeControlModules()

Definition at line 266 of file kauthorized.cpp.

◆ authorizeControlModules()

QStringList KAuthorized::authorizeControlModules ( const QStringList menuIds)

Determines which control modules from a list the user is permitted to use.

Parameters
menuIdsA list of desktop menu IDs for control modules.
Returns
The entries in menuIds for which authorizeControlModule() returns true.
See also
authorizeControlModule()

Definition at line 275 of file kauthorized.cpp.

◆ authorizeKAction()

bool KAuthorized::authorizeKAction ( const QString action)

Returns whether the user is permitted to perform a certain action.

This behaves like authorize(), except that "action/" is prepended to action. So if kdeglobals contains

[KDE Action Restrictions][$i]
action/file_new=false

then

will return false.

KXMLGui-based applications should not normally need to call this function, as KActionCollection will do it automatically.

Parameters
actionThe name of a KAction action.
Returns
true if the KAction is authorized, false otherwise.
See also
authorize()
Deprecated:
since 5.24, use authorizeAction() instead.

Definition at line 260 of file kauthorized.cpp.

KCONFIGCORE_EXPORT bool authorizeKAction(const QString &action)
Returns whether the user is permitted to perform a certain action.
KCONFIGCORE_EXPORT bool authorizeAction(const QString &action)
Returns whether the user is permitted to perform a certain action.
KCONFIGCORE_EXPORT bool authorizeControlModule(const QString &menuId)
Returns whether the user is permitted to use a certain control module.
KCONFIGCORE_EXPORT bool authorize(const QString &action)
Returns whether the user is permitted to perform a certain action.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Dec 5 2023 04:08:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.