Fix usage of deprecated private constants

This commit is contained in:
Joas Schilling 2015-04-18 10:30:02 +02:00
parent 6ce1abfa5c
commit 3f3f8c2f99
14 changed files with 76 additions and 71 deletions

View file

@ -85,4 +85,4 @@ $this->create('download', 'download{file}')
->actionInclude('files/download.php');
// Register with the capabilities API
\OC_API::register('get', '/cloud/capabilities', array('OCA\Files\Capabilities', 'getCapabilities'), 'files', \OC_API::USER_AUTH);
\OCP\API::register('get', '/cloud/capabilities', array('OCA\Files\Capabilities', 'getCapabilities'), 'files', \OCP\API::USER_AUTH);

View file

@ -61,7 +61,7 @@ $this->create('files_external_google', 'ajax/google.php')
$this->create('files_external_list_applicable', '/applicable')
->actionInclude('files_external/ajax/applicable.php');
\OC_API::register('get',
\OCP\API::register('get',
'/apps/files_external/api/v1/mounts',
array('\OCA\Files\External\Api', 'getUserMounts'),
'files_external');

View file

@ -26,6 +26,7 @@
namespace OCA\Files_Sharing\AppInfo;
use OCA\Files_Sharing\Application;
use OCP\API;
$application = new Application();
$application->registerRoutes($this, [
@ -55,33 +56,33 @@ $this->create('sharing_external_test_remote', '/testremote')
//TODO: SET: mail notification, waiting for PR #4689 to be accepted
\OC_API::register('get',
API::register('get',
'/apps/files_sharing/api/v1/shares',
array('\OCA\Files_Sharing\API\Local', 'getAllShares'),
'files_sharing');
\OC_API::register('post',
API::register('post',
'/apps/files_sharing/api/v1/shares',
array('\OCA\Files_Sharing\API\Local', 'createShare'),
'files_sharing');
\OC_API::register('get',
API::register('get',
'/apps/files_sharing/api/v1/shares/{id}',
array('\OCA\Files_Sharing\API\Local', 'getShare'),
'files_sharing');
\OC_API::register('put',
API::register('put',
'/apps/files_sharing/api/v1/shares/{id}',
array('\OCA\Files_Sharing\API\Local', 'updateShare'),
'files_sharing');
\OC_API::register('delete',
API::register('delete',
'/apps/files_sharing/api/v1/shares/{id}',
array('\OCA\Files_Sharing\API\Local', 'deleteShare'),
'files_sharing');
// Register with the capabilities API
\OC_API::register('get',
API::register('get',
'/cloud/capabilities',
array('OCA\Files_Sharing\Capabilities', 'getCapabilities'),
'files_sharing', \OC_API::USER_AUTH);
'files_sharing', API::USER_AUTH);

View file

@ -34,4 +34,4 @@ $this->create('files_trashbin_ajax_undelete', 'ajax/undelete.php')
// Register with the capabilities API
\OC_API::register('get', '/cloud/capabilities', array('OCA\Files_Trashbin\Capabilities', 'getCapabilities'), 'files_trashbin', \OC_API::USER_AUTH);
\OCP\API::register('get', '/cloud/capabilities', array('OCA\Files_Trashbin\Capabilities', 'getCapabilities'), 'files_trashbin', \OCP\API::USER_AUTH);

View file

@ -38,4 +38,4 @@ $this->create('files_versions_ajax_rollbackVersion', 'ajax/rollbackVersion.php')
->actionInclude('files_versions/ajax/rollbackVersion.php');
// Register with the capabilities API
OC_API::register('get', '/cloud/capabilities', array('OCA\Files_Versions\Capabilities', 'getCapabilities'), 'files_versions', OC_API::USER_AUTH);
\OCP\API::register('get', '/cloud/capabilities', array('OCA\Files_Versions\Capabilities', 'getCapabilities'), 'files_versions', \OCP\API::USER_AUTH);

View file

@ -21,27 +21,29 @@
*/
// Users
OCP\API::register('get', '/cloud/users', array('OCA\Provisioning_API\Users', 'getUsers'), 'provisioning_api', OC_API::ADMIN_AUTH);
OCP\API::register('post', '/cloud/users', array('OCA\Provisioning_API\Users', 'addUser'), 'provisioning_api', OC_API::ADMIN_AUTH);
OCP\API::register('get', '/cloud/users/{userid}', array('OCA\Provisioning_API\Users', 'getUser'), 'provisioning_api', OC_API::USER_AUTH);
OCP\API::register('put', '/cloud/users/{userid}', array('OCA\Provisioning_API\Users', 'editUser'), 'provisioning_api', OC_API::USER_AUTH);
OCP\API::register('delete', '/cloud/users/{userid}', array('OCA\Provisioning_API\Users', 'deleteUser'), 'provisioning_api', OC_API::SUBADMIN_AUTH);
OCP\API::register('get', '/cloud/users/{userid}/groups', array('OCA\Provisioning_API\Users', 'getUsersGroups'), 'provisioning_api', OC_API::USER_AUTH);
OCP\API::register('post', '/cloud/users/{userid}/groups', array('OCA\Provisioning_API\Users', 'addToGroup'), 'provisioning_api', OC_API::SUBADMIN_AUTH);
OCP\API::register('delete', '/cloud/users/{userid}/groups', array('OCA\Provisioning_API\Users', 'removeFromGroup'), 'provisioning_api', OC_API::SUBADMIN_AUTH);
OCP\API::register('post', '/cloud/users/{userid}/subadmins', array('OCA\Provisioning_API\Users', 'addSubAdmin'), 'provisioning_api', OC_API::ADMIN_AUTH);
OCP\API::register('delete', '/cloud/users/{userid}/subadmins', array('OCA\Provisioning_API\Users', 'removeSubAdmin'), 'provisioning_api', OC_API::ADMIN_AUTH);
OCP\API::register('get', '/cloud/users/{userid}/subadmins', array('OCA\Provisioning_API\Users', 'getUserSubAdminGroups'), 'provisioning_api', OC_API::ADMIN_AUTH);
use OCP\API;
API::register('get', '/cloud/users', array('OCA\Provisioning_API\Users', 'getUsers'), 'provisioning_api', API::ADMIN_AUTH);
API::register('post', '/cloud/users', array('OCA\Provisioning_API\Users', 'addUser'), 'provisioning_api', API::ADMIN_AUTH);
API::register('get', '/cloud/users/{userid}', array('OCA\Provisioning_API\Users', 'getUser'), 'provisioning_api', API::USER_AUTH);
API::register('put', '/cloud/users/{userid}', array('OCA\Provisioning_API\Users', 'editUser'), 'provisioning_api', API::USER_AUTH);
API::register('delete', '/cloud/users/{userid}', array('OCA\Provisioning_API\Users', 'deleteUser'), 'provisioning_api', API::SUBADMIN_AUTH);
API::register('get', '/cloud/users/{userid}/groups', array('OCA\Provisioning_API\Users', 'getUsersGroups'), 'provisioning_api', API::USER_AUTH);
API::register('post', '/cloud/users/{userid}/groups', array('OCA\Provisioning_API\Users', 'addToGroup'), 'provisioning_api', API::SUBADMIN_AUTH);
API::register('delete', '/cloud/users/{userid}/groups', array('OCA\Provisioning_API\Users', 'removeFromGroup'), 'provisioning_api', API::SUBADMIN_AUTH);
API::register('post', '/cloud/users/{userid}/subadmins', array('OCA\Provisioning_API\Users', 'addSubAdmin'), 'provisioning_api', API::ADMIN_AUTH);
API::register('delete', '/cloud/users/{userid}/subadmins', array('OCA\Provisioning_API\Users', 'removeSubAdmin'), 'provisioning_api', API::ADMIN_AUTH);
API::register('get', '/cloud/users/{userid}/subadmins', array('OCA\Provisioning_API\Users', 'getUserSubAdminGroups'), 'provisioning_api', API::ADMIN_AUTH);
// Groups
OCP\API::register('get', '/cloud/groups', array('OCA\Provisioning_API\Groups', 'getGroups'), 'provisioning_api', OC_API::SUBADMIN_AUTH);
OCP\API::register('post', '/cloud/groups', array('OCA\Provisioning_API\Groups', 'addGroup'), 'provisioning_api', OC_API::SUBADMIN_AUTH);
OCP\API::register('get', '/cloud/groups/{groupid}', array('OCA\Provisioning_API\Groups', 'getGroup'), 'provisioning_api', OC_API::SUBADMIN_AUTH);
OCP\API::register('delete', '/cloud/groups/{groupid}', array('OCA\Provisioning_API\Groups', 'deleteGroup'), 'provisioning_api', OC_API::ADMIN_AUTH);
OCP\API::register('get', '/cloud/groups/{groupid}/subadmins', array('OCA\Provisioning_API\Groups', 'getSubAdminsOfGroup'), 'provisioning_api', OC_API::ADMIN_AUTH);
API::register('get', '/cloud/groups', array('OCA\Provisioning_API\Groups', 'getGroups'), 'provisioning_api', API::SUBADMIN_AUTH);
API::register('post', '/cloud/groups', array('OCA\Provisioning_API\Groups', 'addGroup'), 'provisioning_api', API::SUBADMIN_AUTH);
API::register('get', '/cloud/groups/{groupid}', array('OCA\Provisioning_API\Groups', 'getGroup'), 'provisioning_api', API::SUBADMIN_AUTH);
API::register('delete', '/cloud/groups/{groupid}', array('OCA\Provisioning_API\Groups', 'deleteGroup'), 'provisioning_api', API::ADMIN_AUTH);
API::register('get', '/cloud/groups/{groupid}/subadmins', array('OCA\Provisioning_API\Groups', 'getSubAdminsOfGroup'), 'provisioning_api', API::ADMIN_AUTH);
// Apps
OCP\API::register('get', '/cloud/apps', array('OCA\Provisioning_API\Apps', 'getApps'), 'provisioning_api', OC_API::ADMIN_AUTH);
OCP\API::register('get', '/cloud/apps/{appid}', array('OCA\Provisioning_API\Apps', 'getAppInfo'), 'provisioning_api', OC_API::ADMIN_AUTH);
OCP\API::register('post', '/cloud/apps/{appid}', array('OCA\Provisioning_API\Apps', 'enable'), 'provisioning_api', OC_API::ADMIN_AUTH);
OCP\API::register('delete', '/cloud/apps/{appid}', array('OCA\Provisioning_API\Apps', 'disable'), 'provisioning_api', OC_API::ADMIN_AUTH);
API::register('get', '/cloud/apps', array('OCA\Provisioning_API\Apps', 'getApps'), 'provisioning_api', API::ADMIN_AUTH);
API::register('get', '/cloud/apps/{appid}', array('OCA\Provisioning_API\Apps', 'getAppInfo'), 'provisioning_api', API::ADMIN_AUTH);
API::register('post', '/cloud/apps/{appid}', array('OCA\Provisioning_API\Apps', 'enable'), 'provisioning_api', API::ADMIN_AUTH);
API::register('delete', '/cloud/apps/{appid}', array('OCA\Provisioning_API\Apps', 'disable'), 'provisioning_api', API::ADMIN_AUTH);

View file

@ -60,7 +60,7 @@ class Apps {
if(!is_null($info)) {
return new OC_OCS_Result(OC_App::getAppInfo($app));
} else {
return new OC_OCS_Result(null, \OC_API::RESPOND_NOT_FOUND, 'The request app was not found');
return new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, 'The request app was not found');
}
}

View file

@ -44,14 +44,14 @@ class Groups{
public static function getGroup($parameters){
// Check the group exists
if(!OC_Group::groupExists($parameters['groupid'])){
return new OC_OCS_Result(null, \OC_API::RESPOND_NOT_FOUND, 'The requested group could not be found');
return new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, 'The requested group could not be found');
}
// Check subadmin has access to this group
if(\OC_User::isAdminUser(\OC_User::getUser())
|| in_array($parameters['groupid'], \OC_SubAdmin::getSubAdminsGroups(\OC_User::getUser()))){
return new OC_OCS_Result(array('users' => OC_Group::usersInGroup($parameters['groupid'])));
} else {
return new OC_OCS_Result(null, \OC_API::RESPOND_UNAUTHORISED, 'User does not have access to specified group');
return new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'User does not have access to specified group');
}
}

View file

@ -67,7 +67,7 @@ class Users {
if(OC_User::isAdminUser(OC_User::getUser()) || OC_SubAdmin::isUserAccessible(OC_User::getUser(), $userId)) {
// Check they exist
if(!OC_User::userExists($userId)) {
return new OC_OCS_Result(null, \OC_API::RESPOND_NOT_FOUND, 'The requested user could not be found');
return new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, 'The requested user could not be found');
}
// Show all
$return = array(
@ -80,7 +80,7 @@ class Users {
} else {
// Check they are looking up themselves
if(OC_User::getUser() != $userId) {
return new OC_OCS_Result(null, \OC_API::RESPOND_UNAUTHORISED);
return new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
}
// Return some additional information compared to the core route
$return = array(
@ -226,7 +226,7 @@ class Users {
// Check they're an admin
if(!OC_Group::inGroup(OC_User::getUser(), 'admin')){
// This user doesn't have rights to add a user to this group
return new OC_OCS_Result(null, \OC_API::RESPOND_UNAUTHORISED);
return new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
}
// Check if the group exists
if(!OC_Group::groupExists($group)){

View file

@ -36,7 +36,7 @@ class AppsTest extends TestCase {
$result = \OCA\provisioning_API\Apps::getAppInfo(array('appid' => 'not_provisioning_api'));
$this->assertInstanceOf('OC_OCS_Result', $result);
$this->assertFalse($result->succeeded());
$this->assertEquals(\OC_API::RESPOND_NOT_FOUND, $result->getStatusCode());
$this->assertEquals(\OCP\API::RESPOND_NOT_FOUND, $result->getStatusCode());
}

View file

@ -39,7 +39,7 @@ class GroupsTest extends TestCase {
$this->assertInstanceOf('OC_OCS_Result', $result);
$this->assertFalse($result->succeeded());
$this->assertEquals(\OC_API::RESPOND_UNAUTHORISED, $result->getStatusCode());
$this->assertEquals(\OCP\API::RESPOND_UNAUTHORISED, $result->getStatusCode());
}
@ -92,7 +92,7 @@ class GroupsTest extends TestCase {
$this->assertInstanceOf('OC_OCS_Result', $result);
$this->assertFalse($result->succeeded());
$this->assertEquals(\OC_API::RESPOND_UNAUTHORISED, $result->getStatusCode());
$this->assertEquals(\OCP\API::RESPOND_UNAUTHORISED, $result->getStatusCode());
}

View file

@ -101,7 +101,7 @@ class UsersTest extends TestCase {
$result = \OCA\provisioning_API\Users::getUser($params);
$this->assertInstanceOf('OC_OCS_Result', $result);
$this->assertFalse($result->succeeded());
$this->assertEquals(\OC_API::RESPOND_NOT_FOUND, $result->getStatusCode());
$this->assertEquals(\OCP\API::RESPOND_NOT_FOUND, $result->getStatusCode());
}

View file

@ -188,7 +188,7 @@ class OC_API {
// Which shipped response do we use if they all failed?
// They may have failed for different reasons (different status codes)
// Which response code should we return?
// Maybe any that are not OC_API::RESPOND_SERVER_ERROR
// Maybe any that are not \OCP\API::RESPOND_SERVER_ERROR
// Merge failed responses if more than one
$data = array();
foreach($shipped['failed'] as $failure) {
@ -400,7 +400,7 @@ class OC_API {
* Based on the requested format the response content type is set
*/
public static function setContentType() {
$format = \OC_API::requestedFormat();
$format = self::requestedFormat();
if ($format === 'xml') {
header('Content-type: text/xml; charset=UTF-8');
return;

View file

@ -23,109 +23,111 @@
*
*/
use OCP\API;
// Config
OC_API::register(
API::register(
'get',
'/config',
array('OC_OCS_Config', 'apiConfig'),
'core',
OC_API::GUEST_AUTH
API::GUEST_AUTH
);
// Person
OC_API::register(
API::register(
'post',
'/person/check',
array('OC_OCS_Person', 'check'),
'core',
OC_API::GUEST_AUTH
API::GUEST_AUTH
);
// Privatedata
OC_API::register(
API::register(
'get',
'/privatedata/getattribute',
array('OC_OCS_Privatedata', 'get'),
'core',
OC_API::USER_AUTH,
API::USER_AUTH,
array('app' => '', 'key' => '')
);
OC_API::register(
API::register(
'get',
'/privatedata/getattribute/{app}',
array('OC_OCS_Privatedata', 'get'),
'core',
OC_API::USER_AUTH,
API::USER_AUTH,
array('key' => '')
);
OC_API::register(
API::register(
'get',
'/privatedata/getattribute/{app}/{key}',
array('OC_OCS_Privatedata', 'get'),
'core',
OC_API::USER_AUTH
API::USER_AUTH
);
OC_API::register(
API::register(
'post',
'/privatedata/setattribute/{app}/{key}',
array('OC_OCS_Privatedata', 'set'),
'core',
OC_API::USER_AUTH
API::USER_AUTH
);
OC_API::register(
API::register(
'post',
'/privatedata/deleteattribute/{app}/{key}',
array('OC_OCS_Privatedata', 'delete'),
'core',
OC_API::USER_AUTH
API::USER_AUTH
);
// cloud
OC_API::register(
API::register(
'get',
'/cloud/capabilities',
array('OC_OCS_Cloud', 'getCapabilities'),
'core',
OC_API::USER_AUTH
API::USER_AUTH
);
OC_API::register(
API::register(
'get',
'/cloud/users/{userid}',
array('OC_OCS_Cloud', 'getUser'),
'core',
OC_API::USER_AUTH
API::USER_AUTH
);
OC_API::register(
API::register(
'get',
'/cloud/user',
array('OC_OCS_Cloud', 'getCurrentUser'),
'core',
OC_API::USER_AUTH
API::USER_AUTH
);
// Server-to-Server Sharing
$s2s = new \OCA\Files_Sharing\API\Server2Server();
OC_API::register('post',
API::register('post',
'/cloud/shares',
array($s2s, 'createShare'),
'files_sharing',
OC_API::GUEST_AUTH
API::GUEST_AUTH
);
OC_API::register('post',
API::register('post',
'/cloud/shares/{id}/accept',
array($s2s, 'acceptShare'),
'files_sharing',
OC_API::GUEST_AUTH
API::GUEST_AUTH
);
OC_API::register('post',
API::register('post',
'/cloud/shares/{id}/decline',
array($s2s, 'declineShare'),
'files_sharing',
OC_API::GUEST_AUTH
API::GUEST_AUTH
);
OC_API::register('post',
API::register('post',
'/cloud/shares/{id}/unshare',
array($s2s, 'unshare'),
'files_sharing',
OC_API::GUEST_AUTH
API::GUEST_AUTH
);