@@ -92,33 +92,35 @@ public static function get_rest_uri() {
92
92
*/
93
93
public function register_routes () {
94
94
$ args = array (
95
- 'methods ' => WP_REST_Server::CREATABLE ,
96
- 'callback ' => array ( $ this , 'generate_key_pair ' ),
97
- 'args ' => array (
98
- 'name ' => array (
95
+ 'methods ' => WP_REST_Server::CREATABLE ,
96
+ 'callback ' => array ( $ this , 'generate_key_pair ' ),
97
+ 'permission_callback ' => '__return_true ' ,
98
+ 'args ' => array (
99
+ 'name ' => array (
99
100
'description ' => esc_html__ ( 'The name of the key-pair. ' , 'jwt-auth ' ),
100
101
'type ' => 'string ' ,
101
102
'required ' => true ,
102
103
'sanitize_callback ' => 'sanitize_text_field ' ,
103
104
'validate_callback ' => 'rest_validate_request_arg ' ,
104
105
),
105
- 'user_id ' => array (
106
+ 'user_id ' => array (
106
107
'description ' => esc_html__ ( 'The ID of the user. ' , 'jwt-auth ' ),
107
108
'type ' => 'integer ' ,
108
109
'required ' => true ,
109
110
'sanitize_callback ' => 'absint ' ,
110
111
'validate_callback ' => 'rest_validate_request_arg ' ,
111
112
),
112
113
),
113
- 'schema ' => array ( $ this , 'get_item_schema ' ),
114
+ 'schema ' => array ( $ this , 'get_item_schema ' ),
114
115
);
115
116
register_rest_route ( self ::_NAMESPACE_ , '/ ' . self ::_REST_BASE_ . '/(?P<user_id>[\d]+) ' , $ args );
116
117
117
118
$ args = array (
118
- 'methods ' => WP_REST_Server::DELETABLE ,
119
- 'callback ' => array ( $ this , 'delete_all_key_pairs ' ),
120
- 'args ' => array (
121
- 'user_id ' => array (
119
+ 'methods ' => WP_REST_Server::DELETABLE ,
120
+ 'callback ' => array ( $ this , 'delete_all_key_pairs ' ),
121
+ 'permission_callback ' => '__return_true ' ,
122
+ 'args ' => array (
123
+ 'user_id ' => array (
122
124
'description ' => esc_html__ ( 'The ID of the user. ' , 'jwt-auth ' ),
123
125
'type ' => 'integer ' ,
124
126
'required ' => true ,
@@ -130,17 +132,18 @@ public function register_routes() {
130
132
register_rest_route ( self ::_NAMESPACE_ , '/ ' . self ::_REST_BASE_ . '/(?P<user_id>[\d]+)/revoke-all ' , $ args );
131
133
132
134
$ args = array (
133
- 'methods ' => WP_REST_Server::DELETABLE ,
134
- 'callback ' => array ( $ this , 'delete_key_pair ' ),
135
- 'args ' => array (
136
- 'user_id ' => array (
135
+ 'methods ' => WP_REST_Server::DELETABLE ,
136
+ 'callback ' => array ( $ this , 'delete_key_pair ' ),
137
+ 'permission_callback ' => '__return_true ' ,
138
+ 'args ' => array (
139
+ 'user_id ' => array (
137
140
'description ' => esc_html__ ( 'The ID of the user. ' , 'jwt-auth ' ),
138
141
'type ' => 'integer ' ,
139
142
'required ' => true ,
140
143
'sanitize_callback ' => 'absint ' ,
141
144
'validate_callback ' => 'rest_validate_request_arg ' ,
142
145
),
143
- 'api_key ' => array (
146
+ 'api_key ' => array (
144
147
'description ' => esc_html__ ( 'The API key being revoked. ' , 'jwt-auth ' ),
145
148
'type ' => 'string ' ,
146
149
'required ' => true ,
0 commit comments