migrate therinaldos.com data
Build & Deploy to DigitalOcean Space / build (push) Failing after 2m38s

This commit is contained in:
2024-05-05 15:50:45 -04:00
commit ef1ff240d4
23182 changed files with 3801898 additions and 0 deletions
@@ -0,0 +1,114 @@
<?php
/**
* Privacy App
*
* @author Georg Ehrke
* @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Privacy\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IRequest;
/**
* Class AdminController
*
* @package OCA\Privacy\Controller
*/
class AdminController extends Controller {
/** @var IConfig */
private $config;
/** @var IDBConnection */
private $dbConnection;
/**
* AdminController constructor.
*
* @param string $appName
* @param IRequest $request
* @param IConfig $config
* @param IDBConnection $dbConnection
*/
public function __construct(string $appName, IRequest $request,
IConfig $config, IDBConnection $dbConnection) {
parent::__construct($appName, $request);
$this->config = $config;
$this->dbConnection = $dbConnection;
}
/**
* @param string $code
* @return JSONResponse
*/
public function setReadableLocation(string $code):JSONResponse {
$this->config->setAppValue($this->appName, 'readableLocation', $code);
return new JSONResponse([], Http::STATUS_OK);
}
/**
* @param string $name
* @return JSONResponse
*/
public function addAdditionalAdmin(string $name):JSONResponse {
$query = $this->dbConnection->getQueryBuilder();
$query->insert('privacy_admins')
->setValue('displayname', $query->createNamedParameter($name))
->execute();
$id = $query->getLastInsertId();
return new JSONResponse([
'id' => $id,
'displayname' => $name,
'internal' => false,
], Http::STATUS_CREATED);
}
/**
* @param int $id
* @return JSONResponse
*/
public function deleteAdditionalAdmin(int $id):JSONResponse {
$query = $this->dbConnection->getQueryBuilder();
$query->delete('privacy_admins')
->where($query->expr()->eq('id', $query->createNamedParameter($id)))
->execute();
return new JSONResponse([], Http::STATUS_OK);
}
/**
* @param string $enabled
* @return JSONResponse
*/
public function setFullDiskEncryption(string $enabled):JSONResponse {
$allowedValues = ['0', '1'];
if (!\in_array($enabled, $allowedValues, true)) {
return new JSONResponse([], HTTP::STATUS_NOT_ACCEPTABLE);
}
$this->config->setAppValue('privacy', 'fullDiskEncryptionEnabled', $enabled);
return new JSONResponse([], HTTP::STATUS_OK);
}
}
@@ -0,0 +1,109 @@
<?php
/**
* Privacy App
*
* @author Georg Ehrke
* @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Privacy\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IRequest;
/**
* Class PersonalController
*
* @package OCA\Privacy\Controller
*/
class PersonalController extends Controller {
/** @var IConfig */
private $config;
/** @var IGroupManager */
private $groupManager;
/** @var IDBConnection */
private $dbConnection;
/**
* PersonalController constructor.
*
* @param string $appName
* @param IRequest $request
* @param IConfig $config
* @param IGroupManager $groupManager
* @param IDBConnection $dbConnection
*/
public function __construct(string $appName, IRequest $request,
IConfig $config, IGroupManager $groupManager,
IDBConnection $dbConnection) {
parent::__construct($appName, $request);
$this->config = $config;
$this->groupManager = $groupManager;
$this->dbConnection = $dbConnection;
}
/**
* @NoAdminRequired
*
* @return JSONResponse
*/
public function getAdmins():JSONResponse {
$adminGroup = $this->groupManager->get('admin');
// Admin Group should always exist, just catch for safety's sake
if (!$adminGroup) {
return new JSONResponse([]);
}
$adminUsers = $adminGroup->getUsers();
$uids = [];
foreach ($adminUsers as $adminUser) {
if (!$adminUser->isEnabled()) {
continue;
}
$uids[] = [
'id' => $adminUser->getUID(),
'displayname' => $adminUser->getDisplayName(),
'internal' => true,
];
}
$query = $this->dbConnection->getQueryBuilder();
$query->select(['id', 'displayname'])
->from('privacy_admins');
$stmt = $query->execute();
foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$uids[] = [
'id' => (int)$row['id'],
'displayname' => (string)$row['displayname'],
'internal' => false,
];
}
return new JSONResponse($uids, Http::STATUS_OK);
}
}
@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace OCA\Privacy\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
/**
* Auto-generated migration step: Please modify to your needs!
*/
class Version100Date20190217131943 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
/*
* Schema generated from database.xml but required changes for
* https://github.com/nextcloud/mail/issues/784 already applied.
*/
if (!$schema->hasTable('privacy_admins')) {
$table = $schema->createTable('privacy_admins');
$table->addColumn('id', 'integer', [
'autoincrement' => true,
'notnull' => true,
'length' => 4,
]);
$table->addColumn('displayname', 'string', [
'notnull' => true,
'length' => 64,
'default' => '',
]);
$table->setPrimaryKey(['id']);
}
return $schema;
}
}
@@ -0,0 +1,61 @@
<?php
declare(strict_types=1);
/**
* Privacy App
*
* @author Georg Ehrke
* @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Privacy\Settings;
use OCA\Theming\ThemingDefaults;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\Settings\ISettings;
use OCP\Support\Subscription\IRegistry;
class MissionSettings implements ISettings {
public function __construct(
protected IRegistry $subscription,
protected ThemingDefaults $themingDefaults,
protected IInitialState $initialState,
) {
}
public function getForm(): TemplateResponse {
$this->initialState->provideInitialState(
'serverName',
$this->themingDefaults->getEntity(),
);
return new TemplateResponse('privacy', 'mission');
}
public function getSection(): ?string {
if ($this->subscription->delegateHasValidSubscription()) {
return null;
}
return 'privacy';
}
public function getPriority(): int {
return 0;
}
}
@@ -0,0 +1,91 @@
<?php
/**
* Privacy App
*
* @author Georg Ehrke
* @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Privacy\Settings;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;
/**
* Class PrivacySection
*
* @package OCA\Privacy\Settings
*/
class PrivacySection implements IIconSection {
/**
* @var IL10N
*/
private $l;
/**
* @var IURLGenerator
*/
private $url;
/**
* @param IURLGenerator $url
* @param IL10N $l
*/
public function __construct(IURLGenerator $url, IL10N $l) {
$this->url = $url;
$this->l = $l;
}
/**
* returns the ID of the section. It is supposed to be a lower case string,
* e.g. 'ldap'
*
* @returns string
*/
public function getID() {
return 'privacy';
}
/**
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
* integration'. Use the L10N service to translate it.
*
* @return string
*/
public function getName() {
return $this->l->t('Privacy');
}
/**
* @return int whether the form should be rather on the top or bottom of
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
*
* E.g.: 70
*/
public function getPriority() {
return 70;
}
/**
* {@inheritdoc}
*/
public function getIcon() {
return $this->url->imagePath('privacy', 'app-dark.svg');
}
}
@@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
/**
* Privacy App
*
* @author Georg Ehrke
* @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Privacy\Settings;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Settings\ISettings;
use OCP\Support\Subscription\IRegistry;
class UserDataManifestoSettings implements ISettings {
/** @var IRegistry */
protected $subscription;
public function __construct(IRegistry $subscription) {
$this->subscription = $subscription;
}
public function getForm(): TemplateResponse {
return new TemplateResponse('privacy', 'user-data-manifesto');
}
public function getSection(): ?string {
if ($this->subscription->delegateHasValidSubscription()) {
return null;
}
return 'privacy';
}
public function getPriority(): int {
return 5;
}
}
@@ -0,0 +1,77 @@
<?php
/**
* Privacy App
*
* @author Georg Ehrke
* @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Privacy\Settings;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\Settings\ISettings;
/**
* Class WhereIsMyDataSettings
*
* @package OCA\Privacy\Settings
*/
class WhereIsYourDataSettings implements ISettings {
/** @var IInitialStateService */
private $initialStateService;
/** @var IConfig */
private $config;
/**
* MissionSettings constructor.
*
* @param IInitialStateService $initialStateService
* @param IConfig $config
*/
public function __construct(IInitialStateService $initialStateService,
IConfig $config) {
$this->initialStateService = $initialStateService;
$this->config = $config;
}
/**
* @return TemplateResponse
*/
public function getForm():TemplateResponse {
$location = $this->config->getAppValue('privacy', 'readableLocation');
$this->initialStateService->provideInitialState('privacy', 'location', $location ?: '');
return new TemplateResponse('privacy', 'where-is-your-data');
}
/**
* @return string
*/
public function getSection():string {
return 'privacy';
}
/**
* @return int
*/
public function getPriority():int {
return 15;
}
}
@@ -0,0 +1,114 @@
<?php
/**
* Privacy App
*
* @author Georg Ehrke
* @copyright 2019 Georg Ehrke <oc.list@georgehrke.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Privacy\Settings;
use OC;
use OCA\Theming\ThemingDefaults;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Encryption\IManager as IEncryptionManager;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\Settings\ISettings;
use Throwable;
/**
* Class WhoHasAccessSettings
*
* @package OCA\Privacy\Settings
*/
class WhoHasAccessSettings implements ISettings {
/** @var IConfig */
private $config;
/** @var IEncryptionManager */
private $encryptionManager;
/** @var IInitialStateService */
private $initialStateService;
/**
* WhoHasAccessSettings constructor.
*
* @param IConfig $config
* @param IEncryptionManager $manager
* @param IInitialStateService $initialStateService
*/
public function __construct(IConfig $config,
IEncryptionManager $manager,
IInitialStateService $initialStateService) {
$this->config = $config;
$this->encryptionManager = $manager;
$this->initialStateService = $initialStateService;
}
/**
* @return TemplateResponse
*/
public function getForm():TemplateResponse {
\OCP\Util::addScript('privacy', 'privacy-main');
$themingDefaults = OC::$server->getThemingDefaults();
if ($themingDefaults instanceof ThemingDefaults) {
$privacyPolicyUrl = $themingDefaults->getPrivacyUrl();
} else {
$privacyPolicyUrl = null;
}
$isHomeStorageEncrypted = false;
$isMasterKeyEnabled = false;
if ($this->encryptionManager->isEnabled()) {
try {
$moduleId = $this->encryptionManager->getDefaultEncryptionModuleId();
if ($moduleId === 'OC_DEFAULT_MODULE') {
/** @var \OCA\Encryption\Util $util */
$util = \OC::$server->get(\OCA\Encryption\Util::class);
$isHomeStorageEncrypted = $util->shouldEncryptHomeStorage();
$isMasterKeyEnabled = $util->isMasterKeyEnabled();
}
} catch (Throwable $e) {
}
}
$this->initialStateService->provideInitialState('privacy', 'privacyPolicyUrl', $privacyPolicyUrl);
$this->initialStateService->provideInitialState('privacy', 'fullDiskEncryptionEnabled', $this->config->getAppValue('privacy', 'fullDiskEncryptionEnabled', '0') === '1');
$this->initialStateService->provideInitialState('privacy', 'serverSideEncryptionEnabled', $this->encryptionManager->isEnabled());
$this->initialStateService->provideInitialState('privacy', 'homeStorageEncryptionEnabled', $isHomeStorageEncrypted);
$this->initialStateService->provideInitialState('privacy', 'masterKeyEncryptionEnabled', $isMasterKeyEnabled);
return new TemplateResponse('privacy', 'who-has-access');
}
/**
* @return string
*/
public function getSection():string {
return 'privacy';
}
/**
* @return int
*/
public function getPriority():int {
return 10;
}
}