1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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
111
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2_core_foundation::*;
use crate::*;
/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationrightrule?language=objc)
pub const kAuthorizationRightRule: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"rule\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationruleisadmin?language=objc)
pub const kAuthorizationRuleIsAdmin: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"is-admin\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationruleauthenticateassessionuser?language=objc)
pub const kAuthorizationRuleAuthenticateAsSessionUser: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"authenticate-session-owner\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationruleauthenticateasadmin?language=objc)
pub const kAuthorizationRuleAuthenticateAsAdmin: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"authenticate-admin\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationruleclassallow?language=objc)
pub const kAuthorizationRuleClassAllow: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"allow\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationruleclassdeny?language=objc)
pub const kAuthorizationRuleClassDeny: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"deny\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationcomment?language=objc)
pub const kAuthorizationComment: &CStr =
unsafe { CStr::from_bytes_with_nul_unchecked(b"comment\0") };
extern "C-unwind" {
/// Retrieves a right definition as a dictionary. There are no restrictions to keep anyone from retrieving these definitions.
///
///
/// Parameter `rightName`: (input) the rightname (ASCII). Wildcard rightname definitions are okay.
///
/// Parameter `rightDefinition`: (output/optional) the dictionary with all keys defining the right. See documented keys. Passing in NULL will just check if there is a definition. The caller is responsible for releasing the returned dictionary.
///
///
/// Returns: errAuthorizationSuccess 0 No error.
///
/// errAuthorizationDenied -60005 No definition found.
///
/// # Safety
///
/// - `right_name` must be a valid pointer.
/// - `right_definition` must be a valid pointer or null.
pub fn AuthorizationRightGet(
right_name: NonNull<c_char>,
right_definition: *mut *const CFDictionary,
) -> OSStatus;
}
extern "C-unwind" {
/// Create or update a right entry. Only normal rights can be registered (wildcard rights are denied); wildcard rights are considered to be put in by an administrator putting together a site configuration.
///
///
/// Parameter `authRef`: (input) authRef to authorize modifications.
///
/// Parameter `rightName`: (input) the rightname (ASCII). Wildcard rightnames are not okay.
///
/// Parameter `rightDefinition`: (input) a CFString of the name of a rule to use (delegate) or CFDictionary containing keys defining one.
///
/// Parameter `descriptionKey`: (input/optional) a CFString to use as a key for looking up localized descriptions. If no localization is found this will be the description itself.
///
/// Parameter `bundle`: (input/optional) a bundle to get localizations from if not the main bundle.
///
/// Parameter `localeTableName`: (input/optional) stringtable name to get localizations from.
///
///
/// Returns: errAuthorizationSuccess 0 added right definition successfully.
///
/// errAuthorizationDenied -60005 Unable to create or update right definition.
///
/// errAuthorizationCanceled -60006 Authorization was canceled by user.
///
/// errAuthorizationInteractionNotAllowed -60007 Interaction was required but not possible.
///
/// # Safety
///
/// - `auth_ref` must be a valid pointer.
/// - `right_name` must be a valid pointer.
/// - `right_definition` should be of the correct type.
#[cfg(feature = "Authorization")]
pub fn AuthorizationRightSet(
auth_ref: AuthorizationRef,
right_name: NonNull<c_char>,
right_definition: &CFType,
description_key: Option<&CFString>,
bundle: Option<&CFBundle>,
locale_table_name: Option<&CFString>,
) -> OSStatus;
}
extern "C-unwind" {
/// Request to remove a right from the policy database.
///
///
/// Parameter `authRef`: (input) authRef, to be used to authorize this action.
///
/// Parameter `rightName`: (input) the rightname (ASCII). Wildcard rightnames are not okay.
///
/// # Safety
///
/// - `auth_ref` must be a valid pointer.
/// - `right_name` must be a valid pointer.
#[cfg(feature = "Authorization")]
pub fn AuthorizationRightRemove(
auth_ref: AuthorizationRef,
right_name: NonNull<c_char>,
) -> OSStatus;
}