diff --git a/lib/api.php b/lib/api.php index b1176a0707..2203d86ac9 100644 --- a/lib/api.php +++ b/lib/api.php @@ -62,7 +62,7 @@ class OC_API { } } // include core routes - require_once(OC::$SERVERROOT.'core/routes.php'); + require_once(OC::$SERVERROOT.'ocs/routes.php'); $name = $parameters['_name']; $response = array(); diff --git a/lib/ocs/activity.php b/lib/ocs/activity.php new file mode 100644 index 0000000000..3b090376e7 --- /dev/null +++ b/lib/ocs/activity.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/lib/ocs/cloud.php b/lib/ocs/cloud.php new file mode 100644 index 0000000000..d0cd72e98c --- /dev/null +++ b/lib/ocs/cloud.php @@ -0,0 +1,97 @@ +$info['name'],'url'=>OC_Helper::linkToAbsolute($app,''),'icon'=>''); + $values[] = $newvalue; + } + } + return $values; + } + + public static function getQuota($parameters){ + $login=OC_OCS::checkpassword(); + if(OC_Group::inGroup($login, 'admin') or ($login==$parameters['user'])) { + + if(OC_User::userExists($parameters['user'])){ + // calculate the disc space + $user_dir = '/'.$parameters['user'].'/files'; + OC_Filesystem::init($user_dir); + $rootInfo=OC_FileCache::get(''); + $sharedInfo=OC_FileCache::get('/Shared'); + $used=$rootInfo['size']-$sharedInfo['size']; + $free=OC_Filesystem::free_space(); + $total=$free+$used; + if($total==0) $total=1; // prevent division by zero + $relative=round(($used/$total)*10000)/100; + + $xml=array(); + $xml['quota']=$total; + $xml['free']=$free; + $xml['used']=$used; + $xml['relative']=$relative; + + return $xml; + }else{ + return 300; + } + }else{ + return 300; + } + } + + public static function setQuota($parameters){ + $login=OC_OCS::checkpassword(); + if(OC_Group::inGroup($login, 'admin')) { + + // todo + // not yet implemented + // add logic here + error_log('OCS call: user:'.$parameters['user'].' quota:'.$parameters['quota']); + + $xml=array(); + return $xml; + }else{ + return 300; + } + } + + public static function getPublickey($parameters){ + $login=OC_OCS::checkpassword(); + + if(OC_User::userExists($parameters['user'])){ + // calculate the disc space + // TODO + return array(); + }else{ + return 300; + } + } + + public static function getPrivatekey($parameters){ + $login=OC_OCS::checkpassword(); + if(OC_Group::inGroup($login, 'admin') or ($login==$parameters['user'])) { + + if(OC_User::userExists($user)){ + // calculate the disc space + $txt='this is the private key of '.$parameters['user']; + echo($txt); + }else{ + echo self::generateXml('', 'fail', 300, 'User does not exist'); + } + }else{ + echo self::generateXml('', 'fail', 300, 'You donĀ“t have permission to access this ressource.'); + } + } + + +} + +?> \ No newline at end of file diff --git a/lib/ocs/config.php b/lib/ocs/config.php new file mode 100644 index 0000000000..b736abe3b9 --- /dev/null +++ b/lib/ocs/config.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/lib/ocs/person.php b/lib/ocs/person.php new file mode 100644 index 0000000000..f4e4be5ee0 --- /dev/null +++ b/lib/ocs/person.php @@ -0,0 +1,22 @@ +''){ + if(OC_User::login($parameters['login'],$parameters['password'])){ + $xml['person']['personid'] = $parameters['login']; + return $xml; + }else{ + return 102; + } + }else{ + return 101; + } + + } + +} + +?> \ No newline at end of file diff --git a/lib/ocs/privatedata.php b/lib/ocs/privatedata.php new file mode 100644 index 0000000000..cb62d60a8d --- /dev/null +++ b/lib/ocs/privatedata.php @@ -0,0 +1,37 @@ +$log) { + $xml[$i]['key']=$log['key']; + $xml[$i]['app']=$log['app']; + $xml[$i]['value']=$log['value']; + } + return $xml; + //TODO: replace 'privatedata' with 'attribute' once a new libattice has been released that works with it + } + + public static function privatedataSet($parameters){ + $user = OC_OCS::checkpassword(); + if(OC_OCS::setData($user,$app,$key,$value)){ + return 100; + } + } + + public static function privatedataDelete($parameteres){ + $user = OC_OCS::checkpassword(); + if($key=="" or $app==""){ + return; //key and app are NOT optional here + } + if(OC_OCS::deleteData($user,$app,$key)){ + return 100; + } + } + +} + +?> \ No newline at end of file