Remove provisioning_api apps from core

This commit is contained in:
Tom Needham 2012-09-13 10:28:05 +00:00
parent 227ada3257
commit a0452180b0
7 changed files with 0 additions and 332 deletions

View File

@ -1,27 +0,0 @@
<?php
/**
* ownCloud - Provisioning API
*
* @author Tom Needham
* @copyright 2012 Tom Needham tom@owncloud.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OC::$CLASSPATH['OC_Provisioning_API_Users'] = 'apps/provisioning_api/lib/users.php';
OC::$CLASSPATH['OC_Provisioning_API_Groups'] = 'apps/provisioning_api/lib/groups.php';
OC::$CLASSPATH['OC_Provisioning_API_Apps'] = 'apps/provisioning_api/lib/apps.php';
?>

View File

@ -1,11 +0,0 @@
<?xml version="1.0"?>
<info>
<id>provisioning_api</id>
<name>Provisioning API</name>
<licence>AGPL</licence>
<author>Tom Needham</author>
<require>5</require>
<shipped>true</shipped>
<description>Provides API methods to manage an ownCloud Instance</description>
<default_enable/>
</info>

View File

@ -1,46 +0,0 @@
<?php
/**
* ownCloud - Provisioning API
*
* @author Tom Needham
* @copyright 2012 Tom Needham tom@owncloud.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// users
OCP\API::register('get', '/cloud/users', array('OC_Provisioning_API_Users', 'getUsers'), 'provisioning_api');
OCP\API::register('post', '/cloud/users', array('OC_Provisioning_API_Users', 'addUser'), 'provisioning_api');
OCP\API::register('get', '/cloud/users/{userid}', array('OC_Provisioning_API_Users', 'getUser'), 'provisioning_api');
OCP\API::register('put', '/cloud/users/{userid}', array('OC_Provisioning_API_Users', 'editUser'), 'provisioning_api');
OCP\API::register('delete', '/cloud/users/{userid}', array('OC_Provisioning_API_Users', 'deleteUser'), 'provisioning_api');
OCP\API::register('get', '/cloud/users/{userid}/sharedwith', array('OC_Provisioning_API_Users', 'getSharedWithUser'), 'provisioning_api');
OCP\API::register('get', '/cloud/users/{userid}/sharedby', array('OC_Provisioning_API_Users', 'getSharedByUser'), 'provisioning_api');
OCP\API::register('delete', '/cloud/users/{userid}/sharedby', array('OC_Provisioning_API_Users', 'deleteSharedByUser'), 'provisioning_api');
OCP\API::register('get', '/cloud/users/{userid}/groups', array('OC_Provisioning_API_Users', 'getUsersGroups'), 'provisioning_api');
OCP\API::register('post', '/cloud/users/{userid}/groups', array('OC_Provisioning_API_Users', 'addToGroup'), 'provisioning_api');
OCP\API::register('delete', '/cloud/users/{userid}/groups', array('OC_Provisioning_API_Users', 'removeFromGroup'), 'provisioning_api');
// groups
OCP\API::register('get', '/cloud/groups', array('OC_Provisioning_API_Groups', 'getGroups'), 'provisioning_api');
OCP\API::register('post', '/cloud/groups', array('OC_Provisioning_API_Groups', 'addGroup'), 'provisioning_api');
OCP\API::register('get', '/cloud/groups/{groupid}', array('OC_Provisioning_API_Groups', 'getGroup'), 'provisioning_api');
OCP\API::register('delete', '/cloud/groups/{groupid}', array('OC_Provisioning_API_Groups', 'deleteGroup'), 'provisioning_api');
// apps
OCP\API::register('get', '/cloud/apps', array('OC_Provisioning_API_Apps', 'getApps'), 'provisioning_api');
OCP\API::register('get', '/cloud/apps/{appid}', array('OC_Provisioning_API_Apps', 'getAppInfo'), 'provisioning_api');
OCP\API::register('post', '/cloud/apps/{appid}', array('OC_Provisioning_API_Apps', 'enable'), 'provisioning_api');
OCP\API::register('delete', '/cloud/apps/{appid}', array('OC_Provisioning_API_Apps', 'disable'), 'provisioning_api');
?>

View File

@ -1 +0,0 @@
0.1

View File

@ -1,66 +0,0 @@
<?php
/**
* ownCloud - Provisioning API
*
* @author Tom Needham
* @copyright 2012 Tom Needham tom@owncloud.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
class OC_Provisioning_API_Apps {
public static function getApps($parameters){
$filter = isset($_GET['filter']) ? $_GET['filter'] : false;
if($filter){
switch($filter){
case 'enabled':
return array('apps' => OC_App::getEnabledApps());
break;
case 'disabled':
$apps = OC_App::getAllApps();
$enabled = OC_App::getEnabledApps();
return array('apps' => array_diff($apps, $enabled));
break;
default:
// Invalid filter variable
return 101;
break;
}
} else {
return array('apps' => OC_App::getAllApps());
}
}
public static function getAppInfo($parameters){
$app = $parameters['appid'];
return OC_App::getAppInfo($app);
}
public static function enable($parameters){
$app = $parameters['appid'];
OC_App::enable($app);
return 100;
}
public static function disable($parameters){
$app = $parameters['appid'];
OC_App::disable($app);
return 100;
}
}

View File

@ -1,80 +0,0 @@
<?php
/**
* ownCloud - Provisioning API
*
* @author Tom Needham
* @copyright 2012 Tom Needham tom@owncloud.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
class OC_Provisioning_API_Groups{
/**
* returns a list of groups
*/
public static function getGroups($parameters){
return array('groups' => OC_Group::getGroups());
}
/**
* returns an array of users in the group specified
*/
public static function getGroup($parameters){
// Check the group exists
if(!OC_Group::groupExists($parameters['groupid'])){
return 101;
}
return array('users' => OC_Group::usersInGroup($parameters['groupid']));
}
/**
* creates a new group
*/
public static function addGroup($parameters){
// Validate name
$groupid = isset($_POST['groupid']) ? $_POST['groupid'] : '';
if( preg_match( '/[^a-zA-Z0-9 _\.@\-]/', $groupid ) || empty($groupid)){
return 101;
}
// Check if it exists
if(OC_Group::groupExists($groupid)){
return 102;
}
if(OC_Group::createGroup($groupid)){
return 100;
} else {
return 103;
}
}
public static function deleteGroup($parameters){
// Check it exists
if(!OC_Group::groupExists($parameters['groupid'])){
return 101;
} else if($parameters['groupid'] == 'admin'){
// Cannot delete admin group
return 102;
} else {
if(OC_Group::deleteGroup($parameters['groupid'])){
return 100;
} else {
return 103;
}
}
}
}

View File

@ -1,101 +0,0 @@
<?php
/**
* ownCloud - Provisioning API
*
* @author Tom Needham
* @copyright 2012 Tom Needham tom@owncloud.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
class OC_Provisioning_API_Users {
/**
* returns a list of users
*/
public static function getUsers($parameters){
return OC_User::getUsers();
}
public static function addUser(){
$userid = isset($_POST['userid']) ? $_POST['userid'] : null;
$password = isset($_POST['password']) ? $_POST['password'] : null;
try {
OC_User::createUser($userid, $password);
return 100;
} catch (Exception $e) {
switch($e->getMessage()){
case 'Only the following characters are allowed in a username: "a-z", "A-Z", "0-9", and "_.@-"':
case 'A valid username must be provided':
case 'A valid password must be provided':
return 101;
break;
case 'The username is already being used';
return 102;
break;
default:
return 103;
break;
}
}
}
/**
* gets user info
*/
public static function getUser($parameters){
$userid = $parameters['userid'];
$return = array();
$return['email'] = OC_Preferences::getValue($userid, 'settings', 'email', '');
$default = OC_Appconfig::getValue('files', 'default_quota', 0);
$return['quota'] = OC_Preferences::getValue($userid, 'files', 'quota', $default);
return $return;
}
public static function editUser($parameters){
}
public static function deleteUser($parameters){
}
public static function getSharedWithUser($parameters){
}
public static function getSharedByUser($parameters){
}
public static function deleteSharedByUser($parameters){
}
public static function getUsersGroups($parameters){
$userid = $parameters['userid'];
return array('groups' => OC_Group::getUserGroups($userid));
}
public static function addToGroup($parameters){
}
public static function removeFromGroup($parameters){
}
}