diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2012-07-24 18:22:57 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2012-07-24 18:22:57 +0200 |
commit | e32b2c8121c4da6df156bdf1ea7f6683e5692aa6 (patch) | |
tree | 389845530bcbe5b8d87f570bcd626805219d02a0 /lib | |
parent | 2cf64daec434e741f26c704bec476e4e795da8dc (diff) | |
download | nextcloud-server-e32b2c8121c4da6df156bdf1ea7f6683e5692aa6.tar.gz nextcloud-server-e32b2c8121c4da6df156bdf1ea7f6683e5692aa6.zip |
moved to ocs.php from master and added dummy functions for the keyserver
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ocs.php | 141 |
1 files changed, 115 insertions, 26 deletions
diff --git a/lib/ocs.php b/lib/ocs.php index 3157aae99e6..218f7a93124 100644 --- a/lib/ocs.php +++ b/lib/ocs.php @@ -650,17 +650,39 @@ class OC_OCS { * @param string $user * @return string xml/json */ - private static function publicKeyGet($format,$user) { - $login=OC_OCS::checkpassword(); - - if(OC_User::userExists($user)){ - // calculate the disc space - $txt='this is the public key of '.$user; - echo($txt); - }else{ - echo self::generateXml('', 'fail', 300, 'User does not exist'); - } - } + private static function publicKeyGet($format, $user) { + $login=OC_OCS::checkpassword(); + if(OC_User::userExists($user)){ + //TODO: GET public key + $xml=array();
+ $xml['key']="this is the public key of $user";
+ $txt=OC_OCS::generatexml($format, 'ok', 100, '', $xml, 'cloud', '', 1, 0, 0);
+ echo($txt); + }else{ + echo self::generateXml('', 'fail', 300, 'User does not exist'); + } + } + + /**
+ * set the public key of a user
+ * @param string $format
+ * @param string $user + * @param string $key
+ * @return string xml/json
+ */
+ private static function publicKeySet($format, $user, $key) {
+ $login=OC_OCS::checkpassword();
+ if($login == $user) {
+ if(OC_User::userExists($user)){
+ //TODO: SET public key
+ echo self::generateXml('', 'ok', 100, 'Public key uploaded');
+ }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.');
+ }
+ } /** * get the private key of a user @@ -668,21 +690,88 @@ class OC_OCS { * @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.'); - } - } + private static function privateKeyGet($format, $user) { + $login=OC_OCS::checkpassword(); + if(OC_Group::inGroup($login, 'admin') or ($login==$user)) { + if(OC_User::userExists($user)){ + //TODO: GET private key + $xml=array();
+ $xml['key']="this is the private key of $user";
+ $txt=OC_OCS::generatexml($format, 'ok', 100, '', $xml, 'cloud', '', 1, 0, 0);
+ 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.'); + } + } + + /**
+ * set the private key of a user
+ * @param string $format
+ * @param string $user + * @param string $key
+ * @return string xml/json
+ */
+ private static function privateKeySet($format, $user, $key) {
+ $login=OC_OCS::checkpassword();
+ if($login == $user) {
+ if(OC_User::userExists($user)){
+ //TODO: SET private key + echo self::generateXml('', 'ok', 100, 'Private key uploaded');
+ }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.');
+ }
+ } + /**
+ * get the encryption key of a file
+ * @param string $format
+ * @param string $user + * @param string $file
+ * @return string xml/json
+ */
+ private static function privateKeyGet($format, $user, $file) {
+ $login=OC_OCS::checkpassword();
+ if(OC_Group::inGroup($login, 'admin') or ($login==$user)) {
+ if(OC_User::userExists($user)){
+ //TODO: GET file key
+ $xml=array();
+ $xml['key']="this is the key for $file";
+ $txt=OC_OCS::generatexml($format, 'ok', 100, '', $xml, 'cloud', '', 1, 0, 0);
+ 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.');
+ }
+ }
+
+ /**
+ * set the encryption keyn of a file
+ * @param string $format
+ * @param string $user + * @param string $file
+ * @param string $key
+ * @return string xml/json
+ */
+ private static function privateKeySet($format, $user, $file, $key) {
+ $login=OC_OCS::checkpassword();
+ if($login == $user) {
+ if(OC_User::userExists($user)){
+ //TODO: SET file key
+ echo self::generateXml('', 'ok', 100, 'File key uploaded');
+ }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.');
+ }
+ } } |