objc2_security/generated/AuthorizationDB.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2_core_foundation::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationrightrule?language=objc)
10pub const kAuthorizationRightRule: &CStr =
11 unsafe { CStr::from_bytes_with_nul_unchecked(b"rule\0") };
12/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationruleisadmin?language=objc)
13pub const kAuthorizationRuleIsAdmin: &CStr =
14 unsafe { CStr::from_bytes_with_nul_unchecked(b"is-admin\0") };
15/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationruleauthenticateassessionuser?language=objc)
16pub const kAuthorizationRuleAuthenticateAsSessionUser: &CStr =
17 unsafe { CStr::from_bytes_with_nul_unchecked(b"authenticate-session-owner\0") };
18/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationruleauthenticateasadmin?language=objc)
19pub const kAuthorizationRuleAuthenticateAsAdmin: &CStr =
20 unsafe { CStr::from_bytes_with_nul_unchecked(b"authenticate-admin\0") };
21/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationruleclassallow?language=objc)
22pub const kAuthorizationRuleClassAllow: &CStr =
23 unsafe { CStr::from_bytes_with_nul_unchecked(b"allow\0") };
24/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationruleclassdeny?language=objc)
25pub const kAuthorizationRuleClassDeny: &CStr =
26 unsafe { CStr::from_bytes_with_nul_unchecked(b"deny\0") };
27/// [Apple's documentation](https://developer.apple.com/documentation/security/kauthorizationcomment?language=objc)
28pub const kAuthorizationComment: &CStr =
29 unsafe { CStr::from_bytes_with_nul_unchecked(b"comment\0") };
30extern "C-unwind" {
31 /// Retrieves a right definition as a dictionary. There are no restrictions to keep anyone from retrieving these definitions.
32 ///
33 ///
34 /// Parameter `rightName`: (input) the rightname (ASCII). Wildcard rightname definitions are okay.
35 ///
36 /// 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.
37 ///
38 ///
39 /// Returns: errAuthorizationSuccess 0 No error.
40 ///
41 /// errAuthorizationDenied -60005 No definition found.
42 ///
43 /// # Safety
44 ///
45 /// - `right_name` must be a valid pointer.
46 /// - `right_definition` must be a valid pointer or null.
47 pub fn AuthorizationRightGet(
48 right_name: NonNull<c_char>,
49 right_definition: *mut *const CFDictionary,
50 ) -> OSStatus;
51}
52
53extern "C-unwind" {
54 /// 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.
55 ///
56 ///
57 /// Parameter `authRef`: (input) authRef to authorize modifications.
58 ///
59 /// Parameter `rightName`: (input) the rightname (ASCII). Wildcard rightnames are not okay.
60 ///
61 /// Parameter `rightDefinition`: (input) a CFString of the name of a rule to use (delegate) or CFDictionary containing keys defining one.
62 ///
63 /// 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.
64 ///
65 /// Parameter `bundle`: (input/optional) a bundle to get localizations from if not the main bundle.
66 ///
67 /// Parameter `localeTableName`: (input/optional) stringtable name to get localizations from.
68 ///
69 ///
70 /// Returns: errAuthorizationSuccess 0 added right definition successfully.
71 ///
72 /// errAuthorizationDenied -60005 Unable to create or update right definition.
73 ///
74 /// errAuthorizationCanceled -60006 Authorization was canceled by user.
75 ///
76 /// errAuthorizationInteractionNotAllowed -60007 Interaction was required but not possible.
77 ///
78 /// # Safety
79 ///
80 /// - `auth_ref` must be a valid pointer.
81 /// - `right_name` must be a valid pointer.
82 /// - `right_definition` should be of the correct type.
83 #[cfg(feature = "Authorization")]
84 pub fn AuthorizationRightSet(
85 auth_ref: AuthorizationRef,
86 right_name: NonNull<c_char>,
87 right_definition: &CFType,
88 description_key: Option<&CFString>,
89 bundle: Option<&CFBundle>,
90 locale_table_name: Option<&CFString>,
91 ) -> OSStatus;
92}
93
94extern "C-unwind" {
95 /// Request to remove a right from the policy database.
96 ///
97 ///
98 /// Parameter `authRef`: (input) authRef, to be used to authorize this action.
99 ///
100 /// Parameter `rightName`: (input) the rightname (ASCII). Wildcard rightnames are not okay.
101 ///
102 /// # Safety
103 ///
104 /// - `auth_ref` must be a valid pointer.
105 /// - `right_name` must be a valid pointer.
106 #[cfg(feature = "Authorization")]
107 pub fn AuthorizationRightRemove(
108 auth_ref: AuthorizationRef,
109 right_name: NonNull<c_char>,
110 ) -> OSStatus;
111}