KAuthorized

Search for usage in LXR

#include <kauthorized.h>

Inheritance diagram for KAuthorized:

Public Types

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
}
 
- Public Types inherited from QObject
typedef  QObjectList
 

Static Public Member Functions

static Q_INVOKABLE bool authorize (const QString &action)
 
static Q_INVOKABLE bool authorize (GenericRestriction action)
 
static Q_INVOKABLE bool authorizeAction (const QString &action)
 
static Q_INVOKABLE bool authorizeAction (GenericAction action)
 
static Q_INVOKABLE bool authorizeControlModule (const QString &pluginId)
 
static KAuthorizedcreate (QQmlEngine *, QJSEngine *)
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

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).

Definition at line 31 of file kauthorized.h.

Member Enumeration 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 56 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 apps should be movable

Definition at line 41 of file kauthorized.h.

Member Function Documentation

◆ authorize() [1/2]

bool KAuthorized::authorize ( const QString & action)
static

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");
static Q_INVOKABLE bool authorize(const QString &action)
Returns whether the user is permitted to perform a certain action.

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 215 of file kauthorized.cpp.

◆ authorize() [2/2]

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

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 230 of file kauthorized.cpp.

◆ authorizeAction() [1/2]

bool KAuthorized::authorizeAction ( const QString & action)
static

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

static Q_INVOKABLE bool authorizeAction(const QString &action)
Returns whether the user is permitted to perform a certain action.

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 241 of file kauthorized.cpp.

◆ authorizeAction() [2/2]

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

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 254 of file kauthorized.cpp.

◆ authorizeControlModule()

bool KAuthorized::authorizeControlModule ( const QString & pluginId)
static

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]
kcm_desktop-settings=false

then

KAuthorized::authorizeControlModule("kcm_desktop-settings");
static Q_INVOKABLE bool authorizeControlModule(const QString &pluginId)
Returns whether the user is permitted to use a certain control module.

will return false.

Parameters
pluginIdThe desktop menu ID for the control module.
Returns
true if access to the module is authorized, false otherwise.

Definition at line 264 of file kauthorized.cpp.

◆ create()

static KAuthorized * KAuthorized::create ( QQmlEngine * ,
QJSEngine *  )
inlinestatic

Definition at line 164 of file kauthorized.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.