JsonOutputTrait.php wip_alan_T8059_being_splitting_of_Roophp_into
authorAlan <alan@roojs.com>
Thu, 29 Feb 2024 05:01:00 +0000 (13:01 +0800)
committerAlan <alan@roojs.com>
Thu, 29 Feb 2024 05:01:00 +0000 (13:01 +0800)
JsonOutputTrait.php

index a035934..0c1e7a4 100644 (file)
@@ -59,6 +59,20 @@ trait Pman_Core_JsonOutputTrait {
         return $this->jerror('NOTICE-' . $type, $str, $errors, $content_type);
     }
     
+     /**
+     * jerrAuth: standard auth failure - with data that let's the UI know..
+     */
+    function jerrAuth()
+    {
+        $au = $this->authUser;
+        if ($au) {
+            // is it an authfailure?
+            $this->jerror("LOGIN-NOPERM", "Permission denied to view this resource", array('authFailure' => true));
+        }
+        $this->jerror("LOGIN-NOAUTH", "Not authenticated", array('authFailure' => true));
+    }
+     
+     
     /**
      * Recomended JSON error indicator
      *