cloud.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Frank Karlitschek
  6. * @author Tom Needham
  7. * @copyright 2012 Frank Karlitschek frank@owncloud.org
  8. * @copyright 2012 Tom Needham tom@owncloud.com
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  12. * License as published by the Free Software Foundation; either
  13. * version 3 of the License, or any later version.
  14. *
  15. * This library 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
  21. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. class OC_OCS_Cloud {
  25. public static function getCapabilities($parameters) {
  26. $result = array();
  27. list($major, $minor, $micro) = OC_Util::getVersion();
  28. $result['version'] = array(
  29. 'major' => $major,
  30. 'minor' => $minor,
  31. 'micro' => $micro,
  32. 'string' => OC_Util::getVersionString(),
  33. 'edition' => OC_Util::getEditionString(),
  34. );
  35. $result['capabilities'] = array(
  36. 'core' => array(
  37. 'pollinterval' => OC_Config::getValue('pollinterval', 60),
  38. ),
  39. );
  40. return new OC_OCS_Result($result);
  41. }
  42. public static function getUserPublickey($parameters) {
  43. if(OC_User::userExists($parameters['user'])) {
  44. // calculate the disc space
  45. // TODO
  46. return new OC_OCS_Result(array());
  47. } else {
  48. return new OC_OCS_Result(null, 300);
  49. }
  50. }
  51. public static function getUserPrivatekey($parameters) {
  52. $user = OC_User::getUser();
  53. if(OC_User::isAdminUser($user) or ($user==$parameters['user'])) {
  54. if(OC_User::userExists($user)) {
  55. // calculate the disc space
  56. $txt = 'this is the private key of '.$parameters['user'];
  57. echo($txt);
  58. } else {
  59. return new OC_OCS_Result(null, 300, 'User does not exist');
  60. }
  61. } else {
  62. return new OC_OCS_Result('null', 300, 'You don´t have permission to access this ressource.');
  63. }
  64. }
  65. }