179: def set_right(name, values)
180:
181:
182:
183: values = convert_plist_to_native_attributes(values)
184: tmp = Tempfile.new('puppet_macauthorization')
185: begin
186: Plist::Emit.save_plist(values, tmp.path)
187: cmds = []
188: cmds << :security << "authorizationdb" << "write" << name
189:
190: output = execute(
191: cmds, :combine => false,
192:
193: :stdinfile => tmp.path.to_s)
194: rescue Errno::EACCES => e
195: raise Puppet::Error.new("Cannot save right to #{tmp.path}: #{e}")
196: ensure
197: tmp.close
198: tmp.unlink
199: end
200: end