Merge branch 'master' of github.com:ArtemD/SpeedFreak
[speedfreak] / Server / application / controllers / users.php
index ee20517..94badbe 100644 (file)
@@ -71,11 +71,29 @@ class Users_Controller extends Controller{
      * @return string Returns XML containing list of all users or error message
      */
     public function list_all(){
-       $users = new User_Model();
-       $list = $users->list_all_users();
-       $view = new View('api/user_list');
-       $view->list = $list;
-       $view->render(true);
+       if (apiler::is_authorized()){
+               $users = new User_Model();
+               $list = $users->list_all_users();
+               $view = new View('api/user_list');
+               $view->list = $list;
+               $view->render(true);
+           }
+           else
+               apiler::not_authorized();
+    }
+    
+    /**
+    * Verify credentials
+    *
+    * @return string Returns string "OK" if login is successful and error otherwise
+    */
+    public function login(){
+       if (apiler::is_authorized()){
+               print "OK";
+            die;
+       }
+        else
+               apiler::not_authorized();
     }