KAuthorized QML Type (Singleton)
Singleton used for checking whether actions are allowed by a user. More...
| Import Statement: | import org.kde.config |
| In C++: | KAuthorized |
Note: This type is a QML singleton. There is only one instance of this type in the QML engine.
Properties
- GenericAction : enumeration
- GenericRestriction : enumeration
Methods
- void authorize(string action)
- void authorize(KAuthorized.GenericRestriction action)
- void authorizeAction(string action)
- void authorizeAction(KAuthorized.GenericAction action)
- void authorizeControlModule(string pluginId)
Detailed Description
KDE's Kiosk settings allow to control whether a user is allowed to perform actions such as opening files or running shell commands.
This singleton can be used to implement per-application controls for what the user is allowed to do.
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).
See also Kiosk - Simple configuration management for large deployment.
Property Documentation
GenericAction : enumeration
Actions pertaining to the KDE Kiosk system that are prepended with "action/".
| Constant | Description |
|---|---|
OPEN_WITH | If the open-with menu should be shown for files etc. |
EDITFILETYPE | If mime-type accociations are allowed to be configured |
OPTIONS_SHOW_TOOLBAR | If the toolbar should be displayed in apps |
SWITCH_APPLICATION_LANGUAGE | If an action to switch the app language should be shown |
BOOKMARKS | If saving bookmarks is allowed |
GenericRestriction : enumeration
The enum values lower cased represent the action that is authorized.
For example the KAuthorized.SHELL_ACCESS value is converted to the "shell_access" string.
| Constant | Description |
|---|---|
SHELL_ACCESS | If the user is authorized to open a shell or execute shell commands |
GHNS | If the collaborative data sharing framework KNewStuff is authorized GUI behavior |
LINEEDIT_REVEAL_PASSWORD | If typed characters in password fields can be made visible |
LINEEDIT_TEXT_COMPLETION | If line edits should be allowed to display completions |
MOVABLE_TOOLBARS | If toolbars of apps should be movable |
RUN_DESKTOP_FILES | If .desktop files should be run as executables when clicked |
Method Documentation
void authorize(string 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.
Returns true if the action is authorized, false otherwise.
See also authorizeAction() and GenericRestriction.
void 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 KAuthorized::authorize(const QString &action).
This function overloads KAuthorized::authorize(string action).
void authorizeAction(string 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
KAuthorized::authorizeAction("file_new");
will return false.
KXMLGui-based applications should not normally need to call this function, as KActionCollection will do it automatically.
See also authorize().
void authorizeAction(KAuthorized.GenericAction action)
This function overloads KAuthorized::authorize(string action).
void authorizeControlModule(string pluginId)
Returns whether the user is permitted to use a certain control module with the given pluginId.
All settings are read from the "[KDE Control Module Restrictions]" group. For example, if kdeglobals contains
[KDE Control Module Restrictions][$i] kcm_desktop-settings=false
then
KAuthorized::authorizeControlModule("kcm_desktop-settings");
will return false.