Skip to content

Commit

Permalink
Merge pull request #337 from gocodebox/dev
Browse files Browse the repository at this point in the history
Release 1.0.2
  • Loading branch information
brianhogg authored Jul 18, 2024
2 parents 3ea9874 + 2fa5dcc commit cc052ec
Show file tree
Hide file tree
Showing 15 changed files with 125 additions and 120 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
LifterLMS REST API Changelog
============================

v1.0.2 - 2024-07-18
-------------------

##### Bug Fixes

+ Removes the unavailable quiz resource link from the lessons resource until the quiz resource is added.
+ Show only instructor and student roles in the instructor and student list responses by default.


v1.0.1 - 2024-07-09
-------------------

Expand Down
2 changes: 1 addition & 1 deletion class-lifterlms-rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class LifterLMS_REST_API {
*
* @var string
*/
public $version = '1.0.1';
public $version = '1.0.2';

/**
* Constructor.
Expand Down
72 changes: 36 additions & 36 deletions i18n/lifterlms-rest.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the GPLv3.
msgid ""
msgstr ""
"Project-Id-Version: LifterLMS REST API 1.0.1\n"
"Project-Id-Version: LifterLMS REST API 1.0.2\n"
"Report-Msgid-Bugs-To: https://lifterlms.com/my-account/my-tickets\n"
"Last-Translator: Team LifterLMS <[email protected]>\n"
"Language-Team: Team LifterLMS <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-07-09T14:31:15+00:00\n"
"POT-Creation-Date: 2024-07-18T17:20:16+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: llms/dev 0.2.1\n"
"X-Domain: lifterlms\n"
Expand Down Expand Up @@ -946,12 +946,12 @@ msgid "List of course instructors. Defaults to current user when creating a new
msgstr ""

#: includes/server/class-llms-rest-courses-controller.php:248
#: includes/server/class-llms-rest-lessons-controller.php:370
#: includes/server/class-llms-rest-lessons-controller.php:367
msgid "URL to an oEmbed enable audio URL."
msgstr ""

#: includes/server/class-llms-rest-courses-controller.php:257
#: includes/server/class-llms-rest-lessons-controller.php:379
#: includes/server/class-llms-rest-lessons-controller.php:376
msgid "URL to an oEmbed enable video URL."
msgstr ""

Expand Down Expand Up @@ -1177,76 +1177,76 @@ msgstr ""
msgid "The enrollment trigger. Default is `any`."
msgstr ""

#: includes/server/class-llms-rest-instructors-controller.php:65
#: includes/server/class-llms-rest-instructors-controller.php:91
msgid "You are not allowed to create new instructors."
msgstr ""

#: includes/server/class-llms-rest-instructors-controller.php:83
#: includes/server/class-llms-rest-instructors-controller.php:108
msgid "You are not allowed to delete this instructor."
msgstr ""

#: includes/server/class-llms-rest-instructors-controller.php:102
#: includes/server/class-llms-rest-instructors-controller.php:126
msgid "Retrieve only instructors for the specified course(s) and/or membership(s). Accepts a single WP Post ID or a comma separated list of IDs."
msgstr ""

#: includes/server/class-llms-rest-instructors-controller.php:110
#: includes/server/class-llms-rest-instructors-controller.php:134
msgid "Exclude instructors who do not have permissions for the specified course(s) and/or membership(s). Accepts a single WP Post ID or a comma separated list of IDs."
msgstr ""

#: includes/server/class-llms-rest-instructors-controller.php:132
#: includes/server/class-llms-rest-instructors-controller.php:155
msgid "You are not allowed to view this instructor."
msgstr ""

#: includes/server/class-llms-rest-instructors-controller.php:168
#: includes/server/class-llms-rest-instructors-controller.php:189
msgid "You are not allowed to list instructors."
msgstr ""

#: includes/server/class-llms-rest-instructors-controller.php:256
#: includes/server/class-llms-rest-instructors-controller.php:273
msgid "You are not allowed to edit this instructor."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:169
#: includes/server/class-llms-rest-lessons-controller.php:168
msgid "Invalid course_id param. It must be a valid Course ID."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:180
#: includes/server/class-llms-rest-lessons-controller.php:179
#: includes/server/class-llms-rest-sections-controller.php:221
msgid "Invalid order param. It must be greater than 0."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:201
#: includes/server/class-llms-rest-lessons-controller.php:200
msgid "Invalid drip_days param. It must be greater than 0."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:326
#: includes/server/class-llms-rest-lessons-controller.php:323
msgid "WordPress post ID of the parent item. Must be a Section ID. 0 indicates an \"orphaned\" lesson which can be edited and viewed by instructors and admins but cannot be read by students."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:334
#: includes/server/class-llms-rest-lessons-controller.php:331
msgid "WordPress post ID of the lesson's parent course."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:343
#: includes/server/class-llms-rest-lessons-controller.php:340
msgid "Order of the lesson within its immediate parent."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:353
#: includes/server/class-llms-rest-lessons-controller.php:350
msgid "Lesson ID of the prerequisite lesson."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:361
#: includes/server/class-llms-rest-lessons-controller.php:358
msgid "Determines the weight of the lesson when grading the course."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:388
#: includes/server/class-llms-rest-lessons-controller.php:385
msgid "The date and time when the lesson becomes available. Applicable only when drip_method is date. Format: Y-m-d H:i:s."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:396
#: includes/server/class-llms-rest-lessons-controller.php:393
msgid "Number of days to wait before allowing access to the lesson. Applicable only when drip_method is enrollment, start, or prerequisite."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:405
#: includes/server/class-llms-rest-lessons-controller.php:402
msgid ""
"Determine the method with which to make the lesson content available.\n"
"\t\t\t\t\t<ul>\n"
Expand All @@ -1258,23 +1258,23 @@ msgid ""
"\t\t\t\t\t</ul>"
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:422
#: includes/server/class-llms-rest-lessons-controller.php:419
msgid "Denotes a lesson that's publicly accessible regardless of course enrollment."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:428
#: includes/server/class-llms-rest-lessons-controller.php:425
msgid "Associate a quiz with this lesson."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:437
#: includes/server/class-llms-rest-lessons-controller.php:434
msgid "Determines if a quiz is enabled for the lesson."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:443
#: includes/server/class-llms-rest-lessons-controller.php:440
msgid "The post ID of the associated quiz."
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:452
#: includes/server/class-llms-rest-lessons-controller.php:449
msgid ""
"Determines lesson progression requirements related to the quiz.\n"
"\t\t\t\t\t\t\t<ul>\n"
Expand All @@ -1283,7 +1283,7 @@ msgid ""
"\t\t\t\t\t\t\t</ul>"
msgstr ""

#: includes/server/class-llms-rest-lessons-controller.php:510
#: includes/server/class-llms-rest-lessons-controller.php:506
msgid "Filter lessons by the parent post (section) ID."
msgstr ""

Expand Down Expand Up @@ -1368,35 +1368,35 @@ msgstr ""
msgid "Filter sections by the parent post (course) ID."
msgstr ""

#: includes/server/class-llms-rest-students-controller.php:75
#: includes/server/class-llms-rest-students-controller.php:74
msgid "You are not allowed to create new students."
msgstr ""

#: includes/server/class-llms-rest-students-controller.php:93
#: includes/server/class-llms-rest-students-controller.php:91
msgid "You are not allowed to delete this student."
msgstr ""

#: includes/server/class-llms-rest-students-controller.php:112
#: includes/server/class-llms-rest-students-controller.php:109
msgid "Retrieve only students enrolled in the specified course(s) and/or membership(s). Accepts a single WP Post ID or a comma separated list of IDs."
msgstr ""

#: includes/server/class-llms-rest-students-controller.php:120
#: includes/server/class-llms-rest-students-controller.php:117
msgid "Retrieve only students not enrolled in the specified course(s) and/or membership(s). Accepts a single WP Post ID or a comma separated list of IDs."
msgstr ""

#: includes/server/class-llms-rest-students-controller.php:158
#: includes/server/class-llms-rest-students-controller.php:153
msgid "You are not allowed to view this student."
msgstr ""

#: includes/server/class-llms-rest-students-controller.php:176
#: includes/server/class-llms-rest-students-controller.php:170
msgid "You are not allowed to filter students by role."
msgstr ""

#: includes/server/class-llms-rest-students-controller.php:180
#: includes/server/class-llms-rest-students-controller.php:174
msgid "You are not allowed to list students."
msgstr ""

#: includes/server/class-llms-rest-students-controller.php:377
#: includes/server/class-llms-rest-students-controller.php:393
msgid "You are not allowed to edit this student."
msgstr ""

Expand Down
37 changes: 26 additions & 11 deletions includes/server/class-llms-rest-instructors-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,33 @@ protected function check_read_item_permissions( $item_id ) {
}

return current_user_can( 'list_users', $item_id );
}

/**
* Format query arguments to retrieve a collection of objects
*
* @since 1.0.2
*
* @param WP_REST_Request $request Full details about the request.
* @return array|WP_Error
*/
protected function prepare_collection_query_args( $request ) {

$query_args = parent::prepare_collection_query_args( $request );
if ( is_wp_error( $query_args ) ) {
return $query_args;
}

if ( empty( $request['roles'] ) ) {
$query_args = array_merge(
$query_args,
array(
'roles' => $this->get_item_schema_base()['properties']['roles']['default'],
)
);
}

return $query_args;
}

/**
Expand All @@ -66,7 +92,6 @@ public function create_item_permissions_check( $request ) {
}

return $this->check_roles_permissions( $request );

}

/**
Expand All @@ -84,7 +109,6 @@ public function delete_item_permissions_check( $request ) {
}

return true;

}

/**
Expand Down Expand Up @@ -115,7 +139,6 @@ public function get_collection_params() {
);

return $params;

}

/**
Expand All @@ -133,7 +156,6 @@ public function get_item_permissions_check( $request ) {
}

return true;

}

/**
Expand All @@ -150,7 +172,6 @@ public function get_item_schema_base() {
$schema['properties']['roles']['default'] = array( 'instructor' );

return $schema;

}

/**
Expand All @@ -169,7 +190,6 @@ public function get_items_permissions_check( $request ) {
}

return true;

}

/**
Expand All @@ -184,7 +204,6 @@ protected function get_object( $id ) {

$instructor = llms_get_instructor( $id );
return $instructor ? $instructor : llms_rest_not_found_error();

}

/**
Expand All @@ -206,7 +225,6 @@ protected function prepare_links( $object, $request ) {
);

return $links;

}

/**
Expand Down Expand Up @@ -234,7 +252,6 @@ protected function update_additional_data( $object_id, $prepared, $request ) {
}

return $object;

}

/**
Expand All @@ -257,7 +274,5 @@ public function update_item_permissions_check( $request ) {
}

return $this->check_roles_permissions( $request );

}

}
Loading

0 comments on commit cc052ec

Please sign in to comment.