KDECore
Go to the documentation of this file.
23 #include <Security/Security.h>
29 AuthorizationRef auth;
30 AuthorizationCreate(NULL, NULL, kAuthorizationFlagDefaults, &auth);
34 foreach(
const Action &action, actions) {
36 err = AuthorizationRightGet(action.
name.toLatin1(), NULL);
38 if (err == errAuthorizationDenied) {
42 if (action.
policy == QLatin1String(
"yes"))
43 rule = QString::fromLatin1(kAuthorizationRuleClassAllow);
44 else if (action.
policy == QLatin1String(
"no"))
45 rule = QString::fromLatin1(kAuthorizationRuleClassDeny);
46 else if (action.
policy == QLatin1String(
"auth_self"))
47 rule = QString::fromLatin1(kAuthorizationRuleAuthenticateAsSessionUser);
48 else if (action.
policy == QLatin1String(
"auth_admin"))
49 rule = QString::fromLatin1(kAuthorizationRuleAuthenticateAsAdmin);
51 CFStringRef cfRule = CFStringCreateWithCString(NULL, rule.toLatin1(), kCFStringEncodingASCII);
52 CFStringRef cfPrompt = CFStringCreateWithCString(NULL, action.
descriptions.value(QLatin1String(
"en")).toLatin1(), kCFStringEncodingASCII);
54 err = AuthorizationRightSet(auth, action.
name.toLatin1(), cfRule, cfPrompt, NULL, NULL);
56 cerr <<
"You don't have the right to edit the security database (try to run cmake with sudo): " << err << endl;
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Mon Jul 15 2013 13:00:52 by
doxygen 1.8.3.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.