diff options
author | Morris Jobke <hey@morrisjobke.de> | 2014-11-26 08:31:23 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2014-11-26 08:31:23 +0100 |
commit | c5fa8f1bdc08b07d03fcc9f9c84033960ec4e20f (patch) | |
tree | b2e989a445cf6afce925dea68765dc779dbc772a /apps | |
parent | 3766d98df6845397d810d583575c1fcedb51df90 (diff) | |
parent | 2c39aec8cb8ce7f74c8edd1111e7f7b6a70cf7c5 (diff) | |
download | nextcloud-server-c5fa8f1bdc08b07d03fcc9f9c84033960ec4e20f.tar.gz nextcloud-server-c5fa8f1bdc08b07d03fcc9f9c84033960ec4e20f.zip |
Merge pull request #12421 from owncloud/issue/6101-remove-namespace-permission-constants
Issue/6101 remove namespace permission constants
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/ajax/upload.php | 6 | ||||
-rw-r--r-- | apps/files_encryption/tests/hooks.php | 2 | ||||
-rwxr-xr-x | apps/files_encryption/tests/share.php | 22 | ||||
-rw-r--r-- | apps/files_external/lib/api.php | 4 | ||||
-rw-r--r-- | apps/files_sharing/ajax/list.php | 4 | ||||
-rw-r--r-- | apps/files_sharing/ajax/shareinfo.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/controllers/sharecontroller.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/readonlycache.php | 4 | ||||
-rw-r--r-- | apps/files_sharing/lib/readonlywrapper.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 14 | ||||
-rw-r--r-- | apps/files_sharing/publicwebdav.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/tests/api.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/tests/cache.php | 4 | ||||
-rw-r--r-- | apps/files_sharing/tests/share.php | 28 | ||||
-rw-r--r-- | apps/files_trashbin/lib/helper.php | 2 | ||||
-rw-r--r-- | apps/files_versions/tests/versions.php | 4 |
16 files changed, 54 insertions, 54 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index aeb0008a7b9..eb99d0644f7 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -9,7 +9,7 @@ OCP\JSON::setContentTypeHeader('text/plain'); // If not, check the login. // If no token is sent along, rely on login only -$allowedPermissions = OCP\PERMISSION_ALL; +$allowedPermissions = \OCP\Constants::PERMISSION_ALL; $errorCode = null; $l = \OC::$server->getL10N('files'); @@ -29,7 +29,7 @@ if (empty($_POST['dirToken'])) { \OC_User::setIncognitoMode(true); // return only read permissions for public upload - $allowedPermissions = OCP\PERMISSION_READ; + $allowedPermissions = \OCP\Constants::PERMISSION_READ; $publicDirectory = !empty($_POST['subdir']) ? $_POST['subdir'] : '/'; $linkItem = OCP\Share::getShareByToken($_POST['dirToken']); @@ -38,7 +38,7 @@ if (empty($_POST['dirToken'])) { die(); } - if (!($linkItem['permissions'] & OCP\PERMISSION_CREATE)) { + if (!($linkItem['permissions'] & \OCP\Constants::PERMISSION_CREATE)) { OCP\JSON::checkLoggedIn(); } else { // resolve reshares diff --git a/apps/files_encryption/tests/hooks.php b/apps/files_encryption/tests/hooks.php index 9ea84cc94c2..4b8be0c7c1c 100644 --- a/apps/files_encryption/tests/hooks.php +++ b/apps/files_encryption/tests/hooks.php @@ -256,7 +256,7 @@ class Test_Encryption_Hooks extends \OCA\Files_Encryption\Tests\TestCase { $this->assertTrue($fileInfo instanceof \OC\Files\FileInfo); // share the file with user2 - \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_ENCRYPTION_HOOKS_USER2, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_ENCRYPTION_HOOKS_USER2, \OCP\Constants::PERMISSION_ALL); // check if new share key exists $this->assertTrue($this->rootView->file_exists( diff --git a/apps/files_encryption/tests/share.php b/apps/files_encryption/tests/share.php index 20ee2cc7064..24b828433d0 100755 --- a/apps/files_encryption/tests/share.php +++ b/apps/files_encryption/tests/share.php @@ -171,7 +171,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase { \OC_FileProxy::$enabled = $proxyStatus; // share the file - \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, \OCP\Constants::PERMISSION_ALL); // login as admin self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1); @@ -232,7 +232,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase { '/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2 . '/files/' . $this->filename); // share the file with user3 - \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, \OCP\Constants::PERMISSION_ALL); // login as admin self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1); @@ -328,7 +328,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase { \OC_FileProxy::$enabled = $proxyStatus; // share the folder with user1 - \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, \OCP\Constants::PERMISSION_ALL); // login as admin self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1); @@ -406,7 +406,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase { \OC_FileProxy::$enabled = $proxyStatus; // share the file with user3 - \OCP\Share::shareItem('folder', $fileInfoSubFolder['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('folder', $fileInfoSubFolder['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER3, \OCP\Constants::PERMISSION_ALL); // login as admin self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1); @@ -437,7 +437,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase { $this->assertTrue($fileInfo instanceof \OC\Files\FileInfo); // share the file with user3 - \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, \OCP\Constants::PERMISSION_ALL); // login as admin self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1); @@ -539,7 +539,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase { \OC_FileProxy::$enabled = $proxyStatus; // share the file - \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_LINK, false, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_LINK, false, \OCP\Constants::PERMISSION_ALL); // login as admin self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1); @@ -617,7 +617,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase { \OC_FileProxy::$enabled = $proxyStatus; // share the file - \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1, \OCP\Constants::PERMISSION_ALL); // login as admin self::loginHelper(\Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1); @@ -923,7 +923,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase { // share the file try { - \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_GROUP1, \OCP\Constants::PERMISSION_ALL); } catch (Exception $e) { $this->assertEquals(0, strpos($e->getMessage(), "Following users are not set up for encryption")); } @@ -991,7 +991,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase { $this->assertTrue($fileInfo instanceof \OC\Files\FileInfo); // share the file - \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, \OCP\Constants::PERMISSION_ALL); // check if share key for user2 exists $this->assertTrue($this->view->file_exists( @@ -1059,7 +1059,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase { $this->assertTrue($fileInfo instanceof \OC\Files\FileInfo); // share the folder - \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, \OCP\Constants::PERMISSION_ALL); \OC\Files\Filesystem::rename($folder, $newFolder); @@ -1117,7 +1117,7 @@ class Test_Encryption_Share extends \OCA\Files_Encryption\Tests\TestCase { $this->assertTrue($fileInfo instanceof \OC\Files\FileInfo); // share the folder - \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER2, \OCP\Constants::PERMISSION_ALL); // check that the share keys exist $this->assertTrue($view->file_exists('files_encryption/share-keys' . $folder . '/' . $filename . '.' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1 . '.shareKey')); diff --git a/apps/files_external/lib/api.php b/apps/files_external/lib/api.php index 81ebd4e886a..3b5e0e1759a 100644 --- a/apps/files_external/lib/api.php +++ b/apps/files_external/lib/api.php @@ -45,10 +45,10 @@ class Api { $isSystemMount = !$mountConfig['personal']; - $permissions = \OCP\PERMISSION_READ; + $permissions = \OCP\Constants::PERMISSION_READ; // personal mounts can be deleted if (!$isSystemMount) { - $permissions |= \OCP\PERMISSION_DELETE; + $permissions |= \OCP\Constants::PERMISSION_DELETE; } $entry = array( diff --git a/apps/files_sharing/ajax/list.php b/apps/files_sharing/ajax/list.php index 7e2e54a1bd9..073c86365be 100644 --- a/apps/files_sharing/ajax/list.php +++ b/apps/files_sharing/ajax/list.php @@ -65,7 +65,7 @@ $formattedFiles = array(); foreach ($files as $file) { $entry = \OCA\Files\Helper::formatFileInfo($file); unset($entry['directory']); // for now - $entry['permissions'] = \OCP\PERMISSION_READ; + $entry['permissions'] = \OCP\Constants::PERMISSION_READ; $formattedFiles[] = $entry; } @@ -78,7 +78,7 @@ $permissions = $linkItem['permissions']; // if globally disabled if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_public_upload', 'yes') === 'no') { // only allow reading - $permissions = \OCP\PERMISSION_READ; + $permissions = \OCP\Constants::PERMISSION_READ; } $data['permissions'] = $permissions; diff --git a/apps/files_sharing/ajax/shareinfo.php b/apps/files_sharing/ajax/shareinfo.php index e87b0779e8d..f196a67a9dd 100644 --- a/apps/files_sharing/ajax/shareinfo.php +++ b/apps/files_sharing/ajax/shareinfo.php @@ -31,7 +31,7 @@ $linkItem = $data['linkItem']; // Load the files $path = $data['realPath']; -$isWritable = $linkItem['permissions'] & (\OCP\PERMISSION_UPDATE | \OCP\PERMISSION_CREATE); +$isWritable = $linkItem['permissions'] & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE); if (!$isWritable) { \OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, $storage) { return new \OCA\Files_Sharing\ReadOnlyWrapper(array('storage' => $storage)); diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php index 7518292131c..0a0594ed8ff 100644 --- a/apps/files_sharing/lib/controllers/sharecontroller.php +++ b/apps/files_sharing/lib/controllers/sharecontroller.php @@ -182,7 +182,7 @@ class ShareController extends Controller { $folder = new Template('files', 'list', ''); $folder->assign('dir', $getPath); $folder->assign('dirToken', $linkItem['token']); - $folder->assign('permissions', OCP\PERMISSION_READ); + $folder->assign('permissions', \OCP\Constants::PERMISSION_READ); $folder->assign('isPublic', true); $folder->assign('publicUploadEnabled', 'no'); $folder->assign('files', $files); diff --git a/apps/files_sharing/lib/readonlycache.php b/apps/files_sharing/lib/readonlycache.php index f129ca49433..6dd3b9cf61d 100644 --- a/apps/files_sharing/lib/readonlycache.php +++ b/apps/files_sharing/lib/readonlycache.php @@ -13,14 +13,14 @@ use OC\Files\Cache\Cache; class ReadOnlyCache extends Cache { public function get($path) { $data = parent::get($path); - $data['permissions'] &= (\OCP\PERMISSION_READ | \OCP\PERMISSION_SHARE); + $data['permissions'] &= (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE); return $data; } public function getFolderContents($path) { $content = parent::getFolderContents($path); foreach ($content as &$data) { - $data['permissions'] &= (\OCP\PERMISSION_READ | \OCP\PERMISSION_SHARE); + $data['permissions'] &= (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE); } return $content; } diff --git a/apps/files_sharing/lib/readonlywrapper.php b/apps/files_sharing/lib/readonlywrapper.php index 45ed3fd68bb..58a5695aff8 100644 --- a/apps/files_sharing/lib/readonlywrapper.php +++ b/apps/files_sharing/lib/readonlywrapper.php @@ -24,7 +24,7 @@ class ReadOnlyWrapper extends Wrapper { } public function getPermissions($path) { - return $this->storage->getPermissions($path) & (\OCP\PERMISSION_READ | \OCP\PERMISSION_SHARE); + return $this->storage->getPermissions($path) & (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE); } public function rename($path1, $path2) { diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 19ee6085e47..1ac57053e25 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -67,7 +67,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { if ($source) { $source['path'] .= '.part'; // All partial files have delete permission - $source['permissions'] |= \OCP\PERMISSION_DELETE; + $source['permissions'] |= \OCP\Constants::PERMISSION_DELETE; } } else { $source = \OC_Share_Backend_File::getSource($target, $this->getMountPoint(), $this->getItemType()); @@ -109,11 +109,11 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { $permissions = $this->share['permissions']; // part files and the mount point always have delete permissions if ($target === '' || pathinfo($target, PATHINFO_EXTENSION) === 'part') { - $permissions |= \OCP\PERMISSION_DELETE; + $permissions |= \OCP\Constants::PERMISSION_DELETE; } if (\OC_Util::isSharingDisabledForUser()) { - $permissions &= ~\OCP\PERMISSION_SHARE; + $permissions &= ~\OCP\Constants::PERMISSION_SHARE; } return $permissions; @@ -197,7 +197,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { } public function isCreatable($path) { - return ($this->getPermissions($path) & \OCP\PERMISSION_CREATE); + return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_CREATE); } public function isReadable($path) { @@ -205,18 +205,18 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { } public function isUpdatable($path) { - return ($this->getPermissions($path) & \OCP\PERMISSION_UPDATE); + return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_UPDATE); } public function isDeletable($path) { - return ($this->getPermissions($path) & \OCP\PERMISSION_DELETE); + return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_DELETE); } public function isSharable($path) { if (\OCP\Util::isSharingDisabledForUser()) { return false; } - return ($this->getPermissions($path) & \OCP\PERMISSION_SHARE); + return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE); } public function file_exists($path) { diff --git a/apps/files_sharing/publicwebdav.php b/apps/files_sharing/publicwebdav.php index 03e43967a40..2c7ccf8d92c 100644 --- a/apps/files_sharing/publicwebdav.php +++ b/apps/files_sharing/publicwebdav.php @@ -41,7 +41,7 @@ $server->addPlugin(new OC_Connector_Sabre_ExceptionLoggerPlugin('webdav')); $server->subscribeEvent('beforeMethod', function () use ($server, $objectTree, $authBackend) { $share = $authBackend->getShare(); $owner = $share['uid_owner']; - $isWritable = $share['permissions'] & (\OCP\PERMISSION_UPDATE | \OCP\PERMISSION_CREATE); + $isWritable = $share['permissions'] & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE); $fileId = $share['file_source']; if (!$isWritable) { diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php index e550dcc27db..1259197423b 100644 --- a/apps/files_sharing/tests/api.php +++ b/apps/files_sharing/tests/api.php @@ -788,7 +788,7 @@ class Test_Files_Sharing_Api extends TestCase { $fileInfo = $this->view->getFileInfo($this->filename); $result = \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, - \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL); + \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_ALL); // share was successful? $this->assertTrue($result); @@ -822,7 +822,7 @@ class Test_Files_Sharing_Api extends TestCase { // check if share have expected permissions, single shared files never have // delete permissions - $this->assertEquals(\OCP\PERMISSION_ALL & ~\OCP\PERMISSION_DELETE, $userShare['permissions']); + $this->assertEquals(\OCP\Constants::PERMISSION_ALL & ~\OCP\Constants::PERMISSION_DELETE, $userShare['permissions']); // update permissions @@ -1228,7 +1228,7 @@ class Test_Files_Sharing_Api extends TestCase { $info = OC\Files\Filesystem::getFileInfo($this->filename); $this->assertTrue($info instanceof \OC\Files\FileInfo); - $result = \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_LINK, null, \OCP\PERMISSION_READ); + $result = \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ); $this->assertTrue(is_string($result)); $result = \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31); diff --git a/apps/files_sharing/tests/cache.php b/apps/files_sharing/tests/cache.php index b6a44f464f9..aec1983bad3 100644 --- a/apps/files_sharing/tests/cache.php +++ b/apps/files_sharing/tests/cache.php @@ -348,7 +348,7 @@ class Test_Files_Sharing_Cache extends TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); \OC\Files\Filesystem::file_put_contents('test.txt', 'foo'); $info = \OC\Files\Filesystem::getFileInfo('test.txt'); - \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL); + \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_ALL); \OC_Util::tearDownFS(); self::loginHelper(self::TEST_FILES_SHARING_API_USER2); @@ -369,7 +369,7 @@ class Test_Files_Sharing_Cache extends TestCase { \OC\Files\Filesystem::touch('foo/bar/test.txt'); $folderInfo = \OC\Files\Filesystem::getFileInfo('foo'); $fileInfo = \OC\Files\Filesystem::getFileInfo('foo/bar/test.txt'); - \OCP\Share::shareItem('folder', $folderInfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL); + \OCP\Share::shareItem('folder', $folderInfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_ALL); \OC_Util::tearDownFS(); self::loginHelper(self::TEST_FILES_SHARING_API_USER2); diff --git a/apps/files_sharing/tests/share.php b/apps/files_sharing/tests/share.php index 4318d3c510e..f76f92734d0 100644 --- a/apps/files_sharing/tests/share.php +++ b/apps/files_sharing/tests/share.php @@ -105,12 +105,12 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase { $fileinfo = $this->view->getFileInfo($this->filename); $result = \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, - \Test_Files_Sharing::TEST_FILES_SHARING_API_GROUP1, \OCP\PERMISSION_READ); + \Test_Files_Sharing::TEST_FILES_SHARING_API_GROUP1, \OCP\Constants::PERMISSION_READ); $this->assertTrue($result); $result = \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, - \Test_Files_Sharing::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_UPDATE); + \Test_Files_Sharing::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_UPDATE); $this->assertTrue($result); @@ -124,7 +124,7 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase { $this->assertSame(1, count($result)); $share = reset($result); - $this->assertSame(\OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE, $share['permissions']); + $this->assertSame(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, $share['permissions']); \OC\Files\Filesystem::rename($this->filename, $this->filename . '-renamed'); @@ -136,7 +136,7 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase { $this->assertSame(1, count($result)); $share = reset($result); - $this->assertSame(\OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE, $share['permissions']); + $this->assertSame(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, $share['permissions']); $this->assertSame($this->filename . '-renamed', $share['file_target']); self::loginHelper(self::TEST_FILES_SHARING_API_USER1); @@ -157,7 +157,7 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase { $share = reset($result); // only the group share permissions should be available now - $this->assertSame(\OCP\PERMISSION_READ, $share['permissions']); + $this->assertSame(\OCP\Constants::PERMISSION_READ, $share['permissions']); $this->assertSame($this->filename . '-renamed', $share['file_target']); } @@ -172,8 +172,8 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase { $fileinfo = $this->view->getFileInfo($this->filename); // share the file to group1 (user2 is a member of this group) and explicitely to user2 - \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1, \OCP\PERMISSION_ALL); - \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL); + \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1, \OCP\Constants::PERMISSION_ALL); + \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_ALL); // user1 should have to shared files $shares = \OCP\Share::getItemsShared('file'); @@ -203,7 +203,7 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase { $this->assertSame(1, count($shares)); // user1 shares a gain the file directly to user2 - \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\PERMISSION_ALL); + \OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_ALL); // user2 should see again welcome.txt and the shared file \Test_Files_Sharing::loginHelper(self::TEST_FILES_SHARING_API_USER2); @@ -271,14 +271,14 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase { } function DataProviderTestFileSharePermissions() { - $permission1 = \OCP\PERMISSION_ALL; - $permission3 = \OCP\PERMISSION_READ; - $permission4 = \OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE; - $permission5 = \OCP\PERMISSION_READ | \OCP\PERMISSION_DELETE; - $permission6 = \OCP\PERMISSION_READ | \OCP\PERMISSION_UPDATE | \OCP\PERMISSION_DELETE; + $permission1 = \OCP\Constants::PERMISSION_ALL; + $permission3 = \OCP\Constants::PERMISSION_READ; + $permission4 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE; + $permission5 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE; + $permission6 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE; return array( - array($permission1, \OCP\PERMISSION_ALL & ~\OCP\PERMISSION_DELETE), + array($permission1, \OCP\Constants::PERMISSION_ALL & ~\OCP\Constants::PERMISSION_DELETE), array($permission3, $permission3), array($permission4, $permission4), array($permission5, $permission3), diff --git a/apps/files_trashbin/lib/helper.php b/apps/files_trashbin/lib/helper.php index c2b81e3dbc8..c99662480df 100644 --- a/apps/files_trashbin/lib/helper.php +++ b/apps/files_trashbin/lib/helper.php @@ -88,7 +88,7 @@ class Helper $entry = \OCA\Files\Helper::formatFileInfo($i); $entry['id'] = $id++; $entry['etag'] = $entry['mtime']; // add fake etag, it is only needed to identify the preview image - $entry['permissions'] = \OCP\PERMISSION_READ; + $entry['permissions'] = \OCP\Constants::PERMISSION_READ; if (\OCP\App::isEnabled('files_encryption')) { $entry['isPreviewAvailable'] = false; } diff --git a/apps/files_versions/tests/versions.php b/apps/files_versions/tests/versions.php index 436863b28dc..6205a6881f0 100644 --- a/apps/files_versions/tests/versions.php +++ b/apps/files_versions/tests/versions.php @@ -277,7 +277,7 @@ class Test_Files_Versioning extends \Test\TestCase { $this->rootView->file_put_contents($v1, 'version1'); $this->rootView->file_put_contents($v2, 'version2'); - \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_VERSIONS_USER2, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_VERSIONS_USER2, \OCP\Constants::PERMISSION_ALL); self::loginHelper(self::TEST_VERSIONS_USER2); @@ -320,7 +320,7 @@ class Test_Files_Versioning extends \Test\TestCase { $this->rootView->file_put_contents($v1, 'version1'); $this->rootView->file_put_contents($v2, 'version2'); - \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_VERSIONS_USER2, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_VERSIONS_USER2, \OCP\Constants::PERMISSION_ALL); self::loginHelper(self::TEST_VERSIONS_USER2); |