apiprivateauthaction.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * StatusNet, the distributed open-source microblogging tool
  4. *
  5. * Base class for API actions that only require auth when a site
  6. * is configured to be private
  7. *
  8. * PHP version 5
  9. *
  10. * LICENCE: This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as published by
  12. * the Free Software Foundation, either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. * @category API
  24. * @package StatusNet
  25. * @author Adrian Lang <mail@adrianlang.de>
  26. * @author Brenda Wallace <shiny@cpan.org>
  27. * @author Craig Andrews <candrews@integralblue.com>
  28. * @author Dan Moore <dan@moore.cx>
  29. * @author Evan Prodromou <evan@status.net>
  30. * @author mEDI <medi@milaro.net>
  31. * @author Sarven Capadisli <csarven@status.net>
  32. * @author Zach Copley <zach@status.net>
  33. * @copyright 2009 StatusNet, Inc.
  34. * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
  35. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  36. * @link http://status.net/
  37. */
  38. if (!defined('STATUSNET')) {
  39. exit(1);
  40. }
  41. /**
  42. * Actions extending this class will require auth only if a site is private
  43. *
  44. * @category API
  45. * @package StatusNet
  46. * @author Adrian Lang <mail@adrianlang.de>
  47. * @author Brenda Wallace <shiny@cpan.org>
  48. * @author Craig Andrews <candrews@integralblue.com>
  49. * @author Dan Moore <dan@moore.cx>
  50. * @author Evan Prodromou <evan@status.net>
  51. * @author mEDI <medi@milaro.net>
  52. * @author Sarven Capadisli <csarven@status.net>
  53. * @author Zach Copley <zach@status.net>
  54. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  55. * @link http://status.net/
  56. */
  57. class ApiPrivateAuthAction extends ApiAuthAction
  58. {
  59. /**
  60. * Does this API resource require authentication?
  61. *
  62. * @return boolean true or false
  63. */
  64. function requiresAuth()
  65. {
  66. // If the site is "private", all API methods except statusnet/config
  67. // need authentication
  68. if (common_config('site', 'private')) {
  69. return true;
  70. }
  71. return false;
  72. }
  73. }