KDE 4.7 PyKDE API Reference

- KDE's Python API

# AuthorizationRule Class Reference

`from PyKDE4.plasma import *`

Inherits: QObject
Namespace: Plasma

## Detailed Description

AuthorizationRule plasma/authorizationrule.h <Plasma/AuthorizationRule>

Defines a rule indicating whether or not a certain service can be accessed by a certain machine.

Rules allow you to have control over which computers are allowed to access which services. Every time a message get's in, AuthorizationManager validates it's sender, and then checks it's list of rules for rules matching the sender and/or the service. If no rules match, or all matching rules have the value Unspecified, AuthorizationManager will create a new rule for this message, and invoke authorize on your shells implementation of AuthorizationInterface. Here, you can change that rule to either allow or deny that request. This class can be used to specify different types of rules: - Rules matching only a user - Rules matching only a service - Rules matching both a service, and a user. A more specific rule always takes precedence over a more global rule: so if for example you have a rule for "myAwesomeService" specifying Deny, and a rule for "myAwesomeService" in combination with "130.42.120.146" as caller specifying Allow, only 130.42.120.146 can access myAwesomeService. By setting the PinRequired flag in setRules in an AuthorizationInterface implementation, you trigger Pin pairing (user will be asked to enter the same password on both machines).

Since:
  4.4?

## Enumerations
Persistence | { Transient, Persistent }
Policy | { Deny, Allow, PinRequired }
Target | { Default, AllUsers, AllServices }
## Signals
| changed (Plasma.AuthorizationRule a0)
## Methods
| __init__ (self)
| __init__ (self, QString serviceName, QString identityID)
QString | description (self)
Plasma.AuthorizationRule.Persistence | persistence (self)
QString | pin (self)
Plasma.AuthorizationRule.Policy | policy (self)
QString | serviceName (self)
| setPersistence (self, Plasma.AuthorizationRule.Persistence persistence)
| setPin (self, QString pin)
| setPolicy (self, Plasma.AuthorizationRule.Policy policy)

## Signal Documentation

changed | ( | Plasma.AuthorizationRule | a0
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("changed(Plasma::AuthorizationRule*)"), target_slot)`

## Method Documentation

__init__ | ( |  | self ) |

__init__ | ( | self, |
|  | QString | serviceName,
|  | QString | identityID
| ) |  |  |

QString description | ( |  | self ) |

Returns:
  a friendly and i18n'd description of the current rule, useful for creating a GUI to allow editing rules, or asking permission for an access attempt.

Plasma.AuthorizationRule.Persistence persistence | ( |  | self ) |

Returns:
  the flags describing this rule.

QString pin | ( |  | self ) |

Returns:
  the pin for pin pairing.

Plasma.AuthorizationRule.Policy policy | ( |  | self ) |

Returns:
  the flags describing this rule.

QString serviceName | ( |  | self ) |

Returns:
  the name of the service this rule applies to.

setPersistence | ( | self, |
|  | Plasma.AuthorizationRule.Persistence | persistence
| ) |  |  |

Parameters:

  | rules | the flags describing this rule.

setPin | ( | self, |
|  | QString | pin
| ) |  |  |

Parameters:

  | pin | set pin for pin pairing. You'll need to call this bevore setting the rule.

setPolicy | ( | self, |
|  | Plasma.AuthorizationRule.Policy | policy
| ) |  |  |

Parameters:

  | rules | the flags describing this rule.

## Enumeration Documentation

Persistence

Enumerator:

  Transient = 0 |
  Persistent = 1 |

Policy

Enumerator:

  Deny = 0 |
  Allow = 1 |
  PinRequired = 2 |

Target

Enumerator:

  Default = 0 |
  AllUsers = 1 |
  AllServices = 2 |