Defined Type: polkit::authorization::basic_policy
- Defined in:
- manifests/authorization/basic_policy.pp
Summary
Add a rule file containing javascript Polkit configuration to the systemOverview
The intention of this define is to make it easy to add simple polkit rules to a system. An example simple rule template is shown below:
“‘ // This file is managed by Puppet polkit.addRule(function(action, subject) {
if (<condition>) {
return polkit.Result.<result>;
}
}
}); “‘
A user-specified <condition> can be supplied with the $condition parameter, or the define can use the polkit::condition function to generate a condition using $action_id, $user and/or $group, an (optionally) $local and $active.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'manifests/authorization/basic_policy.pp', line 79
define polkit::authorization::basic_policy (
Polkit::Result $result,
Enum['present','absent'] $ensure = 'present',
Optional[String] $action_id = undef,
Variant[Undef,String,Array[String]] $user = undef,
Variant[Undef,String,Array[String]] $group = undef,
Boolean $local = false,
Boolean $active = false,
Optional[String] $condition = undef,
Boolean $log_action = true,
Boolean $log_subject = true,
Integer[0,99] $priority = 10,
Stdlib::AbsolutePath $rulesd = '/etc/polkit-1/rules.d',
) {
# For backwards compatibility purposes, this defined type is inert if called from an unsupported OS
if simplib::module_metadata::os_supported( load_module_metadata($module_name), { 'release_match' => 'major' }) {
include polkit
if !$condition {
if !$action_id {
fail('If $condition is not specified, $action_id must be')
}
}
polkit::authorization::rule { $name:
ensure => $ensure,
priority => $priority,
rulesd => $rulesd,
content => template('polkit/basic_policy.erb'),
}
}
}
|