]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge pull request #1205 from owncloud/ocs_api
authorThomas Müller <thomas.mueller@tmit.eu>
Fri, 18 Jan 2013 13:52:51 +0000 (05:52 -0800)
committerThomas Müller <thomas.mueller@tmit.eu>
Fri, 18 Jan 2013 13:52:51 +0000 (05:52 -0800)
Return 401 headers when trying to access a restricted api call

1  2 
lib/api.php

diff --cc lib/api.php
index 8d728d4311fd71c63b798c6eda5a4723b6d07a55,7d8f68780767c78a005e97d4bc2123537fda7d07..0fce109a4231b85d43a9ee6394fecb702ef2c073
@@@ -92,8 -92,10 +92,10 @@@ class OC_API 
                                $response = call_user_func(self::$actions[$name]['action'], $parameters);
                        } else {
                                $response = new OC_OCS_Result(null, 998, 'Api method not found');
 -                      } 
 +                      }
                } else {
+                       header('WWW-Authenticate: Basic realm="Authorization Required"');
+                       header('HTTP/1.0 401 Unauthorized');
                        $response = new OC_OCS_Result(null, 997, 'Unauthorised');
                }
                // Send the response