Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
d016890
Initial work on Apps page split:
blizzz Aug 8, 2016
9e39c41
fix duplicated db index name
blizzz Aug 9, 2016
bbb086f
remove mistakenly added file
blizzz Aug 9, 2016
a548902
Fallback for legacy settings. They are placed into Additional Settings
blizzz Aug 9, 2016
2e9794f
more admin page splitup improvements
blizzz Aug 10, 2016
d7bbebb
fix registration of admin settings and section on app install
blizzz Aug 10, 2016
c956901
fixes, improvements, and another app:
blizzz Aug 10, 2016
e37db63
rename IAdmin to ISettings, the interface is not bound to a specific …
blizzz Aug 11, 2016
94c3d61
adjust federatedfilesharing
blizzz Aug 11, 2016
09573db
adjust files_external
blizzz Aug 11, 2016
10249f4
make sure shipped apps also setup their admin settings on a fresh ins…
blizzz Aug 11, 2016
6a35c7d
superfluous
blizzz Aug 11, 2016
3ae0a38
adjust Theming app
blizzz Aug 11, 2016
ea419a2
adjust files app, and integrate files_external into that section
blizzz Aug 11, 2016
0c86f69
superfluous
blizzz Aug 11, 2016
63efdb3
adjust federation app
blizzz Aug 11, 2016
4077856
adjust systemtags app
blizzz Aug 11, 2016
c4b35dc
Add missing since annotations
LukasReschke Aug 11, 2016
df3b708
Add since tags to class
LukasReschke Aug 11, 2016
3ad89a7
Resolve conflict
LukasReschke Aug 11, 2016
a5ba5bb
register app autoload instead of loading apps
blizzz Aug 12, 2016
4132319
rename "Tenmplate" to "ThemingDefaults" to make the auto loader happy"
schiessle Aug 12, 2016
cd08307
rename remaining occurences of OCA/Theming/Template
blizzz Aug 12, 2016
6fa34e3
added some missed diagnosis output
blizzz Aug 12, 2016
fe29483
fix theming tests
blizzz Aug 12, 2016
ef4452e
mark current section
blizzz Aug 12, 2016
d056f57
change casing in section display names
blizzz Aug 12, 2016
c93453e
make updatenotification settings appear as if it is part of the versi…
blizzz Aug 12, 2016
0c904c8
move systemstags to sharign section, drop collaboration section
blizzz Aug 12, 2016
2d66b16
change federatedfilesharing css class to followupsection to reduce wh…
blizzz Aug 12, 2016
9111b52
move mail settings and file handling to additional ones, thus files_e…
blizzz Aug 12, 2016
57295ee
simplify encryption manager fetching in DIContainer
blizzz Aug 12, 2016
1ebbcdc
satisfy dependencies for files_external
blizzz Aug 15, 2016
687f5be
Add unit tests
LukasReschke Aug 15, 2016
436e6c1
Use MockBuilder instead of createMock
LukasReschke Aug 15, 2016
1e62bd3
attempt to remove section and settings entries when an app got disabled
blizzz Aug 15, 2016
6e37a00
check registered sections and settings after an app got updated to ga…
blizzz Aug 15, 2016
eed879a
adopt to Controller constructor changes
blizzz Aug 15, 2016
e611662
final db indexes
blizzz Aug 16, 2016
4d505b7
fix missing parameters in sharing settings page
blizzz Aug 16, 2016
8ef08e4
add missing encryption modules to settings
blizzz Aug 16, 2016
c5fdee2
for new we cannot have nested settings, default module is only append…
blizzz Aug 16, 2016
f4aa676
adjust tests to latest changes
blizzz Aug 16, 2016
6ed721d
Rename class reference
LukasReschke Aug 16, 2016
1f177aa
Use getMockBuilder instead of createMock
LukasReschke Aug 16, 2016
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
Next Next commit
Initial work on Apps page split:
* interfaces for the Admin settings (IAdmin) and section (ISection)
* SettingsManager service
* example setup with LDAP app
  • Loading branch information
blizzz authored and LukasReschke committed Aug 16, 2016
commit d01689037d0be0c3e209288398bd7ca9e973048a
7 changes: 6 additions & 1 deletion apps/user_ldap/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A user logs into ownCloud with their LDAP or AD credentials, and is granted acce
</description>
<licence>AGPL</licence>
<author>Dominik Schmidt and Arthur Schiwon</author>
<version>1.0.0</version>
<version>1.0.1</version>
<types>
<authentication/>
</types>
Expand All @@ -27,4 +27,9 @@ A user logs into ownCloud with their LDAP or AD credentials, and is granted acce
<job>OCA\User_LDAP\Jobs\UpdateGroups</job>
<job>OCA\User_LDAP\Jobs\CleanUp</job>
</background-jobs>

<settings>
<admin>\OCA\User_LDAP\Settings\Admin</admin>
<admin-section>\OCA\User_LDAP\Settings\Section</admin-section>
</settings>
</info>
115 changes: 115 additions & 0 deletions apps/user_ldap/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php
/**
* @copyright Copyright (c) 2016 Arthur Schiwon <[email protected]>
*
* @author Arthur Schiwon <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\User_LDAP\Settings;


use OCA\User_LDAP\Configuration;
use OCA\User_LDAP\Helper;
use OCP\IL10N;
use OCP\Settings\IAdmin;
use OCP\Template;

class Admin implements IAdmin {

/** @var IL10N */
private $l;

public function __construct(IL10N $l) {
$this->l = $l;
}

/**
* @return Template all parameters are supposed to be assigned
*/
public function render() {
$settings = new Template('user_ldap', 'settings');

$helper = new Helper();
$prefixes = $helper->getServerConfigurationPrefixes();
$hosts = $helper->getServerConfigurationHosts();

$wizardHtml = '';
$toc = [];

$wControls = new Template('user_ldap', 'part.wizardcontrols');
$wControls = $wControls->fetchPage();
$sControls = new Template('user_ldap', 'part.settingcontrols');
$sControls = $sControls->fetchPage();

$wizTabs = [
['tpl' => 'part.wizard-server', 'cap' => $this->l->t('Server')],
['tpl' => 'part.wizard-userfilter', 'cap' => $this->l->t('Users')],
['tpl' => 'part.wizard-loginfilter', 'cap' => $this->l->t('Login Attributes')],
['tpl' => 'part.wizard-groupfilter', 'cap' => $this->l->t('Groups')],
];
$wizTabsCount = count($wizTabs);
for($i = 0; $i < $wizTabsCount; $i++) {
$tab = new Template('user_ldap', $wizTabs[$i]['tpl']);
if($i === 0) {
$tab->assign('serverConfigurationPrefixes', $prefixes);
$tab->assign('serverConfigurationHosts', $hosts);
}
$tab->assign('wizardControls', $wControls);
$wizardHtml .= $tab->fetchPage();
$toc['#ldapWizard'.($i+1)] = $wizTabs[$i]['cap'];
}

$settings->assign('tabs', $wizardHtml);
$settings->assign('toc', $toc);
$settings->assign('settingControls', $sControls);

// assign default values
$config = new Configuration('', false);
$defaults = $config->getDefaults();
foreach($defaults as $key => $default) {
$settings->assign($key.'_default', $default);
}

return $settings;
}

/**
* @return string the section ID, e.g. 'sharing'
*/
public function getSection() {
return 'ldap';
}

/**
* @return int whether the form should be rather on the top or bottom of
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
*/
public function getPriority() {
return 5;
}

private function renderControls() {
$controls = new Template('user_ldap', 'part.settingcontrols');
return $controls->fetchPage();

}
}
67 changes: 67 additions & 0 deletions apps/user_ldap/lib/Settings/Section.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
/**
* @copyright Copyright (c) 2016 Arthur Schiwon <[email protected]>
*
* @author Arthur Schiwon <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\User_LDAP\Settings;

use OCP\IL10N;
use OCP\Settings\ISection;

class Section implements ISection {
/** @var IL10N */
private $l;

public function __construct(IL10N $l) {
$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 'ldap';
}

/**
* 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('LDAP / AD Integration');
}

/**
* @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 25;
}
}
2 changes: 1 addition & 1 deletion core/templates/untrustedDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<?php p($l->t('Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain.')); ?>
<br><br>
<p style="text-align:center;">
<a href="<?php print_unescaped(\OC::$server->getURLGenerator()->getAbsoluteURL(\OCP\Util::linkToRoute('settings_admin'))); ?>?trustDomain=<?php p($_['domain']); ?>" class="button">
<a href="<?php print_unescaped(\OC::$server->getURLGenerator()->getAbsoluteURL(\OCP\Util::linkToRoute('settings.AdminSettings.index'))); ?>?trustDomain=<?php p($_['domain']); ?>" class="button">
<?php p($l->t('Add "%s" as trusted domain', array($_['domain']))); ?>
</a>
</p>
Expand Down
94 changes: 94 additions & 0 deletions db_structure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1976,4 +1976,98 @@

</table>

<table>
<!-- Extra admin settings sections -->
<name>*dbprefix*admin_sections</name>

<declaration>

<field>
<name>id</name>
<type>text</type>
<default></default>
<notnull>false</notnull>
<length>64</length>
</field>

<field>
<name>class</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
<length>255</length>
</field>

<field>
<name>priority</name>
<type>integer</type>
<default></default>
<notnull>true</notnull>
<length>1</length>
</field>

<index>
<name>admin_sections_id_index</name>
<unique>true</unique>
<field>
<name>id</name>
<sorting>ascending</sorting>
</field>
</index>

</declaration>
</table>

<table>
<!-- Extra admin settings -->
<name>*dbprefix*admin_settings</name>

<declaration>

<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<length>4</length>
</field>

<field>
<name>class</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
<length>255</length>
</field>

<!-- id of the section, foreign key: admin_sections.id -->
<field>
<name>section</name>
<type>text</type>
<default></default>
<notnull>false</notnull>
<length>64</length>
</field>

<field>
<name>priority</name>
<type>integer</type>
<default></default>
<notnull>true</notnull>
<length>1</length>
</field>

<index>
<name>admin_sections_id_index</name>
<unique>true</unique>
<field>
<name>id</name>
<sorting>ascending</sorting>
</field>
</index>

</declaration>
</table>

</database>
1 change: 1 addition & 0 deletions lib/private/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public static function installApp( $data = array()) {
}

\OC_App::setupBackgroundJobs($info['background-jobs']);
\OC::$server->getSettingsManager()->setupSettings($info['settings']);

//run appinfo/install.php
if((!isset($data['noinstall']) or $data['noinstall']==false)) {
Expand Down
18 changes: 18 additions & 0 deletions lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,17 @@ public function __construct($webRoot, \OC\Config $config) {

return $manager;
});
$this->registerService('SettingsManager', function(Server $c) {
$manager = new \OC\Settings\Manager(
$c->getLogger(),
$c->getDatabaseConnection(),
$c->getL10N('core'),
$c->getConfig(),
$c->getEncryptionManager(),
$c->getUserManager()
);
return $manager;
});
}

/**
Expand Down Expand Up @@ -1424,4 +1435,11 @@ public function getShareManager() {
public function getLDAPProvider() {
return $this->query('LDAPProvider');
}

/**
* @return \OCP\Settings\IManager
*/
public function getSettingsManager() {
return $this->query('SettingsManager');
}
}
Loading