Exemplo n.º 1
0
 /**
  * get the private key of a user
  * @param string $format
  * @param string $user
  * @return string xml/json
  */
 private static function privateKeyGet($format, $user)
 {
     $login = OC_OCS::checkpassword();
     if (OC_Group::inGroup($login, 'admin') or $login == $user) {
         if (OC_User::userExists($user)) {
             // calculate the disc space
             $txt = 'this is the private key of ' . $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.');
     }
 }
Exemplo n.º 2
0
 /**
  * delete private data referenced by $key and generate the xml for ocs
  * @param string $format
  * @param string $app
  * @param string $key
  * @return string xml/json
  */
 private static function privateDataDelete($format, $app, $key)
 {
     if ($key == "" or $app == "") {
         return;
         //key and app are NOT optional here
     }
     $user = OC_OCS::checkpassword();
     if (OC_OCS::deleteData($user, $app, $key)) {
         echo OC_OCS::generatexml($format, 'ok', 100, '');
     }
 }