From 8161b04c336763297738b348b0695cecd0bc0c78 Mon Sep 17 00:00:00 2001
From: Tom Needham <tom@owncloud.com>
Date: Mon, 30 Jul 2012 15:08:58 +0000
Subject: [PATCH] Add Provisioning_API app and routes

---
 apps/provisioning_api/appinfo/app.php    | 27 +++++++++
 apps/provisioning_api/appinfo/info.xml   | 11 ++++
 apps/provisioning_api/appinfo/routes.php | 46 ++++++++++++++++
 apps/provisioning_api/appinfo/version    |  1 +
 apps/provisioning_api/lib/apps.php       | 42 ++++++++++++++
 apps/provisioning_api/lib/groups.php     | 29 ++++++++++
 apps/provisioning_api/lib/users.php      | 70 ++++++++++++++++++++++++
 7 files changed, 226 insertions(+)
 create mode 100644 apps/provisioning_api/appinfo/app.php
 create mode 100644 apps/provisioning_api/appinfo/info.xml
 create mode 100644 apps/provisioning_api/appinfo/routes.php
 create mode 100644 apps/provisioning_api/appinfo/version
 create mode 100644 apps/provisioning_api/lib/apps.php
 create mode 100644 apps/provisioning_api/lib/groups.php
 create mode 100644 apps/provisioning_api/lib/users.php

diff --git a/apps/provisioning_api/appinfo/app.php b/apps/provisioning_api/appinfo/app.php
new file mode 100644
index 0000000000..992ee23b5c
--- /dev/null
+++ b/apps/provisioning_api/appinfo/app.php
@@ -0,0 +1,27 @@
+<?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';
+?>
\ No newline at end of file
diff --git a/apps/provisioning_api/appinfo/info.xml b/apps/provisioning_api/appinfo/info.xml
new file mode 100644
index 0000000000..eb96115507
--- /dev/null
+++ b/apps/provisioning_api/appinfo/info.xml
@@ -0,0 +1,11 @@
+<?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>
diff --git a/apps/provisioning_api/appinfo/routes.php b/apps/provisioning_api/appinfo/routes.php
new file mode 100644
index 0000000000..dcfaf7b78b
--- /dev/null
+++ b/apps/provisioning_api/appinfo/routes.php
@@ -0,0 +1,46 @@
+<?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', '/users', array('OC_Provisioning_API_Users', 'getUsers'), 'provisioning_api');
+OCP\API::register('post', '/users', array('OC_Provisioning_API_Users', 'addUser'), 'provisioning_api');
+OCP\API::register('get', '/users/{userid}', array('OC_Provisioning_API_Users', 'getUser'), 'provisioning_api');
+OCP\API::register('put', '/users/{userid}', array('OC_Provisioning_API_Users', 'editUser'), 'provisioning_api');
+OCP\API::register('delete', '/users/{userid}', array('OC_Provisioning_API_Users', 'getUsers'), 'provisioning_api');
+OCP\API::register('get', '/users/{userid}/sharedwith', array('OC_Provisioning_API_Users', 'getSharedWithUser'), 'provisioning_api');
+OCP\API::register('get', '/users/{userid}/sharedby', array('OC_Provisioning_API_Users', 'getSharedByUser'), 'provisioning_api');
+OCP\API::register('delete', '/users/{userid}/sharedby', array('OC_Provisioning_API_Users', 'deleteSharedByUser'), 'provisioning_api');
+OCP\API::register('get', '/users/{userid}/groups', array('OC_Provisioning_API_Users', 'getUsersGroups'), 'provisioning_api');
+OCP\API::register('post', '/users/{userid}/groups', array('OC_Provisioning_API_Users', 'addToGroup'), 'provisioning_api');
+OCP\API::register('delete', '/users/{userid}/groups', array('OC_Provisioning_API_Users', 'removeFromGroup'), 'provisioning_api');
+// groups
+OCP\API::register('get', '/groups', array('OC_Provisioning_API_Groups', 'getGroups'), 'provisioning_api');
+OCP\API::register('post', '/groups', array('OC_Provisioning_API_Groups', 'addGroup'), 'provisioning_api');
+OCP\API::register('get', '/groups/{groupid}', array('OC_Provisioning_API_Groups', 'getGroup'), 'provisioning_api');
+OCP\API::register('delete', '/groups/{groupid}', array('OC_Provisioning_API_Groups', 'deleteGroup'), 'provisioning_api');
+// apps
+OCP\API::register('get', '/apps', array('OC_Provisioning_API_Apps', 'getApps'), 'provisioning_api');
+OCP\API::register('get', '/apps/{appid}', array('OC_Provisioning_API_Apps', 'getApp'), 'provisioning_api');
+OCP\API::register('post', '/apps/{appid}', array('OC_Provisioning_API_Apps', 'enable'), 'provisioning_api');
+OCP\API::register('delete', '/apps/{appid}', array('OC_Provisioning_API_Apps', 'disable'), 'provisioning_api');
+?>
\ No newline at end of file
diff --git a/apps/provisioning_api/appinfo/version b/apps/provisioning_api/appinfo/version
new file mode 100644
index 0000000000..49d59571fb
--- /dev/null
+++ b/apps/provisioning_api/appinfo/version
@@ -0,0 +1 @@
+0.1
diff --git a/apps/provisioning_api/lib/apps.php b/apps/provisioning_api/lib/apps.php
new file mode 100644
index 0000000000..fcb1e5ba8f
--- /dev/null
+++ b/apps/provisioning_api/lib/apps.php
@@ -0,0 +1,42 @@
+<?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){
+		
+	}
+	
+	public static function getAppInfo($parameters){
+		
+	}
+	
+	public static function enable($parameters){
+		
+	}
+	
+	public static function diable($parameters){
+		
+	}
+	
+}
\ No newline at end of file
diff --git a/apps/provisioning_api/lib/groups.php b/apps/provisioning_api/lib/groups.php
new file mode 100644
index 0000000000..7e27eeafb0
--- /dev/null
+++ b/apps/provisioning_api/lib/groups.php
@@ -0,0 +1,29 @@
+<?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{
+	
+	public static function getGroups($parameters){
+		
+	}
+}
\ No newline at end of file
diff --git a/apps/provisioning_api/lib/users.php b/apps/provisioning_api/lib/users.php
new file mode 100644
index 0000000000..77f84f4bb1
--- /dev/null
+++ b/apps/provisioning_api/lib/users.php
@@ -0,0 +1,70 @@
+<?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 {
+	
+	public static function getUsers($parameters){
+		
+	}
+	
+	public static function addUser($parameters){
+		
+	}
+	
+	public static function getUser($parameters){
+		
+	}
+	
+	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){
+		
+	}
+	
+	public static function addToGroup($parameters){
+		
+	}
+	
+	public static function removeFromGroup($parameters){
+		
+	}
+	
+}
\ No newline at end of file
-- 
GitLab