summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/ajax/getMigrationStatus.php
blob: a28ebfac7f7aaf3be0c7ed4a3f4688259bc3a74a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
/**
 * Copyright (c) 2013, Bjoern Schiessle <schiessle@owncloud.com>
 * This file is licensed under the Affero General Public License version 3 or later.
 * See the COPYING-README file.
 *
 * @brief check migration status
 */
use OCA\Encryption\Util;

\OCP\JSON::checkAppEnabled('files_encryption');

$user = isset($_POST['user']) ? $_POST['user'] : '';
$password = isset($_POST['password']) ? $_POST['password'] : '';

$migrationCompleted = true;

if ($user !== '' && $password !== '') {
	if (\OCP\User::checkPassword($user, $password)) {
		$util = new Util(new \OC_FilesystemView('/'), $user);
		if ($util->getMigrationStatus($user) !== Util::MIGRATION_COMPLETED) {
			$migrationCompleted = false;
		}
	}
}

\OCP\JSON::success(array('data' => array('migrationCompleted' => $migrationCompleted)));