/** * @param array $params */ public static function preShared($params) { if (\OCP\App::isEnabled('files_encryption') === false) { return true; } $l = new \OC_L10N('files_encryption'); $users = array(); $view = new \OC\Files\View('/'); switch ($params['shareType']) { case \OCP\Share::SHARE_TYPE_USER: $users[] = $params['shareWith']; break; case \OCP\Share::SHARE_TYPE_GROUP: $users = \OC_Group::usersInGroup($params['shareWith']); break; } $notConfigured = array(); foreach ($users as $user) { if (!Keymanager::publicKeyExists($view, $user)) { $notConfigured[] = $user; } } if (count($notConfigured) > 0) { $params['run'] = false; $params['error'] = $l->t('Following users are not set up for encryption:') . ' ' . join(', ', $notConfigured); } }