Nam*_*arl 5 permissions gtk policykit
我正在编写一个需要读取和写入现有文件的应用程序 /usr/share...
如果我理解得很好,我需要使用Polkit/PolicyKit
向系统请求权限并要求用户执行适当的操作(输入密码)。
如果用户输入正确的密码,将授予权限。
我正在使用GTK.LockButton构建PolKit.Permission
这样的:
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 ;
}
}
Run Code Online (Sandbox Code Playgroud)
(我正在使用 vala)
现在我必须写一个权限描述符文件。
<!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>
Run Code Online (Sandbox Code Playgroud)
你能帮忙写下权限描述符文件的其余部分吗?