-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add public api for mount configurations
- Loading branch information
1 parent
f321357
commit f4701d7
Showing
22 changed files
with
298 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Copyright (c) 2014 Robin Appelman <[email protected]> | ||
* This file is licensed under the Affero General Public License version 3 or | ||
* later. | ||
* See the COPYING-README file. | ||
*/ | ||
|
||
namespace OC\Files\Config; | ||
|
||
use OCP\Files\Config\IMountProviderCollection; | ||
use OCP\Files\Config\IMountProvider; | ||
use OCP\Files\Storage\IStorageFactory; | ||
use OCP\IUser; | ||
|
||
class MountProviderCollection implements IMountProviderCollection { | ||
/** | ||
* @var \OCP\Files\Config\IMountProvider[] | ||
*/ | ||
private $providers = array(); | ||
|
||
/** | ||
* @var \OCP\Files\Storage\IStorageFactory | ||
*/ | ||
private $loader; | ||
|
||
/** | ||
* @param \OCP\Files\Storage\IStorageFactory $loader | ||
*/ | ||
public function __construct(IStorageFactory $loader) { | ||
$this->loader = $loader; | ||
} | ||
|
||
/** | ||
* Get all configured mount points for the user | ||
* | ||
* @param \OCP\IUser $user | ||
* @return \OCP\Files\Mount\IMountPoint[] | ||
*/ | ||
public function getMountsForUser(IUser $user) { | ||
$loader = $this->loader; | ||
return array_reduce($this->providers, function ($mounts, IMountProvider $provider) use ($user, $loader) { | ||
return array_merge($mounts, $provider->getMountsForUser($user, $loader)); | ||
}, array()); | ||
} | ||
|
||
/** | ||
* Add a provider for mount points | ||
* | ||
* @param \OCP\Files\Config\IMountProvider $provider | ||
*/ | ||
public function registerProvider(IMountProvider $provider) { | ||
$this->providers[] = $provider; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.