moved to ocs.php from master and added dummy functions for the keyserver

This commit is contained in:
Bjoern Schiessle 2012-07-24 18:22:57 +02:00
parent 2cf64daec4
commit e32b2c8121
1 changed files with 115 additions and 26 deletions

View File

@ -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.');
}
}
}