objc2_open_directory/generated/ODRecord.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10 /// This class is used to read, update and modify records within the directory
11 ///
12 /// This class is used to read, update and modify records within the directory. outError is optional parameter,
13 /// nil can be passed if error details are not needed.
14 ///
15 /// See also [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odrecord?language=objc)
16 #[unsafe(super(NSObject))]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 pub struct ODRecord;
19);
20
21extern_conformance!(
22 unsafe impl NSObjectProtocol for ODRecord {}
23);
24
25impl ODRecord {
26 extern_methods!(
27 /// Similar to calling -[ODNode setCredentials:] except credentials are only set for this particular
28 /// record's node
29 ///
30 /// Sets the credentials if necessary on the ODNode referenced by this ODRecord. Very similar to
31 /// calling -[ODNode setCredentials:] except other records referencing the underlying node will not get
32 /// authenticated, therefore inadvertant changes cannot occur. If all records referencing a particular
33 /// node need to be updated, then use -[ODNode setCredentials:] on the original node instead. If the
34 /// node is already authenticated with the same name and password, it will be a NOOP call. The original
35 /// ODNode held by an ODRecord will be released when the credentials are changed for the connection
36 /// associated with the record. outError is optional parameter, nil can be passed if error details are not needed.
37 ///
38 /// # Safety
39 ///
40 /// - `in_username` might not allow `None`.
41 /// - `in_password` might not allow `None`.
42 /// - `out_error` might not allow `None`.
43 #[unsafe(method(setNodeCredentials:password:error:))]
44 #[unsafe(method_family = none)]
45 pub unsafe fn setNodeCredentials_password_error(
46 &self,
47 in_username: Option<&NSString>,
48 in_password: Option<&NSString>,
49 out_error: Option<&mut Option<Retained<NSError>>>,
50 ) -> bool;
51
52 #[cfg(all(feature = "CFOpenDirectory", feature = "CFOpenDirectoryConstants"))]
53 /// Similar to calling -[ODNode setCredentialsWithRecordType:] except credentials are only set for this particular record's
54 /// node
55 ///
56 /// Allows the caller to use other types of authentications that are available in OpenDirectory, that may
57 /// require response-request loops, etc. Not all OD plugins will support this call, look for
58 /// kODErrorCredentialsMethodNotSupported in outError. Same behavior as ODRecordSetNodeCredentials. outError
59 /// is optional parameter, nil can be passed if error details are not needed.
60 ///
61 /// # Safety
62 ///
63 /// - `in_record_type` might not allow `None`.
64 /// - `in_type` might not allow `None`.
65 /// - `in_items` generic should be of the correct type.
66 /// - `in_items` might not allow `None`.
67 /// - `out_items` generic should be of the correct type.
68 /// - `out_items` might not allow `None`.
69 /// - `out_context` should be of the correct type.
70 /// - `out_context` might not allow `None`.
71 /// - `out_error` might not allow `None`.
72 #[unsafe(method(setNodeCredentialsWithRecordType:authenticationType:authenticationItems:continueItems:context:error:))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn setNodeCredentialsWithRecordType_authenticationType_authenticationItems_continueItems_context_error(
75 &self,
76 in_record_type: Option<&ODRecordType>,
77 in_type: Option<&ODAuthenticationType>,
78 in_items: Option<&NSArray>,
79 out_items: Option<&mut Option<Retained<NSArray>>>,
80 out_context: Option<&mut Option<Retained<AnyObject>>>,
81 out_error: Option<&mut Option<Retained<NSError>>>,
82 ) -> bool;
83
84 /// Unsupported method.
85 ///
86 /// Unsupported method.
87 ///
88 /// # Safety
89 ///
90 /// - `in_cache_name` might not allow `None`.
91 /// - `out_error` might not allow `None`.
92 #[deprecated]
93 #[unsafe(method(setNodeCredentialsUsingKerberosCache:error:))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn setNodeCredentialsUsingKerberosCache_error(
96 &self,
97 in_cache_name: Option<&NSString>,
98 out_error: Option<&mut Option<Retained<NSError>>>,
99 ) -> bool;
100
101 /// Returns a dictionary containing the password policy for the record if available.
102 ///
103 /// Returns a dictionary containing the password policy for the record if available. If no policy for record
104 /// nil will be returned. outError is optional parameter, nil can be passed if error details are not needed.
105 ///
106 /// # Safety
107 ///
108 /// `out_error` might not allow `None`.
109 #[deprecated = "use effectivePoliciesAndReturnError"]
110 #[unsafe(method(passwordPolicyAndReturnError:))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn passwordPolicyAndReturnError(
113 &self,
114 out_error: Option<&mut Option<Retained<NSError>>>,
115 ) -> Option<Retained<NSDictionary>>;
116
117 /// Verifies the password provided is valid for the record
118 ///
119 /// Verifies the password provided is valid for the record. outError is optional parameter, nil can be passed if
120 /// error details are not needed.
121 ///
122 /// # Safety
123 ///
124 /// - `in_password` might not allow `None`.
125 /// - `out_error` might not allow `None`.
126 #[unsafe(method(verifyPassword:error:))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn verifyPassword_error(
129 &self,
130 in_password: Option<&NSString>,
131 out_error: Option<&mut Option<Retained<NSError>>>,
132 ) -> bool;
133
134 #[cfg(all(feature = "CFOpenDirectory", feature = "CFOpenDirectoryConstants"))]
135 /// Allows use of other OpenDirectory types of authentications
136 ///
137 /// Allows the caller to use other types of authentications that are available in OpenDirectory, that may
138 /// require response-request loops, etc. A bool with the result of the operation.
139 /// If it fails, outError can be checked for more specific error. Some ODNodes may not support the call
140 /// so an error code of kODErrorCredentialsMethodNotSupported may be returned. outError is optional
141 /// parameter, nil can be passed if error details are not needed.
142 ///
143 /// # Safety
144 ///
145 /// - `in_type` might not allow `None`.
146 /// - `in_items` generic should be of the correct type.
147 /// - `in_items` might not allow `None`.
148 /// - `out_items` generic should be of the correct type.
149 /// - `out_items` might not allow `None`.
150 /// - `out_context` should be of the correct type.
151 /// - `out_context` might not allow `None`.
152 /// - `out_error` might not allow `None`.
153 #[unsafe(method(verifyExtendedWithAuthenticationType:authenticationItems:continueItems:context:error:))]
154 #[unsafe(method_family = none)]
155 pub unsafe fn verifyExtendedWithAuthenticationType_authenticationItems_continueItems_context_error(
156 &self,
157 in_type: Option<&ODAuthenticationType>,
158 in_items: Option<&NSArray>,
159 out_items: Option<&mut Option<Retained<NSArray>>>,
160 out_context: Option<&mut Option<Retained<AnyObject>>>,
161 out_error: Option<&mut Option<Retained<NSError>>>,
162 ) -> bool;
163
164 /// Changes the password for a record
165 ///
166 /// Changes the password for a record. The oldPassword can be nil if password is being set assuming the appropriate
167 /// privileges are in place. outError is optional parameter, nil can be passed if error details are not needed.
168 ///
169 /// # Safety
170 ///
171 /// - `old_password` might not allow `None`.
172 /// - `new_password` might not allow `None`.
173 /// - `out_error` might not allow `None`.
174 #[unsafe(method(changePassword:toPassword:error:))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn changePassword_toPassword_error(
177 &self,
178 old_password: Option<&NSString>,
179 new_password: Option<&NSString>,
180 out_error: Option<&mut Option<Retained<NSError>>>,
181 ) -> bool;
182
183 /// Synchronizes the record from the Directory in order to get current data and/or commit pending changes
184 ///
185 /// Synchronizes the record from the Directory in order to get current data. Any previously fetched attributes
186 /// will be re-fetch from the Directory. This will not re-fetch the entire record, unless the entire record
187 /// has been accessed. Additionally, any changes made to the record will be committed to the directory,
188 /// if the node does not do immediate commits. outError is optional parameter, nil can be passed if error details
189 /// are not needed.
190 ///
191 /// # Safety
192 ///
193 /// `out_error` might not allow `None`.
194 #[unsafe(method(synchronizeAndReturnError:))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn synchronizeAndReturnError(
197 &self,
198 out_error: Option<&mut Option<Retained<NSError>>>,
199 ) -> bool;
200
201 /// Type of the record.
202 ///
203 /// The record type.
204 #[unsafe(method(recordType))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn recordType(&self) -> Retained<NSString>;
207
208 /// Name of the record.
209 ///
210 /// This is the official record name.
211 #[unsafe(method(recordName))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn recordName(&self) -> Retained<NSString>;
214
215 /// Returns the attributes and values in the form of a key-value pair set.
216 ///
217 /// Returns the attributes and values in the form of a key-value pair set for this record. The key is a
218 /// NSString of the attribute name (e.g., kODAttributeTypeRecordName, etc.) and the value is an NSArray
219 /// of either NSData or NSString depending on the type of data. Binary data will be returned as NSData.
220 /// If nil is passed, then all currently retrieved attributes will be returned. outError is optional parameter,
221 /// nil can be passed if error details are not needed.
222 ///
223 /// # Safety
224 ///
225 /// - `in_attributes` generic should be of the correct type.
226 /// - `in_attributes` might not allow `None`.
227 /// - `out_error` might not allow `None`.
228 #[unsafe(method(recordDetailsForAttributes:error:))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn recordDetailsForAttributes_error(
231 &self,
232 in_attributes: Option<&NSArray>,
233 out_error: Option<&mut Option<Retained<NSError>>>,
234 ) -> Option<Retained<NSDictionary>>;
235
236 #[cfg(all(feature = "CFOpenDirectory", feature = "CFOpenDirectoryConstants"))]
237 /// Returns an NSArray of NSString or NSData values of the attribute
238 ///
239 /// Returns an NSArray of NSString or NSData depending on the type of data. Binary data will be
240 /// returned as NSData. outError is optional parameter, nil can be passed if error details are not needed.
241 ///
242 /// # Safety
243 ///
244 /// - `in_attribute` might not allow `None`.
245 /// - `out_error` might not allow `None`.
246 #[unsafe(method(valuesForAttribute:error:))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn valuesForAttribute_error(
249 &self,
250 in_attribute: Option<&ODAttributeType>,
251 out_error: Option<&mut Option<Retained<NSError>>>,
252 ) -> Option<Retained<NSArray>>;
253
254 #[cfg(all(feature = "CFOpenDirectory", feature = "CFOpenDirectoryConstants"))]
255 /// Will take a mixture of NSData or NSString or an NSArray of either type when setting the values of an attribute
256 ///
257 /// Will take a mixture of NSData or NSString or an NSArray of either type when setting the values of an attribute.
258 /// outError is optional parameter, nil can be passed if error details are not needed.
259 ///
260 /// # Safety
261 ///
262 /// - `in_value_or_values` should be of the correct type.
263 /// - `in_value_or_values` might not allow `None`.
264 /// - `in_attribute` might not allow `None`.
265 /// - `out_error` might not allow `None`.
266 #[unsafe(method(setValue:forAttribute:error:))]
267 #[unsafe(method_family = none)]
268 pub unsafe fn setValue_forAttribute_error(
269 &self,
270 in_value_or_values: Option<&AnyObject>,
271 in_attribute: Option<&ODAttributeType>,
272 out_error: Option<&mut Option<Retained<NSError>>>,
273 ) -> bool;
274
275 #[cfg(all(feature = "CFOpenDirectory", feature = "CFOpenDirectoryConstants"))]
276 /// Removes all the values for an attribute.
277 ///
278 /// Removes all the values for an attribute. outError is optional parameter, nil can be passed if
279 /// error details are not needed.
280 ///
281 /// # Safety
282 ///
283 /// - `in_attribute` might not allow `None`.
284 /// - `out_error` might not allow `None`.
285 #[unsafe(method(removeValuesForAttribute:error:))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn removeValuesForAttribute_error(
288 &self,
289 in_attribute: Option<&ODAttributeType>,
290 out_error: Option<&mut Option<Retained<NSError>>>,
291 ) -> bool;
292
293 #[cfg(all(feature = "CFOpenDirectory", feature = "CFOpenDirectoryConstants"))]
294 /// Will add a value to an attribute
295 ///
296 /// Will add a value to an attribute. Should be either NSData or NSString type. outError is optional
297 /// parameter, nil can be passed if error details are not needed.
298 ///
299 /// # Safety
300 ///
301 /// - `in_value` should be of the correct type.
302 /// - `in_value` might not allow `None`.
303 /// - `in_attribute` might not allow `None`.
304 /// - `out_error` might not allow `None`.
305 #[unsafe(method(addValue:toAttribute:error:))]
306 #[unsafe(method_family = none)]
307 pub unsafe fn addValue_toAttribute_error(
308 &self,
309 in_value: Option<&AnyObject>,
310 in_attribute: Option<&ODAttributeType>,
311 out_error: Option<&mut Option<Retained<NSError>>>,
312 ) -> bool;
313
314 #[cfg(all(feature = "CFOpenDirectory", feature = "CFOpenDirectoryConstants"))]
315 /// Will remove a value from an attribute
316 ///
317 /// Will remove a value from an attribute. Should be either NSData or NSString type. outError is optional
318 /// parameter, nil can be passed if error details are not needed.
319 ///
320 /// # Safety
321 ///
322 /// - `in_value` should be of the correct type.
323 /// - `in_value` might not allow `None`.
324 /// - `in_attribute` might not allow `None`.
325 /// - `out_error` might not allow `None`.
326 #[unsafe(method(removeValue:fromAttribute:error:))]
327 #[unsafe(method_family = none)]
328 pub unsafe fn removeValue_fromAttribute_error(
329 &self,
330 in_value: Option<&AnyObject>,
331 in_attribute: Option<&ODAttributeType>,
332 out_error: Option<&mut Option<Retained<NSError>>>,
333 ) -> bool;
334
335 /// Deletes the record from the node and invalidates the record.
336 ///
337 /// Deletes the record from the node and invalidates the record. The ODRecord should be
338 /// released after deletion. outError is optional parameter, nil can be passed if error details are not needed.
339 ///
340 /// # Safety
341 ///
342 /// `out_error` might not allow `None`.
343 #[unsafe(method(deleteRecordAndReturnError:))]
344 #[unsafe(method_family = none)]
345 pub unsafe fn deleteRecordAndReturnError(
346 &self,
347 out_error: Option<&mut Option<Retained<NSError>>>,
348 ) -> bool;
349
350 /// This will copy any policies configured for the record.
351 ///
352 /// This will copy any policies configured for the record.
353 ///
354 /// # Safety
355 ///
356 /// `error` might not allow `None`.
357 #[deprecated = "use accountPoliciesAndReturnError:"]
358 #[unsafe(method(policiesAndReturnError:))]
359 #[unsafe(method_family = none)]
360 pub unsafe fn policiesAndReturnError(
361 &self,
362 error: Option<&mut Option<Retained<NSError>>>,
363 ) -> Option<Retained<NSDictionary>>;
364
365 /// This will copy any policies configured for the record.
366 ///
367 /// This will copy any policies configured for the record.
368 ///
369 /// # Safety
370 ///
371 /// `error` might not allow `None`.
372 #[deprecated = "use authenticationAllowedAndReturnError: and similar methods"]
373 #[unsafe(method(effectivePoliciesAndReturnError:))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn effectivePoliciesAndReturnError(
376 &self,
377 error: Option<&mut Option<Retained<NSError>>>,
378 ) -> Option<Retained<NSDictionary>>;
379
380 /// This will return a dictionary of supported policies.
381 ///
382 /// This will return a dictionary of supported policies, if appropriate, the value will be the maximum value allowed
383 /// for the policy in question. For example, if password history is available, it will state how much history is
384 /// supported.
385 ///
386 /// # Safety
387 ///
388 /// `error` might not allow `None`.
389 #[deprecated]
390 #[unsafe(method(supportedPoliciesAndReturnError:))]
391 #[unsafe(method_family = none)]
392 pub unsafe fn supportedPoliciesAndReturnError(
393 &self,
394 error: Option<&mut Option<Retained<NSError>>>,
395 ) -> Option<Retained<NSDictionary>>;
396
397 /// This will set the policy for the record.
398 ///
399 /// This will set the policy for the record. Policies are evaluated in combination with node-level policies.
400 ///
401 /// # Safety
402 ///
403 /// - `policies` generic should be of the correct type.
404 /// - `policies` might not allow `None`.
405 /// - `error` might not allow `None`.
406 #[deprecated = "use setAccountPolicies:error:"]
407 #[unsafe(method(setPolicies:error:))]
408 #[unsafe(method_family = none)]
409 pub unsafe fn setPolicies_error(
410 &self,
411 policies: Option<&NSDictionary>,
412 error: Option<&mut Option<Retained<NSError>>>,
413 ) -> bool;
414
415 #[cfg(all(feature = "CFOpenDirectory", feature = "CFOpenDirectoryConstants"))]
416 /// This will set a specific policy setting for the record.
417 ///
418 /// This will set a specific policy setting for the record.
419 ///
420 /// # Safety
421 ///
422 /// - `policy` might not allow `None`.
423 /// - `value` should be of the correct type.
424 /// - `value` might not allow `None`.
425 /// - `error` might not allow `None`.
426 #[deprecated = "use addAccountPolicy:toCategory:error:"]
427 #[unsafe(method(setPolicy:value:error:))]
428 #[unsafe(method_family = none)]
429 pub unsafe fn setPolicy_value_error(
430 &self,
431 policy: Option<&ODPolicyType>,
432 value: Option<&AnyObject>,
433 error: Option<&mut Option<Retained<NSError>>>,
434 ) -> bool;
435
436 #[cfg(all(feature = "CFOpenDirectory", feature = "CFOpenDirectoryConstants"))]
437 /// This will remove a specific policy setting from the record.
438 ///
439 /// This will remove a specific policy setting from the record.
440 ///
441 /// # Safety
442 ///
443 /// - `policy` might not allow `None`.
444 /// - `error` might not allow `None`.
445 #[deprecated = "use removeAccountPolicy:fromCategory:error:"]
446 #[unsafe(method(removePolicy:error:))]
447 #[unsafe(method_family = none)]
448 pub unsafe fn removePolicy_error(
449 &self,
450 policy: Option<&ODPolicyType>,
451 error: Option<&mut Option<Retained<NSError>>>,
452 ) -> bool;
453
454 #[cfg(all(feature = "CFOpenDirectory", feature = "CFOpenDirectoryConstants"))]
455 /// This will add a specific policy to the specific category for the record.
456 ///
457 /// This will add a specific policy to the specific category for the record.
458 /// The specified policy will be applied, in combination with any
459 /// node policies, to the specified record when policies are evaluated.
460 ///
461 /// Parameter `policy`: a dictionary containing the specific policy to be added.
462 /// The dictionary may contain the following keys:
463 /// kODPolicyKeyIdentifier a required key identifying the policy.
464 /// kODPolicyKeyParameters an optional key containing a dictionary of
465 /// parameters that can be used for informational purposes or in
466 /// the policy format string.
467 /// kODPolicyKeyContent a required key specifying the policy,
468 /// from which a predicate will be created for evaluating
469 /// the policy.
470 ///
471 /// Parameter `category`: a valid ODPolicyCategoryType to which the policy will be added.
472 ///
473 /// Parameter `error`: an optional NSError reference for error details.
474 ///
475 /// Returns: a BOOL which signifies if the policy addition succeeded, otherwise error is set.
476 ///
477 /// # Safety
478 ///
479 /// - `policy` generic should be of the correct type.
480 /// - `policy` might not allow `None`.
481 /// - `category` might not allow `None`.
482 /// - `error` might not allow `None`.
483 #[unsafe(method(addAccountPolicy:toCategory:error:))]
484 #[unsafe(method_family = none)]
485 pub unsafe fn addAccountPolicy_toCategory_error(
486 &self,
487 policy: Option<&NSDictionary>,
488 category: Option<&ODPolicyCategoryType>,
489 error: Option<&mut Option<Retained<NSError>>>,
490 ) -> bool;
491
492 #[cfg(all(feature = "CFOpenDirectory", feature = "CFOpenDirectoryConstants"))]
493 /// This will remove a specific policy from the specific category for the record.
494 ///
495 /// This will remove a specific policy from the specific category for the record.
496 ///
497 /// Parameter `policy`: a dictionary containing the specific policy to be
498 /// removed, with the same format as described in addAccountPolicy.
499 ///
500 /// Parameter `category`: a valid ODPolicyCategoryType from which the policy will be removed.
501 ///
502 /// Parameter `error`: an optional NSError reference for error details.
503 ///
504 /// Returns: a BOOL which signifies if the policy removal succeeded, otherwise error is set.
505 ///
506 /// # Safety
507 ///
508 /// - `policy` generic should be of the correct type.
509 /// - `policy` might not allow `None`.
510 /// - `category` might not allow `None`.
511 /// - `error` might not allow `None`.
512 #[unsafe(method(removeAccountPolicy:fromCategory:error:))]
513 #[unsafe(method_family = none)]
514 pub unsafe fn removeAccountPolicy_fromCategory_error(
515 &self,
516 policy: Option<&NSDictionary>,
517 category: Option<&ODPolicyCategoryType>,
518 error: Option<&mut Option<Retained<NSError>>>,
519 ) -> bool;
520
521 /// This will set the policies for the record.
522 ///
523 /// This will set the policies for the record, replacing any
524 /// existing policies. All of the policies in the set will be
525 /// applied to the record when policies are evaluated.
526 ///
527 /// Parameter `policies`: a dictionary containing all of the policies to be set
528 /// for the node. The dictionary may contain the following keys:
529 /// kODPolicyCategoryAuthentication an optional key with a value
530 /// of an array of policy dictionaries that specify when
531 /// authentications should be allowed.
532 /// kODPolicyCategoryPasswordContent an optional key with a
533 /// value of an array of policy dictionaries the specify the
534 /// required content of passwords.
535 /// kODPolicyCategoryPasswordChange an optional key with a value
536 /// of an array of policy dictionaries that specify when
537 /// passwords are required to be changed.
538 ///
539 /// Parameter `error`: an optional NSError reference for error details.
540 ///
541 /// Returns: a BOOL which signifies if the policy set succeeded, otherwise error is set.
542 ///
543 /// # Safety
544 ///
545 /// - `policies` generic should be of the correct type.
546 /// - `policies` might not allow `None`.
547 /// - `error` might not allow `None`.
548 #[unsafe(method(setAccountPolicies:error:))]
549 #[unsafe(method_family = none)]
550 pub unsafe fn setAccountPolicies_error(
551 &self,
552 policies: Option<&NSDictionary>,
553 error: Option<&mut Option<Retained<NSError>>>,
554 ) -> bool;
555
556 /// Returns a dictionary containing any policies configured for the record.
557 ///
558 /// Returns a dictionary containing any policies configured for the record.
559 /// Does not include any policies set for the node.
560 ///
561 /// Returns a dictionary containing any policies configured for the record.
562 ///
563 /// Parameter `error`: an optional NSError reference for error details.
564 ///
565 /// Returns: a NSDictionary containing all currently set policies. The
566 /// format of the dictionary is the same as described in
567 /// setAccountPolicies.
568 ///
569 /// # Safety
570 ///
571 /// `error` might not allow `None`.
572 #[unsafe(method(accountPoliciesAndReturnError:))]
573 #[unsafe(method_family = none)]
574 pub unsafe fn accountPoliciesAndReturnError(
575 &self,
576 error: Option<&mut Option<Retained<NSError>>>,
577 ) -> Option<Retained<NSDictionary>>;
578
579 /// Determines if policies allow the account to authenticate.
580 ///
581 /// Determines if policies allow the account to authenticate.
582 /// Authentication and password change policies are evaluated.
583 /// Record-level and node-level policies are evaluated in
584 /// combination, with record-level taking precedence over node-level
585 /// policies. The failure of any single policy will deny the
586 /// authentication.
587 ///
588 /// This check is only definitive at the time it was requested. The
589 /// policy or the environment could change before the authentication
590 /// is actually requested. Errors from the authentication request
591 /// should be consulted.
592 ///
593 /// It is not necessary to call this function when calling
594 /// verifyPassword or verifyPasswordExtended since those methods
595 /// perform the same policy evaluation.
596 ///
597 ///
598 /// Parameter `error`: an optional NSError reference for error details.
599 ///
600 /// Returns: a bool which signifies if the authentication is allowed, otherwise error is set.
601 ///
602 /// # Safety
603 ///
604 /// `error` might not allow `None`.
605 #[unsafe(method(authenticationAllowedAndReturnError:))]
606 #[unsafe(method_family = none)]
607 pub unsafe fn authenticationAllowedAndReturnError(
608 &self,
609 error: Option<&mut Option<Retained<NSError>>>,
610 ) -> bool;
611
612 /// Determines if policies allow the password change.
613 ///
614 /// Determines if policies allow the password change. Password
615 /// content policies are evaluated. Record-level and node-level
616 /// policies are evaluated in combination, with record-level taking
617 /// precedence over node-level policies. The failure of any single
618 /// policy will deny the password change.
619 ///
620 /// This check is only definitive at the time it was requested. The
621 /// policy or the environment could change before the password change
622 /// is actually requested. Errors from the password change request
623 /// should be consulted.
624 ///
625 ///
626 /// Parameter `newPassword`: contains the password to be evaluated.
627 ///
628 /// Parameter `error`: an optional NSError reference for error details.
629 ///
630 /// Returns: a BOOL which signifies if the password change is allowed, otherwise error is set.
631 ///
632 /// # Safety
633 ///
634 /// - `new_password` might not allow `None`.
635 /// - `error` might not allow `None`.
636 #[unsafe(method(passwordChangeAllowed:error:))]
637 #[unsafe(method_family = none)]
638 pub unsafe fn passwordChangeAllowed_error(
639 &self,
640 new_password: Option<&NSString>,
641 error: Option<&mut Option<Retained<NSError>>>,
642 ) -> bool;
643
644 /// Determines if the password will expire within the specified time.
645 ///
646 /// Determines if the password will expire (i.e. need to be changed)
647 /// between now and the specified number of seconds in the future.
648 /// Password change policies are evaluated. Record-level and
649 /// node-level policies are evaluated in combination, with
650 /// record-level taking precedence over node-level policies.
651 ///
652 /// Parameter `willExpireIn`: the number of seconds from the current time to be
653 /// used as the upper-bound for the password expiration period.
654 ///
655 /// Returns: a BOOL which signifies if the password will expire within the
656 /// specified time.
657 #[unsafe(method(willPasswordExpire:))]
658 #[unsafe(method_family = none)]
659 pub unsafe fn willPasswordExpire(&self, will_expire_in: u64) -> bool;
660
661 /// Determines if authentications will expire within the specified time.
662 ///
663 /// Determines if authentications will expire (i.e. session and/or
664 /// account expires) between now and the specified number of seconds
665 /// in the future. Authentication policies are evaluated.
666 /// Record-level and node-level policies are evaluated in
667 /// combination, with record-level taking precedence over node-level
668 /// policies.
669 ///
670 /// Parameter `willExpireIn`: the number of seconds from the current time to be
671 /// used as the upper-bound for the authentication expiration period.
672 ///
673 /// Returns: a BOOL which signifies if authentications will expire within the
674 /// specified time.
675 #[unsafe(method(willAuthenticationsExpire:))]
676 #[unsafe(method_family = none)]
677 pub unsafe fn willAuthenticationsExpire(&self, will_expire_in: u64) -> bool;
678
679 /// Determines how many seconds until the password expires.
680 ///
681 /// Determines how many seconds until the password expires (i.e.
682 /// needs changing). Password change policies are evaluated.
683 /// Record-level and node-level policies are evaluated in
684 /// combination, with record-level taking precedence over node-level
685 /// policies.
686 ///
687 /// Returns: the number of seconds until the password expires. If multiple
688 /// policies will cause the password to expire, the soonest
689 /// expiration time is returned. If already expired,
690 /// kODExpirationTimeExpired is returned. If there are no password
691 /// change policies, kODExpirationTimeNeverExpires is returned.
692 #[unsafe(method(secondsUntilPasswordExpires))]
693 #[unsafe(method_family = none)]
694 pub unsafe fn secondsUntilPasswordExpires(&self) -> i64;
695
696 /// Determines how many seconds until authentications expire.
697 ///
698 /// Determines how many seconds until authentications expire (i.e.
699 /// session and/or account expires). Authentication policies are
700 /// evaluated. Record-level and node-level policies are evaluated
701 /// in combination, with record-level taking precedence over
702 /// node-level policies.
703 ///
704 /// Returns: the number of seconds until authentications expire. If multiple
705 /// policies will cause authentications to expire, the soonest
706 /// expiration time is returned. If already expired,
707 /// kODExpirationTimeExpired is returned. If there are no
708 /// authentication policies controlling expiration,
709 /// kODExpirationTimeNeverExpires is returned.
710 #[unsafe(method(secondsUntilAuthenticationsExpire))]
711 #[unsafe(method_family = none)]
712 pub unsafe fn secondsUntilAuthenticationsExpire(&self) -> i64;
713 );
714}
715
716/// Methods declared on superclass `NSObject`.
717impl ODRecord {
718 extern_methods!(
719 #[unsafe(method(init))]
720 #[unsafe(method_family = init)]
721 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
722
723 #[unsafe(method(new))]
724 #[unsafe(method_family = new)]
725 pub unsafe fn new() -> Retained<Self>;
726 );
727}
728
729/// ODRecordGroupExtensions.
730///
731/// Record extensions for checking and modifying group membership.
732impl ODRecord {
733 extern_methods!(
734 /// Will add the record as a member of the group record
735 ///
736 /// Will add the record as a member of the group record. An error will be returned if the record is not
737 /// a group record. Additionally, if the member record is not an appropriate type allowed as part of a group
738 /// an error will be returned. outError is optional parameter, nil can be passed if error details are not needed.
739 ///
740 /// # Safety
741 ///
742 /// - `in_record` might not allow `None`.
743 /// - `out_error` might not allow `None`.
744 #[unsafe(method(addMemberRecord:error:))]
745 #[unsafe(method_family = none)]
746 pub unsafe fn addMemberRecord_error(
747 &self,
748 in_record: Option<&ODRecord>,
749 out_error: Option<&mut Option<Retained<NSError>>>,
750 ) -> bool;
751
752 /// Will remove the record as a member from the group record
753 ///
754 /// Will remove the record as a member from the group record. An error will be returned if the record is not
755 /// a group record. Additionally, if the member record is not an appropriate type allowed as part of a group
756 /// an error will be returned. outError is optional parameter, nil can be passed if error details are not needed.
757 ///
758 /// # Safety
759 ///
760 /// - `in_record` might not allow `None`.
761 /// - `out_error` might not allow `None`.
762 #[unsafe(method(removeMemberRecord:error:))]
763 #[unsafe(method_family = none)]
764 pub unsafe fn removeMemberRecord_error(
765 &self,
766 in_record: Option<&ODRecord>,
767 out_error: Option<&mut Option<Retained<NSError>>>,
768 ) -> bool;
769
770 /// Will use membership APIs to determine if inRecord is a member of the group
771 ///
772 /// Will use membership APIs to determine if inRecord is a member of the group. If the receiving
773 /// object is not a group then NO will still be returned. outError is optional parameter, nil can be passed if
774 /// error details are not needed.
775 ///
776 /// # Safety
777 ///
778 /// - `in_record` might not allow `None`.
779 /// - `out_error` might not allow `None`.
780 #[unsafe(method(isMemberRecord:error:))]
781 #[unsafe(method_family = none)]
782 pub unsafe fn isMemberRecord_error(
783 &self,
784 in_record: Option<&ODRecord>,
785 out_error: Option<&mut Option<Retained<NSError>>>,
786 ) -> bool;
787 );
788}