From 863e4aea314e689d28be777d14e9af9691d78678 Mon Sep 17 00:00:00 2001 From: Amin Akbari Date: Mon, 28 May 2018 23:50:52 +0200 Subject: [PATCH] Added cache control to fix bug with internet explorer not updating UF table data --- .../admin/src/Controller/ActivityController.php | 3 ++- .../admin/src/Controller/GroupController.php | 6 ++++-- .../admin/src/Controller/PermissionController.php | 8 +++++--- .../admin/src/Controller/RoleController.php | 9 ++++++--- .../admin/src/Controller/UserController.php | 14 +++++++++----- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/app/sprinkles/admin/src/Controller/ActivityController.php b/app/sprinkles/admin/src/Controller/ActivityController.php index 2fbe0d97f..c4fb9a0df 100644 --- a/app/sprinkles/admin/src/Controller/ActivityController.php +++ b/app/sprinkles/admin/src/Controller/ActivityController.php @@ -57,7 +57,8 @@ public function getList($request, $response, $args) // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). - return $sprunje->toResponse($response); + //set cache headers in order to stop specially IE to cache the result + return $sprunje->toResponse($response)->withHeader('Cache-Control', 'no-cache')->withHeader('Expires', '-1'); } /** diff --git a/app/sprinkles/admin/src/Controller/GroupController.php b/app/sprinkles/admin/src/Controller/GroupController.php index 7ca94b1b1..df2858aa7 100644 --- a/app/sprinkles/admin/src/Controller/GroupController.php +++ b/app/sprinkles/admin/src/Controller/GroupController.php @@ -269,7 +269,8 @@ public function getList($request, $response, $args) // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). - return $sprunje->toResponse($response); + //set cache headers in order to stop specially IE to cache the result + return $sprunje->toResponse($response)->withHeader('Cache-Control', 'no-cache')->withHeader('Expires', '-1'); } public function getModalConfirmDelete($request, $response, $args) @@ -474,7 +475,8 @@ public function getUsers($request, $response, $args) // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). - return $sprunje->toResponse($response); + //set cache headers in order to stop specially IE to cache the result + return $sprunje->toResponse($response)->withHeader('Cache-Control', 'no-cache')->withHeader('Expires', '-1'); } /** diff --git a/app/sprinkles/admin/src/Controller/PermissionController.php b/app/sprinkles/admin/src/Controller/PermissionController.php index 660e296c9..3a612bde0 100644 --- a/app/sprinkles/admin/src/Controller/PermissionController.php +++ b/app/sprinkles/admin/src/Controller/PermissionController.php @@ -101,7 +101,8 @@ public function getList($request, $response, $args) // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). - return $sprunje->toResponse($response); + //set cache headers in order to stop specially IE to cache the result + return $sprunje->toResponse($response)->withHeader('Cache-Control', 'no-cache')->withHeader('Expires', '-1'); } /** @@ -133,8 +134,9 @@ public function getUsers($request, $response, $args) $params['permission_id'] = $args['id']; $sprunje = $classMapper->createInstance('permission_user_sprunje', $classMapper, $params); - - $response = $sprunje->toResponse($response); + + //set cache headers in order to stop specially IE to cache the result + $response = $sprunje->toResponse($response)->withHeader('Cache-Control', 'no-cache')->withHeader('Expires', '-1'); // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). diff --git a/app/sprinkles/admin/src/Controller/RoleController.php b/app/sprinkles/admin/src/Controller/RoleController.php index ab86c88be..ba9f3dd44 100644 --- a/app/sprinkles/admin/src/Controller/RoleController.php +++ b/app/sprinkles/admin/src/Controller/RoleController.php @@ -268,7 +268,8 @@ public function getList($request, $response, $args) // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). - return $sprunje->toResponse($response); + //set cache headers in order to stop specially IE to cache the result + return $sprunje->toResponse($response)->withHeader('Cache-Control', 'no-cache')->withHeader('Expires', '-1'); } public function getModalConfirmDelete($request, $response, $args) @@ -526,7 +527,8 @@ public function getPermissions($request, $response, $args) // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). - return $sprunje->toResponse($response); + //set cache headers in order to stop specially IE to cache the result + return $sprunje->toResponse($response)->withHeader('Cache-Control', 'no-cache')->withHeader('Expires', '-1'); } /** @@ -571,7 +573,8 @@ public function getUsers($request, $response, $args) // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). - return $sprunje->toResponse($response); + //set cache headers in order to stop specially IE to cache the result + return $sprunje->toResponse($response)->withHeader('Cache-Control', 'no-cache')->withHeader('Expires', '-1'); } /** diff --git a/app/sprinkles/admin/src/Controller/UserController.php b/app/sprinkles/admin/src/Controller/UserController.php index ff41009cd..a043fc660 100644 --- a/app/sprinkles/admin/src/Controller/UserController.php +++ b/app/sprinkles/admin/src/Controller/UserController.php @@ -342,7 +342,8 @@ public function getActivities($request, $response, $args) // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). - return $sprunje->toResponse($response); + //set cache headers in order to stop specially IE to cache the result + return $sprunje->toResponse($response)->withHeader('Cache-Control', 'no-cache')->withHeader('Expires', '-1'); } /** @@ -420,7 +421,8 @@ public function getList($request, $response, $args) // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). - return $sprunje->toResponse($response); + //set cache headers in order to stop specially IE to cache the result + return $sprunje->toResponse($response)->withHeader('Cache-Control', 'no-cache')->withHeader('Expires', '-1'); } /** @@ -768,8 +770,9 @@ public function getPermissions($request, $response, $args) $params['user_id'] = $user->id; $sprunje = $classMapper->createInstance('user_permission_sprunje', $classMapper, $params); - - $response = $sprunje->toResponse($response); + + //set cache headers in order to stop specially IE to cache the result + $response = $sprunje->toResponse($response)->withHeader('Cache-Control', 'no-cache')->withHeader('Expires', '-1'); // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). @@ -818,7 +821,8 @@ public function getRoles($request, $response, $args) // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). - return $sprunje->toResponse($response); + //set cache headers in order to stop specially IE to cache the result + return $sprunje->toResponse($response)->withHeader('Cache-Control', 'no-cache')->withHeader('Expires', '-1'); } /**