LLMS_REST_Enrollments_Controller::get_items_permissions_check( WP_REST_Request $request )

Check if a given request has access to read items.


Parameters Parameters

$request

(WP_REST_Request) (Required) Full details about the request.


Top ↑

Return Return

(WP_Error|boolean)


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/server/class-llms-rest-enrollments-controller.php

	public function get_items_permissions_check( $request ) {

		if ( stristr( $request->get_route(), '/students/' ) && isset( $request['id'] ) ) {
			$enrollment             = new stdClass();
			$enrollment->student_id = (int) $request['id'];
			if ( ! $this->check_read_permission( $enrollment ) ) {
				return llms_rest_authorization_required_error();
			}
		}

		return true;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.4 Everybody who can view the enrollment's student can list the enrollments although the single enrollment permission will be checked in LLMS_REST_Enrollments_Controller::get_objects().
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.