I'm writing an application that needs to read and write an existing file in /usr/share...
If I understood well I need to use Polkit/PolicyKit
to ask the system for a permission and ask the user to do the appropriate action (entering password).
If the user enters the proper password, the permission will be granted.
I'm using a GTK.LockButton while building a PolKit.Permission
like this :
public static Polkit.Permission? create_permission () {
string filename = "my.action" ;
try {
var permission = new Polkit.Permission.sync (filename, Polkit.UnixProcess.new (Posix.getpid ()));
return permission;
} catch (Error e) {
critical ("Error while getting permission from '%s'. Error: %s", filename, e.message) ;
return null ;
}
}
(I'm using vala)
And now I have to write a permission descriptor file.
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
<policyconfig>
<vendor>my app</vendor>
<vendor_url>https://myurl.com/</vendor_url>
<action id="my.action">
</action>
</policyconfig>
Could you help writing the rest of the permission descriptor file?
0 Answers