LLMS_Rest_Admin_Settings_API_Keys::authorize_key_owner( int $user_id )
Ensure the current user is allowed to assign the requested key owner.
Parameters Parameters
- $user_id
-
(int) (Required) WP_User ID of the requested key owner.
Return Return
(WP_Error|true) Returns true when authorized or a WP_Error when not.
Source Source
File: libraries/lifterlms-rest/includes/admin/class-llms-rest-admin-settings-api-keys.php
protected static function authorize_key_owner( $user_id ) {
if ( $user_id && ! current_user_can( 'edit_user', (int) $user_id ) ) {
return new WP_Error( 'llms_rest_key_invalid_user_id', __( 'You are not allowed to assign this user as the key owner.', 'lifterlms' ) );
}
return true;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.7 | Introduced. |