From 790d24a1f695cd7ba0275d977f7498c7310c0114 Mon Sep 17 00:00:00 2001 From: Almira Krdzic Date: Mon, 22 Oct 2018 10:58:45 +0200 Subject: [PATCH] forbid admin user on frontend --- .../plugins/wiaas/includes/class-wiaas-authentication.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/app/plugins/wiaas/includes/class-wiaas-authentication.php b/backend/app/plugins/wiaas/includes/class-wiaas-authentication.php index 5bb41e3..3b92f05 100644 --- a/backend/app/plugins/wiaas/includes/class-wiaas-authentication.php +++ b/backend/app/plugins/wiaas/includes/class-wiaas-authentication.php @@ -166,6 +166,12 @@ 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, + )); + } $role = user_can($user->ID, 'wiaas_customer') ? 'customer' : ''; $user->set_role($role);