Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user backends to provide quotas #27661

Merged
merged 1 commit into from
Apr 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/private/User/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,12 @@ private function newAccount($uid, $backend) {
$account->setEmail($email);
}
}
if ($backend instanceof IProvidesQuotaBackend) {
$quota = $backend->getQuota($uid);
if ($quota !== null) {
$account->setQuota($quota);
}
}
$home = false;
if ($backend->implementsActions(Backend::GET_HOME)) {
$home = $backend->getHome($uid);
Expand Down
44 changes: 44 additions & 0 deletions lib/public/User/IProvidesQuotaBackend.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* @author Vincent Petry <pvince81@owncloud.com>
*
* @copyright Copyright (c) 2017, ownCloud GmbH
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program 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 Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/


// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\User;

/**
* Interface IProvidesQuotaBackend
*
* @package OCP\User
* @since 10.0
*/
interface IProvidesQuotaBackend {

/**
* Get a users quota
*
* @param string $uid The username
* @return string
* @since 10.0
*/
public function getQuota($uid);
}