Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Permissions | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| rest_is_authorized_admin | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | namespace NewfoldLabs\WP\Module\Installer; |
| 3 | |
| 4 | /** |
| 5 | * Permissions and Authorization constants and utilities. |
| 6 | */ |
| 7 | final class Permissions { |
| 8 | /** |
| 9 | * WordPress Admin capability string |
| 10 | */ |
| 11 | const ADMIN = 'manage_options'; |
| 12 | |
| 13 | /** |
| 14 | * Confirm REST API caller has ADMIN user capabilities. |
| 15 | * |
| 16 | * @return boolean |
| 17 | */ |
| 18 | public static function rest_is_authorized_admin() { |
| 19 | return \is_user_logged_in() && \current_user_can( self::ADMIN ); |
| 20 | } |
| 21 | } |