Polkit-Qt-1  0.95.0
Public Slots | Public Member Functions
PolkitQt1::Agent::Listener Class Referenceabstract

Listener is abstract class used for implementing authentication agents. More...

#include <Listener>

Inherits QObject.

Public Slots

virtual void initiateAuthentication (const QString &actionId, const QString &message, const QString &iconName, const PolkitQt1::Details &details, const QString &cookie, const PolkitQt1::Identity::List &identities, AsyncResult *result)=0
 Initiate authentication for the action. More...
 
virtual bool initiateAuthenticationFinish ()=0
 Finishes an authentication request from the polkit daemon. More...
 
virtual void cancelAuthentication ()=0
 Cancels an authentication request from the polkit daemon. More...
 

Public Member Functions

 Listener (QObject *parent=0)
 Constructor of Listener class.
 
 Listener (PolkitAgentListener *listener, QObject *parent=0)
 Constructor of Listener class from PolkitAgentListener. More...
 
bool registerListener (const PolkitQt1::Subject &subject, const QString &objectPath)
 Registers listener with polkit daemon as an authentication agent for subject. More...
 
const PolkitAgentListener * listener ()
 Returns pointer to the PolkitAgentListener. More...
 

Detailed Description

Listener is abstract class used for implementing authentication agents.

Author
Jaroslav Reznik jrezn.nosp@m.ik@r.nosp@m.edhat.nosp@m..com

To implement an authentication agent, just subclass this class and implement virtual functions initiateAuthentication, initiateAuthenticationFinish and cancelAuthentication.

You can also use Session class to authenticate users however it isn't required.

See also
Session

Constructor & Destructor Documentation

◆ Listener()

PolkitQt1::Agent::Listener::Listener ( PolkitAgentListener *  listener,
QObject *  parent = 0 
)
explicit

Constructor of Listener class from PolkitAgentListener.

Warning
Use this only if you are completely aware of what are you doing!
Parameters
listenerPointer to the PolkitAgentListener
parent

Member Function Documentation

◆ cancelAuthentication

virtual void PolkitQt1::Agent::Listener::cancelAuthentication ( )
pure virtualslot

Cancels an authentication request from the polkit daemon.

TODO: Is this method really required ?

Note
You have to reimplement this method in the subclass.
See also
initiateAuthentication

◆ initiateAuthentication

virtual void PolkitQt1::Agent::Listener::initiateAuthentication ( const QString &  actionId,
const QString &  message,
const QString &  iconName,
const PolkitQt1::Details details,
const QString &  cookie,
const PolkitQt1::Identity::List &  identities,
AsyncResult *  result 
)
pure virtualslot

Initiate authentication for the action.

This method will be called on a registered authentication agent when the user owning the session needs to prove he is one of the identities listed in identities.

Note
You have to reimplement this method in the subclass.
Parameters
actionIdThe action to authenticate for
messageThe message to present to the user
iconNameThe name of the icon which is representing the action
detailsDetails describing the action
cookieThe cookie for the authentization request
identitiesA list of Identity object that the user can choose to authenticate as
resultThis AsyncResult MUST be completed by using complete() method when the authentication is done. You can pass it to the constructor of the Session class and then call session->result()->complete() to mark the action as done.

◆ initiateAuthenticationFinish

virtual bool PolkitQt1::Agent::Listener::initiateAuthenticationFinish ( )
pure virtualslot

Finishes an authentication request from the polkit daemon.

TODO: Is this method really required ?

Note
You have to reimplement this method in the subclass.
See also
initiateAuthentication

◆ listener()

const PolkitAgentListener * PolkitQt1::Agent::Listener::listener ( )

Returns pointer to the PolkitAgentListener.

Warning
Use this only if you are completely aware of what are you doing!
Returns
PolkitAgentListener

◆ registerListener()

bool PolkitQt1::Agent::Listener::registerListener ( const PolkitQt1::Subject subject,
const QString &  objectPath 
)

Registers listener with polkit daemon as an authentication agent for subject.

This is implemented by registering a DBus object at objectPath on the unique name assigned by the system message bus.

Whenever the polkit daemon needs to authenticate a processes that is related to subject, the methods initiateAuthentication and initiateAuthenticationFinish will be evoked.

Parameters
subjectSubject that listener will be registered for
objectPathDBus object path
Returns
True if the polkitqt1-agent-listener.has been registered, False otherwise

The documentation for this class was generated from the following files: