OC_Mount_Config::registerBackend('\OC\Files\Storage\Local', array(
'backend' => (string)$l->t('Local'),
+ 'priority' => 150,
'configuration' => array(
'datadir' => (string)$l->t('Location'))));
OC_Mount_Config::registerBackend('\OC\Files\Storage\AmazonS3', array(
'backend' => (string)$l->t('Amazon S3'),
+ 'priority' => 100,
'configuration' => array(
'key' => (string)$l->t('Key'),
'secret' => '*'.$l->t('Secret'),
OC_Mount_Config::registerBackend('\OC\Files\Storage\AmazonS3', array(
'backend' => (string)$l->t('Amazon S3 and compliant'),
+ 'priority' => 100,
'configuration' => array(
'key' => (string)$l->t('Access Key'),
'secret' => '*'.$l->t('Secret Key'),
OC_Mount_Config::registerBackend('\OC\Files\Storage\Dropbox', array(
'backend' => 'Dropbox',
+ 'priority' => 100,
'configuration' => array(
'configured' => '#configured',
'app_key' => (string)$l->t('App key'),
OC_Mount_Config::registerBackend('\OC\Files\Storage\FTP', array(
'backend' => 'FTP',
+ 'priority' => 100,
'configuration' => array(
'host' => (string)$l->t('Host'),
'user' => (string)$l->t('Username'),
OC_Mount_Config::registerBackend('\OC\Files\Storage\Google', array(
'backend' => 'Google Drive',
+ 'priority' => 100,
'configuration' => array(
'configured' => '#configured',
'client_id' => (string)$l->t('Client ID'),
OC_Mount_Config::registerBackend('\OC\Files\Storage\Swift', array(
'backend' => (string)$l->t('OpenStack Object Storage'),
+ 'priority' => 100,
'configuration' => array(
'user' => (string)$l->t('Username (required)'),
'bucket' => (string)$l->t('Bucket (required)'),
if (!OC_Util::runningOnWindows()) {
OC_Mount_Config::registerBackend('\OC\Files\Storage\SMB', array(
'backend' => 'SMB / CIFS',
+ 'priority' => 100,
'configuration' => array(
'host' => (string)$l->t('Host'),
'user' => (string)$l->t('Username'),
OC_Mount_Config::registerBackend('\OC\Files\Storage\SMB_OC', array(
'backend' => (string)$l->t('SMB / CIFS using OC login'),
+ 'priority' => 90,
'configuration' => array(
'host' => (string)$l->t('Host'),
'username_as_share' => '!'.$l->t('Username as share'),
OC_Mount_Config::registerBackend('\OC\Files\Storage\DAV', array(
'backend' => 'WebDAV',
+ 'priority' => 100,
'configuration' => array(
'host' => (string)$l->t('URL'),
'user' => (string)$l->t('Username'),
OC_Mount_Config::registerBackend('\OC\Files\Storage\OwnCloud', array(
'backend' => 'ownCloud',
+ 'priority' => 100,
'configuration' => array(
'host' => (string)$l->t('URL'),
'user' => (string)$l->t('Username'),
OC_Mount_Config::registerBackend('\OC\Files\Storage\SFTP', array(
'backend' => 'SFTP',
+ 'priority' => 100,
'configuration' => array(
'host' => (string)$l->t('Host'),
'user' => (string)$l->t('Username'),
$datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data");
$mount_file = \OC_Config::getValue("mount_file", $datadir . "/mount.json");
+ $backends = self::getBackends();
+
//move config file to it's new position
if (is_file(\OC::$SERVERROOT . '/config/mount.json')) {
rename(\OC::$SERVERROOT . '/config/mount.json', $mount_file);
if (isset($mountConfig[self::MOUNT_TYPE_GLOBAL])) {
foreach ($mountConfig[self::MOUNT_TYPE_GLOBAL] as $mountPoint => $options) {
$options['options'] = self::decryptPasswords($options['options']);
- $mountPoints[$mountPoint] = $options;
+ if (!isset($options['priority'])) {
+ $options['priority'] = $backends[$options['class']]['priority'];
+ }
+
+ if ( (!isset($mountPoints[$mountPoint]))
+ || ($options['priority'] >= $mountPoints[$mountPoint]['priority']) ) {
+ $options['priority_type'] = 'global';
+ $mountPoints[$mountPoint] = $options;
+ }
}
}
if (isset($mountConfig[self::MOUNT_TYPE_GROUP])) {
$option = self::setUserVars($user, $option);
}
$options['options'] = self::decryptPasswords($options['options']);
- $mountPoints[$mountPoint] = $options;
+ if (!isset($options['priority'])) {
+ $options['priority'] = $backends[$options['class']]['priority'];
+ }
+
+ if ( (!isset($mountPoints[$mountPoint]))
+ || ($options['priority'] >= $mountPoints[$mountPoint]['priority'])
+ || ($mountPoints[$mountPoint]['priority_type'] != 'group') ) {
+ $options['priority_type'] = 'group';
+ $mountPoints[$mountPoint] = $options;
+ }
}
}
}
$option = self::setUserVars($user, $option);
}
$options['options'] = self::decryptPasswords($options['options']);
- $mountPoints[$mountPoint] = $options;
+ if (!isset($options['priority'])) {
+ $options['priority'] = $backends[$options['class']]['priority'];
+ }
+
+ if ( (!isset($mountPoints[$mountPoint]))
+ || ($options['priority'] >= $mountPoints[$mountPoint]['priority'])
+ || ($mountPoints[$mountPoint]['priority_type'] != 'user') ) {
+ $options['priority_type'] = 'user';
+ $mountPoints[$mountPoint] = $options;
+ }
}
}
}
if (isset($mountConfig[self::MOUNT_TYPE_USER][$user])) {
foreach ($mountConfig[self::MOUNT_TYPE_USER][$user] as $mountPoint => $options) {
$options['options'] = self::decryptPasswords($options['options']);
- $mountPoints[$mountPoint] = $options;
+
+ if ( (!isset($mountPoints[$mountPoint]))
+ || ($mountPoints[$mountPoint]['priority_type'] != 'personal') ) {
+ $options['priority_type'] = 'personal';
+ $mountPoints[$mountPoint] = $options;
+ }
}
}
$mount['class'] = '\OC\Files\Storage\\'.substr($mount['class'], 15);
}
$mount['options'] = self::decryptPasswords($mount['options']);
+ if (!isset($mount['priority'])) {
+ $mount['priority'] = $backends[$mount['class']]['priority'];
+ }
// Remove '/$user/files/' from mount point
$mountPoint = substr($mountPoint, 13);
'class' => $mount['class'],
'mountpoint' => $mountPoint,
'backend' => $backends[$mount['class']]['backend'],
+ 'priority' => $mount['priority'],
'options' => $mount['options'],
'applicable' => array('groups' => array($group), 'users' => array()),
'status' => self::getBackendStatus($mount['class'], $mount['options'], false)
$mount['class'] = '\OC\Files\Storage\\'.substr($mount['class'], 15);
}
$mount['options'] = self::decryptPasswords($mount['options']);
+ if (!isset($mount['priority'])) {
+ $mount['priority'] = $backends[$mount['class']]['priority'];
+ }
// Remove '/$user/files/' from mount point
$mountPoint = substr($mountPoint, 13);
$config = array(
'class' => $mount['class'],
'mountpoint' => $mountPoint,
'backend' => $backends[$mount['class']]['backend'],
+ 'priority' => $mount['priority'],
'options' => $mount['options'],
'applicable' => array('groups' => array(), 'users' => array($user)),
'status' => self::getBackendStatus($mount['class'], $mount['options'], false)
'options' => self::encryptPasswords($classOptions))
)
);
+ if (! $isPersonal) {
+ $mount[$applicable][$mountPoint]['priority'] = $backends[$class]['priority'];
+ }
$mountPoints = self::readData($isPersonal ? OCP\User::getUser() : NULL);
$mountPoints = self::mergeMountPoints($mountPoints, $mount, $mountType);