Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configuration frontend #46

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
01730ca
👌 IMPROVE: bump dev version & NC 16 compatibility
violoncelloCH Mar 2, 2019
5f85d6f
📦 NEW: add dark icon for settings entry
violoncelloCH Mar 9, 2019
78e4d4e
📦 NEW: add necessary classes for settings entry
violoncelloCH Mar 9, 2019
cb92713
📦 NEW: add (Vue) template for settings entry
violoncelloCH Mar 9, 2019
793182c
📦 NEW: add npm / webpack / vue build config
violoncelloCH Mar 9, 2019
5dea76b
👌 IMPROVE: add npm commands to Makefile
violoncelloCH Mar 9, 2019
4665eb1
👌 IMPROVE: add build instructions to Readme
violoncelloCH Mar 9, 2019
24f6bbc
👌 IMPROVE: add node_modules/ and js/ to .gitignore
violoncelloCH Mar 9, 2019
5f4f17a
📦 NEW: pass actual config from config.php to vue
violoncelloCH Mar 11, 2019
71c6b86
📦 NEW: add a basic input form (table structure)
violoncelloCH Mar 11, 2019
8aa21ba
👌 IMPROVE: move settings section to 'Basic settings' instead of creat…
violoncelloCH Mar 11, 2019
1c368bc
👌 IMPROVE: layout and output format
violoncelloCH Mar 12, 2019
d7904a2
📦 NEW: add raw structure for API calls
violoncelloCH Mar 13, 2019
97641b9
🐛 FIX: syntax errors
violoncelloCH Mar 13, 2019
8a1c3ae
👌 IMPROVE: use separate components for the parts
violoncelloCH Mar 14, 2019
e4f9826
📦 NEW: add css and scss loader to webpack
violoncelloCH Mar 14, 2019
9abc146
📦 NEW: adding of new form rows (backends)
violoncelloCH Mar 14, 2019
458abb0
📦 NEW: deleting of form rows (backends)
violoncelloCH Mar 15, 2019
6ce584b
🐛 FIX: delting of form rows
violoncelloCH Mar 15, 2019
7729654
📦 NEW: draft delete api request
violoncelloCH Mar 15, 2019
24c7fc6
👌 IMPROVE: bump version and add myself as an author to info.xml
violoncelloCH Mar 15, 2019
9d3ec5b
👌 IMPROVE: pass deletions to backend and delete it in config.php
violoncelloCH Mar 15, 2019
76223dc
📦 NEW: draft changing api request
violoncelloCH Mar 15, 2019
c914d9e
🐛 FIX: send changes to backend
violoncelloCH Mar 22, 2019
4641c13
Revert "🐛 FIX: send changes to backend"
violoncelloCH Mar 29, 2019
cd24c0b
🐛 FIX: adding new backends (arguments is an array, not a string)
violoncelloCH Mar 29, 2019
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ tests/clover.xml

# packaged app
build/artifacts

node_modules

js
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,33 @@ github_account=nextcloud
branch=master
version+=0.5.1

all: dev-setup build-js-production

dev-setup: clean clean-dev npm-init

npm-init:
npm install

npm-update:
npm update

build-js:
npm run dev

build-js-production:
npm run build

watch-js:
npm run watch

# Cleaning
clean:
rm -rf $(build_dir)
rm -f js/user-external.js
rm -f js/user-external.js.map

clean-dev:
rm -rf node_modules

# releasing to github
release: appstore github-release github-upload
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,23 @@ Other extensions allow connecting to external user databases directly via SQL, w

* [user_sql](https://github.com/nextcloud/user_sql)
* [user_backend_sql_raw](https://github.com/PanCakeConnaisseur/user_backend_sql_raw)


## Build Setup

``` bash
# install dependencies
make dev-setup

# build for development
make build-js

# build for development and watch edits
make watch-js

# build for production with minification
make build-js-production

# clean output files
make clean
```
10 changes: 8 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
<name>External user support</name>
<summary>Use external user authentication methods like IMAP, SMB and FTP</summary>
<description>Use external user authentication methods like IMAP, SMB and FTP</description>
<version>0.5.1</version>
<version>0.7.0-dev</version>
<licence>agpl</licence>
<author>Robin Appelman</author>
<author homepage="https://violoncello.ch">Jonas Sulzer</author>
<namespace>user_external</namespace>
<types>
<prelogin/>
<authentication/>
Expand All @@ -21,6 +23,10 @@
<bugs>https://github.com/nextcloud/user_external/issues</bugs>
<repository type="git">https://github.com/nextcloud/user_external.git</repository>
<dependencies>
<nextcloud min-version="15" max-version="15" />
<nextcloud min-version="15" max-version="16" />
</dependencies>
<settings>
<admin>OCA\user_external\Settings\Admin</admin>
<admin-section>OCA\user_external\Settings\Section</admin-section>
</settings>
</info>
36 changes: 36 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* @copyright Copyright (c) 2019 Jonas Sulzer <jonas@violoncello.ch>
*
* @author Jonas Sulzer <jonas@violoncello.ch>
*
* @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/>.
*
*/
return [
'routes' => [
[
'name' => 'Config#getConfig',
'url' => '/api/v1/config',
'verb' => 'GET',
],
[
'name' => 'Config#setConfig',
'url' => '/api/v1/config',
'verb' => 'PUT',
],
],
];
10 changes: 10 additions & 0 deletions css/user-external.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#userExternal td > input,
#userExternal td > span > input,
#userExternal td > select {
width: 100%;
}

#centertext {
display: inline-flex;
align-items: center;
}
5 changes: 5 additions & 0 deletions img/app-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions lib/Controller/ConfigController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php
declare (strict_types = 1);
/**
* @copyright Copyright (c) 2019 Jonas Sulzer (violoncelloCH) <jonas@violoncello.ch>
*
* @author Jonas Sulzer <jonas@violoncello.ch>
*
* @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_external\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Controller;
use OCP\IConfig;
use OCP\IRequest;
class ConfigController extends Controller {
/** @var string */
protected $appName;
/** @var string */
protected $userId;
/** @var string */
protected $serverRoot;
/** @var IConfig */
private $config;
/**
* Config constructor.
*
* @param string $appName
* @param IRequest $request
* @param IConfig $config
*/
public function __construct(string $appName,
IRequest $request,
IConfig $config) {
parent::__construct($appName, $request);
$this->appName = $appName;
$this->config = $config;
}
/**
* Get user_external config
*
* @return JSONResponse
*/
public function getConfig(): JSONResponse {
return new JSONResponse([
'user_backends' => $this->config->getSystemValue(user_backends)
]);
}
/**
* Set user_external config
*
* @param array $config
* @return JSONResponse
* @throws Exception
*/
public function setConfig(array $config): JSONResponse {
$this->config->setSystemValue('user_backends', $config);

return new JSONResponse([
null
]);

}
}
75 changes: 75 additions & 0 deletions lib/Settings/Admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
/**
* @copyright Copyright (c) 2019 Jonas Sulzer <jonas@violoncello.ch>
*
* @author Jonas Sulzer <jonas@violoncello.ch>
*
* @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_external\Settings;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Defaults;
use OCP\IConfig;
use OCP\IL10N;
use OCP\Settings\ISettings;
class Admin implements ISettings {
/** @var IL10N */
private $l10n;
/** @var Defaults */
private $defaults;
/** @var IConfig */
private $config;
/**
* @param IL10N $l10n
* @param Defaults $defaults
* @param IConfig $config
*/
public function __construct(IL10N $l10n,
Defaults $defaults,
IConfig $config) {
$this->l10n = $l10n;
$this->defaults = $defaults;
$this->config = $config;
}
/**
* @return TemplateResponse
*/
public function getForm() {

$serverData = [
'user_backends' => $this->config->getSystemValue(user_backends)
];

return new TemplateResponse('user_external', 'admin', ['serverData' => $serverData]);
}
/**
* @return string the section ID, e.g. 'sharing'
*/
public function getSection() {
return 'server';
}
/**
* @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.
*
* keep the server setting at the top, right after "server settings"
*/
public function getPriority() {
return 20;
}
}
Loading