From 09aac81276e06fea937a272523094cd94c029db8 Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Mon, 22 Oct 2018 11:00:48 +0200 Subject: [PATCH] allow admin on frontend --- .../plugins/wiaas/includes/class-wiaas-authentication.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-authentication.php b/backend/app/plugins/wiaas/includes/class-wiaas-authentication.php index 3b92f05..64474df 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-authentication.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-authentication.php @@ -47,7 +47,7 @@ class Wiaas_Authentication { */ public static function authenticate_current_user($user_id) { // do nothing if user not authenticated, user is super admin or this is REST API request - if (! $user_id || $user_id === self::SUPER_ADMIN_USER_ID) { + if (! $user_id || (int) $user_id === self::SUPER_ADMIN_USER_ID) { return $user_id; } @@ -168,9 +168,7 @@ class Wiaas_Authentication { public static function authenticate_rest_user_on_login($data, $user) { // if admin do nothing if ($user->ID === self::SUPER_ADMIN_USER_ID) { - return new WP_Error('wiaas_authentication_error', 'No Customer permissions!', array( - 'status' => 403, - )); + return $data; } $role = user_can($user->ID, 'wiaas_customer') ? 'customer' : ''; $user->set_role($role);