LLMS_REST_API_Key::has_permission( string $method )
Determine if the key has the permissions required by the HTTP Request Method.
Parameters Parameters
- $method
-
(string) (Required) The HTTP request method.
Return Return
(bool)
Source Source
File: libraries/lifterlms-rest/includes/models/class-llms-rest-api-key.php
public function has_permission( $method ) { $permissions = $this->get( 'permissions' ); switch ( $method ) { case 'HEAD': case 'GET': $ret = ( 'read' === $permissions || 'read_write' === $permissions ); break; case 'POST': case 'PUT': case 'PATCH': case 'DELETE': $ret = ( 'write' === $permissions || 'read_write' === $permissions ); break; case 'OPTIONS': $ret = true; break; default: $ret = false; } return $ret; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.1 | Introduced. |