├── img ├── app.png ├── search.svg ├── app.svg └── app_dark.svg ├── .eslintrc.js ├── screenshots └── main.jpg ├── .gitignore ├── templates ├── main.php ├── settings-personal.php └── settings.php ├── appinfo ├── app.php ├── routes.php └── info.xml ├── webpack.prod.js ├── webpack.dev.js ├── lib ├── Exceptions │ ├── LdapEntityUnknownException.php │ └── LdapEntityNotFoundException.php ├── LDAP │ ├── LdapWrite.php │ ├── LdapGroup.php │ ├── LdapUser.php │ ├── LdapEntity.php │ └── EntityFactory.php ├── Settings │ ├── Admin.php │ ├── Personal.php │ └── PersonalSection.php ├── AppInfo │ └── Application.php ├── Migration │ └── Settings.php └── Controller │ ├── StatisticController.php │ ├── SettingsController.php │ └── ContactController.php ├── .babelrc.js ├── css ├── statistics.scss ├── style.scss └── settings.scss ├── src ├── main.js ├── settings.js ├── settingsPersonal.js ├── statistics.js ├── SettingsPersonal.vue ├── Statistics.vue ├── components │ └── ContactDetails.vue ├── Main.vue └── Settings.vue ├── README.md ├── .stylelintrc.js ├── webpack.common.js ├── package.json ├── l10n ├── ru_RU.json ├── ru_RU.js ├── de.json ├── de_DE.json ├── de.js └── de_DE.js ├── Makefile └── LICENSE /img/app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KircheNeuenburg/ldapcontacts/HEAD/img/app.png -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: [ 3 | '@nextcloud' 4 | ] 5 | }; 6 | -------------------------------------------------------------------------------- /screenshots/main.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KircheNeuenburg/ldapcontacts/HEAD/screenshots/main.jpg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | node_modules 3 | js/ldapcontacts_*.js 4 | js/ldapcontacts_*.js.* 5 | core 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /templates/main.php: -------------------------------------------------------------------------------- 1 | 7 | 8 |
9 | -------------------------------------------------------------------------------- /templates/settings-personal.php: -------------------------------------------------------------------------------- 1 | 5 | 6 |
7 | -------------------------------------------------------------------------------- /appinfo/app.php: -------------------------------------------------------------------------------- 1 | getAppManager()->isInstalled('user_ldap')) { 5 | $app = new Application(); 6 | $app->registerNavigation(); 7 | } 8 | -------------------------------------------------------------------------------- /webpack.prod.js: -------------------------------------------------------------------------------- 1 | const { merge } = require('webpack-merge'); 2 | const common = require('./webpack.common.js'); 3 | 4 | module.exports = merge(common, { 5 | mode: 'production', 6 | devtool: 'source-map' 7 | }) 8 | -------------------------------------------------------------------------------- /webpack.dev.js: -------------------------------------------------------------------------------- 1 | const { merge } = require('webpack-merge'); 2 | const common = require('./webpack.common.js'); 3 | 4 | module.exports = merge(common, { 5 | mode: 'development', 6 | devtool: 'cheap-source-map', 7 | }) 8 | -------------------------------------------------------------------------------- /lib/Exceptions/LdapEntityUnknownException.php: -------------------------------------------------------------------------------- 1 | = 11'] 9 | } 10 | } 11 | ] 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /templates/settings.php: -------------------------------------------------------------------------------- 1 | 7 | 8 |
9 |
10 | -------------------------------------------------------------------------------- /css/statistics.scss: -------------------------------------------------------------------------------- 1 | #ldapcontacts_statistics { 2 | .icon-loading { 3 | min-height: 50px; 4 | } 5 | 6 | .stat { 7 | width: 49%; 8 | display: inline-block; 9 | 10 | .total, .title { 11 | text-align: center; 12 | font-weight: bold; 13 | } 14 | 15 | @media (max-width: 769px) { 16 | width: 100%; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import { translate, translatePlural } from '@nextcloud/l10n' 3 | import { generateUrl } from '@nextcloud/router' 4 | import Main from './Main' 5 | 6 | require('../css/style.scss') 7 | 8 | Vue.prototype.generateUrl = generateUrl 9 | Vue.prototype.t = translate 10 | Vue.prototype.n = translatePlural 11 | 12 | export default new Vue({ 13 | el: '#app', 14 | render: h => h(Main), 15 | }) 16 | -------------------------------------------------------------------------------- /src/settings.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import { translate, translatePlural } from '@nextcloud/l10n' 3 | import { generateUrl } from '@nextcloud/router' 4 | import Settings from './Settings' 5 | 6 | require('../css/settings.scss') 7 | 8 | Vue.prototype.generateUrl = generateUrl 9 | Vue.prototype.t = translate 10 | Vue.prototype.n = translatePlural 11 | 12 | export default new Vue({ 13 | el: '#ldapcontacts_settings', 14 | render: h => h(Settings), 15 | }) 16 | -------------------------------------------------------------------------------- /src/settingsPersonal.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import { translate, translatePlural } from '@nextcloud/l10n' 3 | import { generateUrl } from '@nextcloud/router' 4 | 5 | import SettingsPersonal from './SettingsPersonal' 6 | 7 | Vue.prototype.generateUrl = generateUrl 8 | Vue.prototype.t = translate 9 | Vue.prototype.n = translatePlural 10 | 11 | export default new Vue({ 12 | el: '#ldapcontacts_settings-personal', 13 | render: h => h(SettingsPersonal), 14 | }) 15 | -------------------------------------------------------------------------------- /src/statistics.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import { translate, translatePlural } from '@nextcloud/l10n' 3 | import { generateUrl } from '@nextcloud/router' 4 | import Statistics from './Statistics' 5 | 6 | require('../css/statistics.scss') 7 | 8 | Vue.prototype.generateUrl = generateUrl 9 | Vue.prototype.t = translate 10 | Vue.prototype.n = translatePlural 11 | 12 | export default new Vue({ 13 | el: '#ldapcontacts_statistics', 14 | render: h => h(Statistics), 15 | }) 16 | -------------------------------------------------------------------------------- /lib/LDAP/LdapWrite.php: -------------------------------------------------------------------------------- 1 | invokeLDAPMethod('mod_replace', $link, $entityDN, $attributes); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LdapContacts 2 | View other LDAP users as contacts in Nextcloud and see the personal data they shared. 3 | 4 | ### Features 5 | * view all LDAP users as contacts 6 | * search these users 7 | * restrict your search to certain LDAP groups 8 | * hide certain users and groups from the contacts app 9 | * define which LDAP attributes are available for your contacts 10 | 11 | ### Requirements 12 | * active LDAP authentification (check [Nextcloud admin manual](https://docs.nextcloud.com/server/latest/admin_manual/configuration_user/user_auth_ldap.html) for details) 13 | * php 7.0 14 | -------------------------------------------------------------------------------- /.stylelintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: 'stylelint-config-recommended-scss', 3 | rules: { 4 | indentation: 'tab', 5 | 'selector-type-no-unknown': null, 6 | 'number-leading-zero': null, 7 | 'rule-empty-line-before': [ 8 | 'always', 9 | { 10 | ignore: ['after-comment', 'inside-block'] 11 | } 12 | ], 13 | 'declaration-empty-line-before': [ 14 | 'never', 15 | { 16 | ignore: ['after-declaration'] 17 | } 18 | ], 19 | 'comment-empty-line-before': null, 20 | 'selector-type-case': null, 21 | 'selector-list-comma-newline-after': null, 22 | 'no-descending-specificity': null, 23 | 'string-quotes': 'single' 24 | }, 25 | plugins: ['stylelint-scss'] 26 | } 27 | -------------------------------------------------------------------------------- /img/search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /lib/Settings/Admin.php: -------------------------------------------------------------------------------- 1 | l10n = $l10n; 23 | $this->urlGenerator = $urlGenerator; 24 | $this->appName = $AppName; 25 | } 26 | 27 | /** 28 | * {@inheritdoc} 29 | */ 30 | public function getID() { 31 | return 'contacts'; 32 | } 33 | 34 | /** 35 | * {@inheritdoc} 36 | */ 37 | public function getName() { 38 | return $this->l10n->t( 'Contacts' ); 39 | } 40 | 41 | /** 42 | * {@inheritdoc} 43 | */ 44 | public function getPriority() { 45 | return 10; 46 | } 47 | 48 | /** 49 | * {@inheritdoc} 50 | */ 51 | public function getIcon() { 52 | return $this->urlGenerator->imagePath( $this->appName, 'app_dark.svg' ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /appinfo/routes.php: -------------------------------------------------------------------------------- 1 | [ 5 | [ 'name' => 'contact#index', 'url' => '/', 'verb' => 'GET' ], 6 | [ 'name' => 'contact#users', 'url' => '/load', 'verb' => 'GET' ], 7 | [ 'name' => 'contact#hiddenUsers', 'url' => '/load/hidden', 'verb' => 'GET' ], 8 | [ 'name' => 'contact#show', 'url' => '/own', 'verb' => 'GET' ], 9 | [ 'name' => 'contact#update', 'url' => '/own', 'verb' => 'POST' ], 10 | [ 'name' => 'contact#groups', 'url' => '/groups', 'verb' => 'GET' ], 11 | [ 'name' => 'contact#hiddenGroups', 'url' => '/groups/hidden', 'verb' => 'GET' ], 12 | [ 'name' => 'contact#showEntity', 'url' => '/admin/show/{type}/{uuid}', 'verb' => 'GET' ], 13 | [ 'name' => 'contact#hideEntity', 'url' => '/admin/hide/{type}/{uuid}', 'verb' => 'GET' ], 14 | 15 | [ 'name' => 'statistic#get', 'url' => '/statistics', 'verb' => 'GET' ], 16 | 17 | [ 'name' => 'settings#setUserValue', 'url' => '/settings/personal', 'verb' => 'POST' ], 18 | [ 'name' => 'settings#getUserValue', 'url' => '/settings/personal/{key}', 'verb' => 'GET' ], 19 | 20 | [ 'name' => 'settings#updateSettings', 'url' => '/settings/update', 'verb' => 'POST' ], 21 | [ 'name' => 'settings#getSettings', 'url' => '/settings', 'verb' => 'GET' ] 22 | ] 23 | ]; 24 | -------------------------------------------------------------------------------- /lib/AppInfo/Application.php: -------------------------------------------------------------------------------- 1 | getContainer(); 19 | 20 | $container->query( 'OCP\INavigationManager' )->add( function() use ( $container ) { 21 | $urlGenerator = $container->query( 'OCP\IURLGenerator' ); 22 | $l10n = $container->query( 'OCP\IL10N' ); 23 | return [ 24 | // the string under which your app will be referenced in owncloud 25 | 'id' => 'ldapcontacts', 26 | 27 | // sorting weight for the navigation. The higher the number, the higher 28 | // will it be listed in the navigation 29 | 'order' => 100, 30 | 31 | // the route that will be shown on startup 32 | 'href' => $urlGenerator->linkToRoute( 'ldapcontacts.contact.index' ), 33 | 34 | // the icon that will be shown in the navigation 35 | // this file needs to exist in img/ 36 | 'icon' => $urlGenerator->imagePath( 'ldapcontacts', 'app.svg' ), 37 | 38 | // the title of your application. This will be used in the 39 | // navigation or on the settings page of your app 40 | 'name' => $l10n->t( 'Contacts' ), 41 | ]; 42 | }); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/Migration/Settings.php: -------------------------------------------------------------------------------- 1 | appName = $AppName; 21 | $this->config = $config; 22 | } 23 | 24 | /** 25 | * Returns the step's name 26 | */ 27 | public function getName() { 28 | return 'Settings restructuring'; 29 | } 30 | 31 | /** 32 | * @param IOutput $output 33 | */ 34 | public function run(IOutput $output) { 35 | 36 | } 37 | 38 | /** 39 | * change layout of user ldap attributes 40 | */ 41 | private function convertUserLdapAttributes() { 42 | $oldAttributes = $this->config->getAppValue( $this->appName, 'user_ldap_attributes', false ); 43 | $newAttributes = []; 44 | // if no settings exists, there is nothing to be done here 45 | if ($oldAttributes === false) return; 46 | 47 | // convert to new format 48 | foreach ($oldAttributes as $name => $label) { 49 | $newAttributes[] = [ 50 | 'name' => $name, 51 | 'label' => $label 52 | ]; 53 | } 54 | 55 | // set converted attributes 56 | $this->config->setAppValue( $this->appName, 'userLdapAttributes', $newAttributes ); 57 | 58 | // remove old attribtues 59 | $this->config->deleteAppValue( $this->appName, 'user_ldap_attributes' ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /webpack.common.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const { VueLoaderPlugin } = require('vue-loader') 3 | const StyleLintPlugin = require('stylelint-webpack-plugin') 4 | const packageJson = require('./package.json') 5 | const appName = packageJson.name 6 | const ESLintPlugin = require('eslint-webpack-plugin') 7 | 8 | module.exports = { 9 | entry: { 10 | main: path.join(__dirname, 'src', 'main.js'), 11 | settingsPersonal: path.join(__dirname, 'src', 'settingsPersonal.js'), 12 | settings: path.join(__dirname, 'src', 'settings.js'), 13 | statistics: path.join(__dirname, 'src', 'statistics.js') 14 | }, 15 | output: { 16 | path: path.resolve(__dirname, './js'), 17 | publicPath: '/js/', 18 | filename: `${appName}_[name].js`, 19 | chunkFilename: 'chunks/[name]-[hash].js' 20 | }, 21 | module: { 22 | rules: [ 23 | { 24 | test: /\.css$/, 25 | use: ['vue-style-loader', 'css-loader'] 26 | }, 27 | { 28 | test: /\.scss$/, 29 | use: ['vue-style-loader', 'css-loader', 'sass-loader'] 30 | }, 31 | { 32 | test: /\.svg$/, 33 | use: ['ignore-loader'] 34 | }, 35 | { 36 | test: /\.vue$/, 37 | loader: 'vue-loader', 38 | exclude: /node_modules/ 39 | }, 40 | { 41 | test: /\.js$/, 42 | loader: 'babel-loader', 43 | exclude: [ /node_modules/, /\.min\.js$/ ] 44 | } 45 | ] 46 | }, 47 | plugins: [ 48 | new VueLoaderPlugin(), 49 | new StyleLintPlugin(), 50 | new ESLintPlugin({ 51 | extensions: ['js', 'vue'], 52 | exclude: [ 'node_modules', 'src/*.min.js' ], 53 | }) 54 | ], 55 | resolve: { 56 | extensions: ['*', '.js', '.vue'] 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/LDAP/LdapGroup.php: -------------------------------------------------------------------------------- 1 | server->connection->ldapGroupDisplayName ]; 10 | 11 | // merge all attributes 12 | $this->ldapAttributeKeys = array_unique( array_merge( $this->ldapAttributeKeys, $mandatoryAttributes ) ); 13 | } 14 | 15 | /** 16 | * fetch group specific ldap attributes from the server 17 | * 18 | * @return bool 19 | */ 20 | protected function loadLdapAttributeValues() { 21 | // fetch ladp attributes 22 | $groupList = $this->server->search($this->server->connection->ldapGroupFilter, $this->dn, $this->ldapAttributeKeys); 23 | if (empty($groupList)) return false; 24 | // turn the array values into single strings 25 | foreach ($groupList[0] as $attributeKey => $valueArray) { 26 | $composedValue = ''; 27 | foreach ($valueArray as $i => $value) { 28 | $composedValue .= $i ? "\n" : ''; 29 | $composedValue .= $value; 30 | } 31 | $this->ldapAttributeValues[ $attributeKey ] = $composedValue; 32 | } 33 | 34 | // get the groups name 35 | $this->title = $this->ldapAttributeValues[ $this->server->connection->ldapGroupDisplayName ]; 36 | 37 | // TODO: implement avatar 38 | return true; 39 | } 40 | 41 | /** 42 | * check if this group is hidden and save the result 43 | */ 44 | protected function updateIsHiddenAttribute() { 45 | $hiddenGroupIdList = $this->settings->getSetting('hiddenGroups', false); 46 | if ($hiddenGroupIdList === false) { 47 | // no users were hidden yet 48 | $this->hidden = false; 49 | return; 50 | } 51 | $this->hidden = in_array($this->uuid, $hiddenGroupIdList); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /appinfo/info.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ldapcontacts 4 | LDAP Contacts 5 | Display your LDAP contacts 6 | 19 | 20 | 2.0.5 21 | agpl 22 | Alexander Hornig 23 | LdapContacts 24 | tools 25 | https://github.com/KircheNeuenburg/ldapcontacts 26 | https://github.com/KircheNeuenburg/ldapcontacts/issues 27 | https://github.com/KircheNeuenburg/ldapcontacts.git 28 | https://raw.githubusercontent.com/KircheNeuenburg/ldapcontacts/master/screenshots/main.jpg 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | OCA\LdapContacts\Migration\Settings 38 | 39 | 40 | 41 | 42 | OCA\LdapContacts\Settings\Admin 43 | OCA\LdapContacts\Settings\Personal 44 | OCA\LdapContacts\Settings\PersonalSection 45 | 46 | 47 | -------------------------------------------------------------------------------- /css/style.scss: -------------------------------------------------------------------------------- 1 | /* messages */ 2 | .msg-container { 3 | margin-top: 30px; 4 | 5 | .msg { 6 | padding: 5px 10px; 7 | border-radius: var(--border-radius); 8 | font-weight: bold; 9 | color: #fff; 10 | margin-top: 8px; 11 | } 12 | 13 | .success { 14 | background-color: var(--color-success); 15 | } 16 | 17 | .warning { 18 | background-color: var(--color-warning); 19 | } 20 | 21 | .error { 22 | background-color: var(--color-error); 23 | } 24 | } 25 | /* end of messages */ 26 | 27 | /* content */ 28 | #content-vue { 29 | padding-top: 0; 30 | } 31 | 32 | #app-content-vue { 33 | padding: 30px; 34 | } 35 | 36 | .no-list-style { 37 | list-style: none; 38 | } 39 | 40 | table tr td:first-child { 41 | padding-right: 30px; 42 | font-weight: bold; 43 | } 44 | /* end of content */ 45 | 46 | /* navigation */ 47 | #navigation-header { 48 | border-bottom: 1px solid var(--color-border); 49 | 50 | .loading { 51 | min-height: 110px; 52 | } 53 | 54 | .search-container { 55 | position: relative; 56 | 57 | input { 58 | width: calc(100% - 24px); 59 | margin: 14px 12px; 60 | padding: 5px 25px; 61 | background: transparent url('../img/search.svg?v=1') no-repeat 5px center; 62 | } 63 | 64 | .abort { 65 | opacity: 0.5; 66 | transition: opacity 0.5s; 67 | background: transparent var(--icon-close-000) no-repeat center; 68 | background-size: auto; 69 | background-size: 100%; 70 | width: 20px; 71 | height: 20px; 72 | position: absolute; 73 | right: 16px; 74 | top: 20px; 75 | cursor: pointer; 76 | } 77 | 78 | .abort:focus, .abort:hover, .abort:active { 79 | opacity: 0.8; 80 | } 81 | } 82 | 83 | .select-group { 84 | width: calc(100% - 24px); 85 | margin: 0px 12px 14px; 86 | } 87 | } 88 | 89 | #app-navigation-vue > .icon-loading { 90 | min-height: 50px; 91 | } 92 | /* end of navigation */ 93 | 94 | /* content */ 95 | #contactDetails { 96 | input:disabled { 97 | background-color: var(--color-main-background); 98 | color: var(--color-main-text); 99 | opacity: 1; 100 | } 101 | } 102 | /* end of content */ 103 | 104 | /* editor */ 105 | #editContactDetails { 106 | input { 107 | min-width: 300px; 108 | } 109 | 110 | .save-button-wrapper { 111 | button { 112 | vertical-align: middle; 113 | } 114 | 115 | .icon-loading { 116 | width: 35px; 117 | height: 35px; 118 | display: inline-block; 119 | vertical-align: middle; 120 | } 121 | } 122 | } 123 | /* end of editor */ 124 | -------------------------------------------------------------------------------- /img/app.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /img/app_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ldapcontacts", 3 | "description": "Display your LDAP contacts", 4 | "version": "2.0.5", 5 | "author": "Alexander Hornig ", 6 | "contributors": [ 7 | "Alexander Hornig " 8 | ], 9 | "keywords": [ 10 | "nextcloud", 11 | "app", 12 | "dev", 13 | "vuejs" 14 | ], 15 | "bugs": { 16 | "url": "https://github.com/KircheNeuenburg/ldapcontacts/issues" 17 | }, 18 | "repository": { 19 | "url": "https://github.com/KircheNeuenburg/ldapcontacts", 20 | "type": "git" 21 | }, 22 | "homepage": "https://github.com/KircheNeuenburg/ldapcontacts", 23 | "license": "agpl", 24 | "private": true, 25 | "scripts": { 26 | "dev": "webpack --config webpack.dev.js", 27 | "watch": "webpack --progress --watch --config webpack.dev.js", 28 | "build": "webpack --progress --config webpack.prod.js", 29 | "lint": "eslint --ext .js,.vue src", 30 | "lint:fix": "eslint --ext .js,.vue src --fix", 31 | "stylelint": "stylelint src", 32 | "stylelint:fix": "stylelint src --fix" 33 | }, 34 | "dependencies": { 35 | "@nextcloud/l10n": "^1.4.1", 36 | "@nextcloud/router": "^2.0.0", 37 | "@nextcloud/vue": "^3.9.0", 38 | "axios": "^0.21.1", 39 | "jquery": "^3.6.0", 40 | "vue": "^2.6.12" 41 | }, 42 | "browserslist": [ 43 | "extends @nextcloud/browserslist-config" 44 | ], 45 | "engines": { 46 | "node": ">=10.0.0" 47 | }, 48 | "devDependencies": { 49 | "@babel/core": "^7.13.16", 50 | "@babel/eslint-parser": "^7.13.14", 51 | "@babel/plugin-syntax-dynamic-import": "^7.8.3", 52 | "@babel/preset-env": "^7.13.15", 53 | "@nextcloud/browserslist-config": "^2.1.0", 54 | "@nextcloud/eslint-config": "^5.0.0", 55 | "@nextcloud/eslint-plugin": "^2.0.0", 56 | "@vue/test-utils": "^1.1.4", 57 | "babel-eslint": "^10.0.3", 58 | "babel-loader": "^8.2.2", 59 | "css-loader": "^5.2.4", 60 | "eslint": "^7.24.0", 61 | "eslint-config-standard": "^16.0.1", 62 | "eslint-import-resolver-webpack": "^0.13.0", 63 | "eslint-plugin-import": "^2.22.1", 64 | "eslint-plugin-node": "^11.1.0", 65 | "eslint-plugin-promise": "^5.1.0", 66 | "eslint-plugin-vue": "^7.9.0", 67 | "eslint-webpack-plugin": "^2.5.4", 68 | "fibers": "^5.0.0", 69 | "ignore-loader": "^0.1.2", 70 | "node-sass": "^5.0.0", 71 | "sass": "^1.32.11", 72 | "sass-loader": "^11.0.1", 73 | "stylelint": "^13.12.0", 74 | "stylelint-config-recommended-scss": "^4.2.0", 75 | "stylelint-scss": "^3.19.0", 76 | "stylelint-webpack-plugin": "^2.1.1", 77 | "vue-loader": "^15.9.6", 78 | "vue-style-loader": "^4.1.3", 79 | "vue-template-compiler": "^2.6.12", 80 | "webpack": "^5.35.0", 81 | "webpack-cli": "^4.6.0", 82 | "webpack-merge": "^5.7.3", 83 | "webpack-node-externals": "^3.0.0" 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /l10n/ru_RU.json: -------------------------------------------------------------------------------- 1 | { "translations": { 2 | "Contacts" : "Контакты", 3 | "Your own data couldn't be fetched" : "Ваши собственные данные не могут быть получены", 4 | "Your data has successfully been saved" : "Данные успешно сохранены", 5 | "Something went wrong while saving your data" : "В процессе сохранения данных произошла ошибка", 6 | "Mail" : "E-mail", 7 | "First Name" : "Имя", 8 | "Last Name" : "Фамилия", 9 | "Address" : "Адрес", 10 | "zip Code" : "Индекс", 11 | "City" : "Город", 12 | "Phone" : "Телефон", 13 | "Mobile" : "Мобильный", 14 | "Settings saved" : "Настройки сохранены", 15 | "Something went wrong while saving the settings. Please try again." : "В процессе сохранения настроек произошла ошибка. Попробуйте снова.", 16 | "All" : "Все", 17 | "Copy to clipboard" : "Скопировать в буфер обмена", 18 | "Groups" : "Группы", 19 | "Save" : "Сохранить", 20 | "Order Contacts by:" : "Упорядочить контакты по:", 21 | "LDAP Contacts" : "LDAP Контакты", 22 | "Define LDAP attributes the users can see and edit" : "Укажите атрибуты LDAP, которые пользователи смогут видеть и редактировать", 23 | "LDAP Attribute" : "LDAP атрибут", 24 | "LDAP Attributes" : "LDAP атрибуты", 25 | "Label" : "Заголовок", 26 | "Add Attribute" : "Добавить атрибут", 27 | "Delete" : "Удалить", 28 | "Save Attributes" : "Сохранить атрибуты", 29 | "Hide User" : "Скрыть пользователя", 30 | "Hide Group" : "Скрыть группу", 31 | "Hidden Users" : "Скрытые пользователи", 32 | "Hidden Groups" : "Скрытые группы", 33 | "No users are hidden" : "Нет скрытых пользователей", 34 | "No groups are hidden" : "Нет скрытых групп", 35 | "Total:" : "Всего:", 36 | "Entries" : "Данные", 37 | "Filled" : "Заполнено", 38 | "Empty" : "Пустые", 39 | "Users" : "Пользователи", 40 | "Users with some filled entries" : "Пользователи с некоторыми заполнеными данными", 41 | "Users with only empty entries" : "Пользователи только с пустыми данными ", 42 | "Entries filled" : "Данных заполнено", 43 | "Users with filled entries" : "Пользователи с заполненными данными", 44 | "Edit own contact details" : "Редактировать свои контактные данные", 45 | "Search Users" : "Поиск пользователей", 46 | "An error occured, please try again later" : "Произошла ошибка. Пожалуйста, повторите попытку позже ", 47 | "Unknown entity type" : "Неизвестный тип объекта", 48 | "Entity not found" : "Объект не найден", 49 | "Group is now visible again" : "Группа снова видна", 50 | "An error occured while making the group visible again" : "Произошла ошибка во время пометки группы снова видимой", 51 | "Group is now hidden" : "Группа скрыта", 52 | "An error occured while hiding the group" : "Произошла ошибка во время пометки группы скрытой", 53 | "Select a contact from the left to see details" : "Выберите контакт слева, чтобы увидеть подробности" 54 | },"pluralForm" :"nplurals=2; plural=(n != 1);" 55 | } 56 | -------------------------------------------------------------------------------- /l10n/ru_RU.js: -------------------------------------------------------------------------------- 1 | OC.L10N.register( 2 | "ldapcontacts", 3 | { 4 | "Contacts" : "Контакты", 5 | "Your own data couldn't be fetched" : "Ваши собственные данные не могут быть получены", 6 | "Your data has successfully been saved" : "Данные успешно сохранены", 7 | "Something went wrong while saving your data" : "В процессе сохранения данных произошла ошибка", 8 | "Mail" : "E-mail", 9 | "First Name" : "Имя", 10 | "Last Name" : "Фамилия", 11 | "Address" : "Адрес", 12 | "zip Code" : "Индекс", 13 | "City" : "Город", 14 | "Phone" : "Телефон", 15 | "Mobile" : "Мобильный", 16 | "Settings saved" : "Настройки сохранены", 17 | "Something went wrong while saving the settings. Please try again." : "В процессе сохранения настроек произошла ошибка. Попробуйте снова.", 18 | "All" : "Все", 19 | "Copy to clipboard" : "Скопировать в буфер обмена", 20 | "Groups" : "Группы", 21 | "Save" : "Сохранить", 22 | "Order Contacts by:" : "Упорядочить контакты по:", 23 | "LDAP Contacts" : "LDAP Контакты", 24 | "Define LDAP attributes the users can see and edit" : "Укажите атрибуты LDAP, которые пользователи смогут видеть и редактировать", 25 | "LDAP Attribute" : "LDAP атрибут", 26 | "LDAP Attributes" : "LDAP атрибуты", 27 | "Label" : "Заголовок", 28 | "Add Attribute" : "Добавить атрибут", 29 | "Delete" : "Удалить", 30 | "Save Attributes" : "Сохранить атрибуты", 31 | "Hide User" : "Скрыть пользователя", 32 | "Hide Group" : "Скрыть группу", 33 | "Hidden Users" : "Скрытые пользователи", 34 | "Hidden Groups" : "Скрытые группы", 35 | "No users are hidden" : "Нет скрытых пользователей", 36 | "No groups are hidden" : "Нет скрытых групп", 37 | "Total:" : "Всего:", 38 | "Entries" : "Данные", 39 | "Filled" : "Заполнено", 40 | "Empty" : "Пустые", 41 | "Users" : "Пользователи", 42 | "Users with some filled entries" : "Пользователи с некоторыми заполнеными данными", 43 | "Users with only empty entries" : "Пользователи только с пустыми данными ", 44 | "Entries filled" : "Данных заполнено", 45 | "Users with filled entries" : "Пользователи с заполненными данными", 46 | "Edit own contact details" : "Редактировать свои контактные данные", 47 | "Search Users" : "Поиск пользователей", 48 | "An error occured, please try again later" : "Произошла ошибка. Пожалуйста, повторите попытку позже ", 49 | "Unknown entity type" : "Неизвестный тип объекта", 50 | "Entity not found" : "Объект не найден", 51 | "Group is now visible again" : "Группа снова видна", 52 | "An error occured while making the group visible again" : "Произошла ошибка во время пометки группы снова видимой", 53 | "Group is now hidden" : "Группа скрыта", 54 | "An error occured while hiding the group" : "Произошла ошибка во время пометки группы скрытой", 55 | "Select a contact from the left to see details" : "Выберите контакт слева, чтобы увидеть подробности" 56 | }, 57 | "nplurals=2; plural=(n != 1);"); 58 | -------------------------------------------------------------------------------- /l10n/de.json: -------------------------------------------------------------------------------- 1 | { "translations": { 2 | "Contacts" : "Kontakte", 3 | "Your own data couldn't be fetched" : "Deine eigenen Daten konnten nicht geladen werden", 4 | "Your data has successfully been saved" : "Deine Daten wurden erfolgreich gespeichert", 5 | "Something went wrong while saving your data" : "Beim speichern deiner Daten ist ein Fehler aufgetreten", 6 | "Mail" : "Mail Adresse", 7 | "First Name" : "Vorname", 8 | "Last Name" : "Nachname", 9 | "Address" : "Adresse", 10 | "zip Code" : "PLZ", 11 | "City" : "Stadt", 12 | "Phone" : "Telefon", 13 | "Mobile" : "Handy", 14 | "Settings saved" : "Einstellungen gespeichert", 15 | "Something went wrong while saving the settings. Please try again." : "Etwa ist beim Speichern der Einstellungen schief gelaufen. Bitte versuche es erneut.", 16 | "All" : "Alle", 17 | "Copy to clipboard" : "In Zwischenablage kopieren", 18 | "Groups" : "Gruppen", 19 | "Save" : "Speichern", 20 | "Order Contacts by:" : "Kontakte sortieren nach:", 21 | "LDAP Contacts" : "LDAP Kontakte", 22 | "Define LDAP attributes the users can see and edit" : "Definiere LDAP Attribute, die Benutzer sehen und bearbeiten k\u00f6nnen", 23 | "LDAP Attribute" : "LDAP Attribut", 24 | "LDAP Attributes" : "LDAP Attribute", 25 | "Label" : "Bezeichnung", 26 | "Add Attribute" : "Attribut hinzuf\u00fcgen", 27 | "Delete" : "Löschen", 28 | "Save Attributes" : "Attribute Löschen", 29 | "Hide User" : "Benutzer verstecken", 30 | "Hide Group" : "Gruppe verstecken", 31 | "Hidden Users" : "Versteckte Benutzer", 32 | "Hidden Groups" : "Versteckte Gruppen", 33 | "No users are hidden" : "Keine Benutzer versteckt", 34 | "No groups are hidden" : "Keine Gruppen versteckt", 35 | "Total:" : "Gesamt:", 36 | "Entries" : "Einträge", 37 | "Filled" : "Ausgefüllt", 38 | "Empty" : "Leer", 39 | "Users" : "Benutzer", 40 | "Users with some filled entries" : "Benutzer mit ein paar ausgefüllten Einträgen", 41 | "Users with only empty entries" : "Benutzer mit nur leeren Einträgen", 42 | "Entries filled" : "Ausgefüllte Einträge", 43 | "Users with filled entries" : "Benutzer mit ausgefüllten Einträgen", 44 | "Edit own contact details" : "Eigene Kontaktdaten bearbeiten", 45 | "Search Users" : "Benutzer Durchsuchen", 46 | "An error occured, please try again later" : "Es ist ein Fehler aufgetreten, versuche es später noch einmal", 47 | "Unknown entity type" : "Ungekannter Objekt Typ", 48 | "Entity not found" : "Object nicht gefunden", 49 | "Group is now visible again" : "Die Gruppe ist jetzt wieder sichtbar", 50 | "An error occured while making the group visible again" : "Beim Versuch die Gruppe wieder sichtbar zu machen ist ein Fehler aufgetreten", 51 | "Group is now hidden" : "Die Gruppe ist jetzt versteckt", 52 | "An error occured while hiding the group" : "Beim Verstecken der Gruppe ist ein Fehler aufgetreten", 53 | "Select a contact from the left to see details" : "W\u00e4hle links einen Kontakt, um Details zu sehen" 54 | },"pluralForm" :"nplurals=2; plural=(n != 1);" 55 | } 56 | -------------------------------------------------------------------------------- /l10n/de_DE.json: -------------------------------------------------------------------------------- 1 | { "translations": { 2 | "Contacts" : "Kontakte", 3 | "Your own data couldn't be fetched" : "Ihre eigenen Daten konnten nicht geladen werden", 4 | "Your data has successfully been saved" : "Ihre Daten wurden erfolgreich gespeichert", 5 | "Something went wrong while saving your data" : "Beim speichern Ihrer Daten ist ein Fehler aufgetreten", 6 | "Mail" : "Mail Adresse", 7 | "First Name" : "Vorname", 8 | "Last Name" : "Nachname", 9 | "Address" : "Adresse", 10 | "zip Code" : "PLZ", 11 | "City" : "Stadt", 12 | "Phone" : "Telefon", 13 | "Mobile" : "Handy", 14 | "Settings saved" : "Einstellungen gespeichert", 15 | "Something went wrong while saving the settings. Please try again." : "Etwa ist beim Speichern der Einstellungen schief gelaufen. Bitte versuchen Sie es erneut.", 16 | "All" : "Alle", 17 | "Copy to clipboard" : "In Zwischenablage kopieren", 18 | "Groups" : "Gruppen", 19 | "Save" : "Speichern", 20 | "Order Contacts by:" : "Kontakte sortieren nach:", 21 | "LDAP Contacts" : "LDAP Kontakte", 22 | "Define LDAP attributes the users can see and edit" : "Definiere LDAP Attribute, die Benutzer sehen und bearbeiten k\u00f6nnen", 23 | "LDAP Attribute" : "LDAP Attribut", 24 | "LDAP Attributes" : "LDAP Attribute", 25 | "Label" : "Bezeichnung", 26 | "Add Attribute" : "Attribut hinzuf\u00fcgen", 27 | "Delete" : "Löschen", 28 | "Save Attributes" : "Attribute Löschen", 29 | "Hide User" : "Benutzer verstecken", 30 | "Hide Group" : "Gruppe verstecken", 31 | "Hidden Users" : "Versteckte Benutzer", 32 | "Hidden Groups" : "Versteckte Gruppen", 33 | "No users are hidden" : "Keine Benutzer versteckt", 34 | "No groups are hidden" : "Keine Gruppen versteckt", 35 | "Total:" : "Gesamt:", 36 | "Entries" : "Einträge", 37 | "Filled" : "Ausgefüllt", 38 | "Empty" : "Leer", 39 | "Users" : "Benutzer", 40 | "Users with some filled entries" : "Benutzer mit ein paar ausgefüllten Einträgen", 41 | "Users with only empty entries" : "Benutzer mit nur leeren Einträgen", 42 | "Entries filled" : "Ausgefüllte Einträge", 43 | "Users with filled entries" : "Benutzer mit ausgefüllten Einträgen", 44 | "Edit own contact details" : "Eigene Kontaktdaten bearbeiten", 45 | "Search Users" : "Benutzer Durchsuchen", 46 | "An error occured, please try again later" : "Es ist ein Fehler aufgetreten, versuchen Sie es später noch einmal", 47 | "Unknown entity type" : "Ungekannter Objekt Typ", 48 | "Entity not found" : "Object nicht gefunden", 49 | "Group is now visible again" : "Die Gruppe ist jetzt wieder sichtbar", 50 | "An error occured while making the group visible again" : "Beim Versuch die Gruppe wieder sichtbar zu machen ist ein Fehler aufgetreten", 51 | "Group is now hidden" : "Die Gruppe ist jetzt versteckt", 52 | "An error occured while hiding the group" : "Beim Verstecken der Gruppe ist ein Fehler aufgetreten", 53 | "Select a contact from the left to see details" : "W\u00e4hlen Sie links einen Kontakt aus, um Details zu sehen" 54 | },"pluralForm" :"nplurals=2; plural=(n != 1);" 55 | } 56 | -------------------------------------------------------------------------------- /l10n/de.js: -------------------------------------------------------------------------------- 1 | OC.L10N.register( 2 | "ldapcontacts", 3 | { 4 | "Contacts" : "Kontakte", 5 | "Your own data couldn't be fetched" : "Deine eigenen Daten konnten nicht geladen werden", 6 | "Your data has successfully been saved" : "Deine Daten wurden erfolgreich gespeichert", 7 | "Something went wrong while saving your data" : "Beim speichern deiner Daten ist ein Fehler aufgetreten", 8 | "Mail" : "Mail Adresse", 9 | "First Name" : "Vorname", 10 | "Last Name" : "Nachname", 11 | "Address" : "Adresse", 12 | "zip Code" : "PLZ", 13 | "City" : "Stadt", 14 | "Phone" : "Telefon", 15 | "Mobile" : "Handy", 16 | "Settings saved" : "Einstellungen gespeichert", 17 | "Something went wrong while saving the settings. Please try again." : "Etwa ist beim Speichern der Einstellungen schief gelaufen. Bitte versuche es erneut.", 18 | "All" : "Alle", 19 | "Copy to clipboard" : "In Zwischenablage kopieren", 20 | "Groups" : "Gruppen", 21 | "Save" : "Speichern", 22 | "Order Contacts by:" : "Kontakte sortieren nach:", 23 | "LDAP Contacts" : "LDAP Kontakte", 24 | "Define LDAP attributes the users can see and edit" : "Definiere LDAP Attribute, die Benutzer sehen und bearbeiten k\u00f6nnen", 25 | "LDAP Attribute" : "LDAP Attribut", 26 | "LDAP Attributes" : "LDAP Attribute", 27 | "Label" : "Bezeichnung", 28 | "Add Attribute" : "Attribut hinzuf\u00fcgen", 29 | "Delete" : "Löschen", 30 | "Save Attributes" : "Attribute Löschen", 31 | "Hide User" : "Benutzer verstecken", 32 | "Hide Group" : "Gruppe verstecken", 33 | "Hidden Users" : "Versteckte Benutzer", 34 | "Hidden Groups" : "Versteckte Gruppen", 35 | "No users are hidden" : "Keine Benutzer versteckt", 36 | "No groups are hidden" : "Keine Gruppen versteckt", 37 | "Total:" : "Gesamt:", 38 | "Entries" : "Einträge", 39 | "Filled" : "Ausgefüllt", 40 | "Empty" : "Leer", 41 | "Users" : "Benutzer", 42 | "Users with some filled entries" : "Benutzer mit ein paar ausgefüllten Einträgen", 43 | "Users with only empty entries" : "Benutzer mit nur leeren Einträgen", 44 | "Entries filled" : "Ausgefüllte Einträge", 45 | "Users with filled entries" : "Benutzer mit ausgefüllten Einträgen", 46 | "Edit own contact details" : "Eigene Kontaktdaten bearbeiten", 47 | "Search Users" : "Benutzer Durchsuchen", 48 | "An error occured, please try again later" : "Es ist ein Fehler aufgetreten, versuche es später noch einmal", 49 | "Unknown entity type" : "Ungekannter Objekt Typ", 50 | "Entity not found" : "Object nicht gefunden", 51 | "Group is now visible again" : "Die Gruppe ist jetzt wieder sichtbar", 52 | "An error occured while making the group visible again" : "Beim Versuch die Gruppe wieder sichtbar zu machen ist ein Fehler aufgetreten", 53 | "Group is now hidden" : "Die Gruppe ist jetzt versteckt", 54 | "An error occured while hiding the group" : "Beim Verstecken der Gruppe ist ein Fehler aufgetreten", 55 | "Select a contact from the left to see details" : "W\u00e4hle links einen Kontakt, um Details zu sehen" 56 | }, 57 | "nplurals=2; plural=(n != 1);"); 58 | -------------------------------------------------------------------------------- /l10n/de_DE.js: -------------------------------------------------------------------------------- 1 | OC.L10N.register( 2 | "ldapcontacts", 3 | { 4 | "Contacts" : "Kontakte", 5 | "Your own data couldn't be fetched" : "Ihre eigenen Daten konnten nicht geladen werden", 6 | "Your data has successfully been saved" : "Ihre Daten wurden erfolgreich gespeichert", 7 | "Something went wrong while saving your data" : "Beim speichern Ihrer Daten ist ein Fehler aufgetreten", 8 | "Mail" : "Mail Adresse", 9 | "First Name" : "Vorname", 10 | "Last Name" : "Nachname", 11 | "Address" : "Adresse", 12 | "zip Code" : "PLZ", 13 | "City" : "Stadt", 14 | "Phone" : "Telefon", 15 | "Mobile" : "Handy", 16 | "Settings saved" : "Einstellungen gespeichert", 17 | "Something went wrong while saving the settings. Please try again." : "Etwa ist beim Speichern der Einstellungen schief gelaufen. Bitte versuchen Sie es erneut.", 18 | "All" : "Alle", 19 | "Copy to clipboard" : "In Zwischenablage kopieren", 20 | "Groups" : "Gruppen", 21 | "Save" : "Speichern", 22 | "Order Contacts by:" : "Kontakte sortieren nach:", 23 | "LDAP Contacts" : "LDAP Kontakte", 24 | "Define LDAP attributes the users can see and edit" : "Definiere LDAP Attribute, die Benutzer sehen und bearbeiten k\u00f6nnen", 25 | "LDAP Attribute" : "LDAP Attribut", 26 | "LDAP Attributes" : "LDAP Attribute", 27 | "Label" : "Bezeichnung", 28 | "Add Attribute" : "Attribut hinzuf\u00fcgen", 29 | "Delete" : "Löschen", 30 | "Save Attributes" : "Attribute Löschen", 31 | "Hide User" : "Benutzer verstecken", 32 | "Hide Group" : "Gruppe verstecken", 33 | "Hidden Users" : "Versteckte Benutzer", 34 | "Hidden Groups" : "Versteckte Gruppen", 35 | "No users are hidden" : "Keine Benutzer versteckt", 36 | "No groups are hidden" : "Keine Gruppen versteckt", 37 | "Total:" : "Gesamt:", 38 | "Entries" : "Einträge", 39 | "Filled" : "Ausgefüllt", 40 | "Empty" : "Leer", 41 | "Users" : "Benutzer", 42 | "Users with some filled entries" : "Benutzer mit ein paar ausgefüllten Einträgen", 43 | "Users with only empty entries" : "Benutzer mit nur leeren Einträgen", 44 | "Entries filled" : "Ausgefüllte Einträge", 45 | "Users with filled entries" : "Benutzer mit ausgefüllten Einträgen", 46 | "Edit own contact details" : "Eigene Kontaktdaten bearbeiten", 47 | "Search Users" : "Benutzer Durchsuchen", 48 | "An error occured, please try again later" : "Es ist ein Fehler aufgetreten, versuchen Sie es später noch einmal", 49 | "Unknown entity type" : "Ungekannter Objekt Typ", 50 | "Entity not found" : "Object nicht gefunden", 51 | "Group is now visible again" : "Die Gruppe ist jetzt wieder sichtbar", 52 | "An error occured while making the group visible again" : "Beim Versuch die Gruppe wieder sichtbar zu machen ist ein Fehler aufgetreten", 53 | "Group is now hidden" : "Die Gruppe ist jetzt versteckt", 54 | "An error occured while hiding the group" : "Beim Verstecken der Gruppe ist ein Fehler aufgetreten", 55 | "Select a contact from the left to see details" : "W\u00e4hlen Sie links einen Kontakt aus, um Details zu sehen" 56 | }, 57 | "nplurals=2; plural=(n != 1);"); 58 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | app_name=ldapcontacts 2 | 3 | project_dir=$(CURDIR)/../$(app_name) 4 | nextcloud_container=nc21-h-software-de_nextcloud 5 | docker_project_dir=/var/www/html/custom_apps/$(app_name) 6 | build_dir=$(CURDIR)/build/artifacts 7 | docker_build_dir=$(docker_project_dir)/build/artifacts 8 | sign_dir=$(build_dir)/sign 9 | docker_sign_dir=$(docker_build_dir)/sign 10 | package_name=$(app_name) 11 | cert_dir=$(HOME)/.nextcloud/certificates 12 | version=2.0.5 13 | 14 | 15 | all: dev-setup lint build-js-production test 16 | 17 | release: appstore 18 | 19 | # Dev env management 20 | dev-setup: clean clean-dev npm-init 21 | 22 | npm-init: 23 | npm install 24 | 25 | npm-update: 26 | npm update 27 | 28 | npm-upgrade: 29 | npm install -g npm-check-updates 30 | ncu -u 31 | 32 | # Building 33 | build-js: 34 | npm run dev 35 | 36 | build-js-production: 37 | npm run build 38 | 39 | watch-js: 40 | npm run watch 41 | 42 | # Testing 43 | test: 44 | npm run test 45 | 46 | test-watch: 47 | npm run test:watch 48 | 49 | test-coverage: 50 | npm run test:coverage 51 | 52 | # Linting 53 | lint: 54 | npm run lint 55 | 56 | lint-fix: 57 | npm run lint:fix 58 | 59 | # Style linting 60 | stylelint: 61 | npm run stylelint 62 | 63 | stylelint-fix: 64 | npm run stylelint:fix 65 | 66 | # Cleaning 67 | clean: 68 | rm -f js/$(app_name)_*.js 69 | rm -f js/$(app_name)_*.js.map 70 | 71 | clean-dev: 72 | rm -rf node_modules 73 | 74 | create-tag: 75 | git tag -a v$(version) -m "Tagging the $(version) release." 76 | git push origin v$(version) 77 | 78 | check-code: 79 | docker exec -it -u 33 $(nextcloud_container) php ./occ app:check-code $(app_name) 80 | 81 | appstore: npm-init build-js-production check-code 82 | rm -rf $(build_dir) 83 | mkdir -p $(sign_dir) 84 | rsync -a \ 85 | --exclude=.git \ 86 | --exclude=build \ 87 | --exclude=node_modules \ 88 | --exclude=.babelrc.js \ 89 | --exclude=.eslintrc.js \ 90 | --exclude=.gitignore \ 91 | --exclude=.stylelintrc.js \ 92 | --exclude=Makefile \ 93 | --exclude=package.json \ 94 | --exclude=package-lock.json \ 95 | --exclude=webpack.common.js \ 96 | --exclude=webpack.dev.js \ 97 | --exclude=webpack.prod.js \ 98 | --exclude=js/**.js.* \ 99 | --exclude=README.md \ 100 | --exclude=src \ 101 | $(project_dir)/ $(sign_dir)/$(app_name) 102 | @if [ -f $(cert_dir)/$(app_name).key ]; then \ 103 | echo "Signing app files…"; \ 104 | mkdir -p certs; \ 105 | cp -r $(cert_dir)/$(app_name).* certs; \ 106 | docker exec -it -u 33 $(nextcloud_container) php ./occ integrity:sign-app \ 107 | --privateKey=$(docker_project_dir)/certs/$(app_name).key\ 108 | --certificate=$(docker_project_dir)/certs/$(app_name).crt\ 109 | --path=$(docker_sign_dir)/$(app_name); \ 110 | rm -r certs; \ 111 | fi 112 | tar -czf $(build_dir)/$(app_name)-$(version).tar.gz \ 113 | -C $(sign_dir) $(app_name) 114 | @if [ -f $(cert_dir)/$(app_name).key ]; then \ 115 | echo "Signing package…"; \ 116 | openssl dgst -sha512 -sign $(cert_dir)/$(app_name).key $(build_dir)/$(app_name)-$(version).tar.gz | openssl base64; \ 117 | fi 118 | -------------------------------------------------------------------------------- /src/SettingsPersonal.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 125 | -------------------------------------------------------------------------------- /css/settings.scss: -------------------------------------------------------------------------------- 1 | #ldapcontacts-settings { 2 | /* general */ 3 | .no-list-style { 4 | list-style: none; 5 | } 6 | 7 | .container{ 8 | margin-top: 10px; 9 | padding: 5px; 10 | border: 1px solid grey; 11 | border-radius: 10px; 12 | } 13 | /* end of general */ 14 | 15 | /* buttons */ 16 | .standalone button.action-button { 17 | background-color: #c8c8c8; 18 | border-radius: 7px; 19 | } 20 | 21 | .save-button-wrapper { 22 | button { 23 | vertical-align: middle; 24 | } 25 | 26 | .icon-loading { 27 | width: 35px; 28 | height: 35px; 29 | display: inline-block; 30 | vertical-align: middle; 31 | } 32 | } 33 | /* end of buttons */ 34 | 35 | /* messages */ 36 | .msg-container { 37 | margin-top: 30px; 38 | 39 | .msg { 40 | padding: 5px 10px; 41 | border-radius: var(--border-radius); 42 | font-weight: bold; 43 | color: #fff; 44 | margin-top: 8px; 45 | } 46 | 47 | .success { 48 | background-color: var(--color-success); 49 | } 50 | 51 | .warning { 52 | background-color: var(--color-warning); 53 | } 54 | 55 | .error { 56 | background-color: var(--color-error); 57 | } 58 | } 59 | /* end of messages */ 60 | 61 | /* search */ 62 | .search-container { 63 | position: relative; 64 | 65 | .search { 66 | position: relative; 67 | } 68 | 69 | .search-suggestions { 70 | display: inline-block; 71 | position: absolute; 72 | top: 32px; 73 | left: 2px; 74 | z-index: 2; 75 | } 76 | 77 | .search-suggestions > .suggestion { 78 | z-index: 2; 79 | cursor: pointer; 80 | background-color: rgba(240, 240, 240, 1); 81 | padding: 3px 10px; 82 | } 83 | 84 | .search-suggestions > .suggestion:focus, .search-suggestions > .suggestion:hover, .search-suggestions > .suggestion:active { 85 | background-color: rgba(201, 201, 201, 1); 86 | } 87 | 88 | .search-suggestions > .suggestion:last-child { 89 | border-radius: 0 0 4px 4px; 90 | } 91 | 92 | input[type='search'] { 93 | background: transparent url('../img/search.svg?v=1') no-repeat 5px center; 94 | padding: 5px 25px; 95 | transition: width 0.5s; 96 | min-width: 250px; 97 | } 98 | 99 | input[type='search'] + .abort { 100 | opacity: 0; 101 | transition: opacity 0.5s; 102 | // background: transparent url('../img/remove.svg?v=1') no-repeat center; 103 | background-size: 100%; 104 | width: 0; 105 | height: 20px; 106 | position: absolute; 107 | top: 18px; 108 | right: 12px; 109 | } 110 | 111 | input[type='search'].searching + .abort { 112 | opacity: 0.5; 113 | width: 20px; 114 | cursor: pointer; 115 | margin-top: -20px; 116 | } 117 | 118 | input[type='search'].searching + .abort:hover, input[type='search'].searching + .abort:focus, input[type='search'].searching + .abort:active { 119 | opacity: 0.8; 120 | } 121 | 122 | .search-suggestion-container { 123 | position: absolute; 124 | border-top: 1px solid var(--color-box-shadow); 125 | margin-top: -3px; 126 | 127 | .suggestion { 128 | transition: background-color 0.3s; 129 | background-color: var(--color-background-dark); 130 | padding: 2px 3px; 131 | border-bottom: 1px solid var(--color-box-shadow); 132 | cursor: pointer; 133 | min-width: 200px; 134 | } 135 | 136 | .suggestion:focus, .suggestion:hover, .suggestion:active { 137 | background-color: var(--color-background-darker); 138 | } 139 | } 140 | } 141 | /* end of search */ 142 | 143 | /* hidden entities */ 144 | .hidden-entity { 145 | display: inline-block; 146 | margin: 5px; 147 | background-color: rgba(240, 240, 240, 0.9); 148 | line-height: 18px; 149 | } 150 | 151 | .hidden-entity > * { 152 | display: inline-block; 153 | height: 23px; 154 | padding: 1px 7px 0; 155 | } 156 | 157 | .hidden-entity > .name { 158 | display: inline-block; 159 | } 160 | 161 | .hidden-entity > .remove { 162 | border-left: 1px solid grey; 163 | font-weight: bold; 164 | z-index: 10; 165 | cursor: pointer; 166 | border-radius: 0 5px 5px 0; 167 | } 168 | 169 | .hidden-entity > .remove:focus, .hidden-entity > .remove:hover, .hidden-entity > .remove:active { 170 | background-color: rgba(201, 201, 201, 1); 171 | } 172 | /* end of hidden entities */ 173 | } 174 | -------------------------------------------------------------------------------- /src/Statistics.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 152 | -------------------------------------------------------------------------------- /lib/LDAP/LdapUser.php: -------------------------------------------------------------------------------- 1 | groupPluginManager = $groupPluginManager; 35 | } 36 | 37 | /** 38 | * load user specific ldap attribute keys 39 | */ 40 | protected function loadLdapAttributeKeys() { 41 | $mandatoryAttributes = [ $this->server->connection->ldapUserDisplayName, $this->server->connection->ldapUserDisplayName2 ]; 42 | // add attributes defined by the admin 43 | $additionalDefinedAttributes = $this->settings->getSetting('userLdapAttributes', false); 44 | foreach ($additionalDefinedAttributes as $attribute) { 45 | $mandatoryAttributes[] = $attribute['name']; 46 | } 47 | 48 | // merge all attributes 49 | $this->ldapAttributeKeys = array_unique( array_merge( $this->ldapAttributeKeys, $mandatoryAttributes ) ); 50 | 51 | // remove empty attributes 52 | $this->ldapAttributeKeys = array_values( array_filter( $this->ldapAttributeKeys, function($value) { return !is_null($value) && $value !== ''; } ) ); 53 | } 54 | 55 | /** 56 | * fetch user specific ldap attributes from the server 57 | * 58 | * @return bool 59 | */ 60 | protected function loadLdapAttributeValues() { 61 | // fetch ladp attributes 62 | $userList = $this->server->search($this->server->connection->ldapUserFilter, $this->dn, $this->ldapAttributeKeys); 63 | if (empty($userList)) return false; 64 | // turn the array values into single strings 65 | foreach ($userList[0] as $attributeKey => $valueArray) { 66 | $composedValue = ''; 67 | foreach ($valueArray as $i => $value) { 68 | $composedValue .= $i ? "\n" : ''; 69 | $composedValue .= $value; 70 | } 71 | $this->ldapAttributeValues[ $attributeKey ] = $composedValue; 72 | } 73 | 74 | // compose the users name 75 | $this->title = $this->ldapAttributeValues[ $this->server->connection->ldapUserDisplayName ]; 76 | $userDisplayName2 = @$this->ldapAttributeValues[ $this->server->connection->ldapUserDisplayName2 ]; 77 | $this->title .= empty($userDisplayName2) ? '' : ' (' . $userDisplayName2 . ')'; 78 | 79 | // TODO: implement avatar 80 | return true; 81 | } 82 | 83 | /** 84 | * load the groups the user is a member of 85 | * 86 | * @param bool $ignoreHiddenGroups=false 87 | */ 88 | public function loadOwnGroups(bool $ignoreHiddenGroups=false) { 89 | $this->userGroups = []; 90 | 91 | // fetch the groups the user is a member of 92 | $groupHelper = new Group_LDAP($this->server, $this->groupPluginManager); 93 | $groupUuidList = $groupHelper->getUserGroups($this->ncId); 94 | // load each groups data 95 | foreach ($groupUuidList as $groupUuid) { 96 | $this->userGroups[] = $this->entityFactory->getGroupByNcId($groupUuid); 97 | } 98 | } 99 | 100 | /** 101 | * check if this user is hidden and save the result 102 | */ 103 | protected function updateIsHiddenAttribute() { 104 | $hiddenUserIdList = $this->settings->getSetting('hiddenUsers', false); 105 | if ($hiddenUserIdList === false) { 106 | // no users were hidden yet 107 | $this->hidden = false; 108 | return; 109 | } 110 | $this->hidden = in_array($this->uuid, $hiddenUserIdList); 111 | } 112 | 113 | /** 114 | * convert the user into an array with it's data 115 | * 116 | * @return array 117 | */ 118 | public function toDataArray() { 119 | // get the normal data array 120 | $dataArray = parent::toDataArray(); 121 | $dataArray['groups'] = []; 122 | 123 | // add all groups data 124 | foreach ($this->userGroups as $group) { 125 | $dataArray['groups'][] = $group->toDataArray(); 126 | } 127 | 128 | return $dataArray; 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/components/ContactDetails.vue: -------------------------------------------------------------------------------- 1 | 77 | 78 | 182 | -------------------------------------------------------------------------------- /lib/LDAP/LdapEntity.php: -------------------------------------------------------------------------------- 1 | ncId = $ncId; 51 | $this->dn = $dn; 52 | $this->uuid = $uuid; 53 | $this->server = $server; 54 | $this->ldap = $ldap; 55 | $this->entityFactory = $entityFactory; 56 | $this->settings = $settings; 57 | 58 | // load the entities values 59 | $this->loadLdapAttributeKeys(); 60 | $this->loadLdapAttributeValues(); 61 | 62 | $this->updateIsHiddenAttribute(); 63 | } 64 | 65 | /** 66 | * load entity specific ldap attribute keys 67 | */ 68 | abstract protected function loadLdapAttributeKeys(); 69 | 70 | /** 71 | * fetch entity specific ldap attributes from the server 72 | */ 73 | abstract protected function loadLdapAttributeValues(); 74 | 75 | /** 76 | * convert the entity into an array with it's data 77 | * 78 | * @return array 79 | */ 80 | public function toDataArray() { 81 | return [ 82 | 'uuid' => $this->uuid, 83 | 'ldapAttributes' => $this->ldapAttributeValues, 84 | 'title' => $this->title, 85 | 'avaterUrl' => $this->avatarUrl 86 | ]; 87 | } 88 | 89 | /** 90 | * convert the entity into a DataResponse object, that can be used as an ajax response 91 | * 92 | * @return DataResponse 93 | */ 94 | public function toDataResponse() { 95 | return new DataResponse([ 'status' => 'success', 'data' => $this->toDataArray() ]); 96 | } 97 | 98 | /** 99 | * tells wether or not the entity is hidden 100 | * 101 | * @return bool 102 | */ 103 | public function isHidden() { 104 | return $this->hidden; 105 | } 106 | 107 | /** 108 | * check if this entity is hidden and save the result 109 | */ 110 | abstract protected function updateIsHiddenAttribute(); 111 | 112 | /** 113 | * get the entitys value for the given attribute 114 | * 115 | * @param string $attributeKey 116 | * 117 | * @return string|bool 118 | */ 119 | public function getAttributeValue(string $attributeKey) { 120 | return isset($this->ldapAttributeValues[ $attributeKey ]) ? $this->ldapAttributeValues[ $attributeKey ] : false; 121 | } 122 | 123 | /** 124 | * returns the entitys title 125 | * 126 | * @return string 127 | */ 128 | public function getTitle() { 129 | return $this->title; 130 | } 131 | 132 | /** 133 | * returns the entitys uuid 134 | * 135 | * @return string 136 | */ 137 | public function getUuid() { 138 | return $this->uuid; 139 | } 140 | 141 | /** 142 | * updates the entitys data entries with the given values 143 | * 144 | * @param array $newLdapAttributes 145 | * @return bool 146 | */ 147 | public function updateData(array $newLdapAttributes) { 148 | $verifiedChanges = []; 149 | 150 | foreach ($this->ldapAttributeKeys as $key) { 151 | // skip not send and not changed attributes 152 | if (!isset($newLdapAttributes[$key]) || $newLdapAttributes[$key] === $this->ldapAttributeValues[$key]) continue; 153 | // handle attribute deletion 154 | if (empty(trim($newLdapAttributes[$key]))) { 155 | $verifiedChanges[$key] = []; 156 | continue; 157 | } 158 | // handle normal modification 159 | $verifiedChanges[$key] = $newLdapAttributes[$key]; 160 | } 161 | 162 | $connectionResource = $this->server->getConnection()->getConnectionResource(); 163 | return $this->ldap->modAttributes($connectionResource, $this->dn, $verifiedChanges); 164 | } 165 | 166 | /** 167 | * // TODO: remove after testing 168 | */ 169 | public function print() { 170 | echo '

NcId

'; 171 | echo "
"; var_export( $this->ncId ); echo "
"; 172 | echo '

Dn

'; 173 | echo "
"; var_export( $this->dn ); echo "
"; 174 | echo '

UUID

'; 175 | echo "
"; var_export( $this->uuid ); echo "
"; 176 | echo '

LDAP Attribute Keys

'; 177 | echo "
"; var_export( $this->ldapAttributeKeys ); echo "
"; 178 | echo '

LDAP Attribute Values

'; 179 | echo "
"; var_export( $this->ldapAttributeValues ); echo "
"; 180 | echo '

Title

'; 181 | echo "
"; var_export( $this->title ); echo "
"; 182 | echo '

Avatar Url

'; 183 | echo "
"; var_export( $this->avatarUrl ); echo "
"; 184 | echo '


'; 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /lib/Controller/StatisticController.php: -------------------------------------------------------------------------------- 1 | contacts = $contacts; 20 | $this->settings = $settings; 21 | } 22 | 23 | /** 24 | * get all available statistics 25 | */ 26 | public function get() { 27 | $data = []; 28 | // get them all 29 | foreach( $this->statistics as $type ) { 30 | // get the statistic 31 | $stat = $this->getStatistic( $type ); 32 | // check if something went wrong 33 | if( $stat === false ) continue; 34 | // add the data to the bundle 35 | $data[ $type ] = $stat; 36 | } 37 | 38 | // return collected statistics 39 | return new DataResponse( [ 'status' => 'success' , 'data' => $data ] ); 40 | } 41 | 42 | /** 43 | * computes the wanted statistic 44 | * 45 | * @param string $type the type of statistic to be returned 46 | */ 47 | public function getStatistic( $type ) { 48 | switch( $type ) { 49 | case 'entries': 50 | return $this->entryAmount(); 51 | break; 52 | case 'entries_filled': 53 | return $this->entriesFilled(); 54 | break; 55 | case 'entries_empty': 56 | return $this->entriesEmpty(); 57 | break; 58 | case 'entries_filled_percent': 59 | return $this->entriesFilledPercent(); 60 | break; 61 | case 'entries_empty_percent': 62 | return $this->entriesEmptyPercent(); 63 | break; 64 | case 'users': 65 | return $this->userAmount(); 66 | break; 67 | case 'users_filled_entries': 68 | return $this->usersFilledEntries(); 69 | break; 70 | case 'users_empty_entries': 71 | return $this->usersEmtpyEntries(); 72 | break; 73 | case 'users_filled_entries_percent': 74 | return $this->usersFilledEntriesPercent(); 75 | break; 76 | case 'users_empty_entries_percent': 77 | return $this->usersEmptyEntriesPercent(); 78 | break; 79 | default: 80 | // no valid statistic given 81 | return false; 82 | } 83 | } 84 | 85 | /** 86 | * get all user attributes that aren't filled from the start 87 | */ 88 | protected function userNonDefaultAttributes() { 89 | return $this->settings->getSetting('userLdapAttributes', false); 90 | } 91 | 92 | /** 93 | * amount of entries users can edit 94 | */ 95 | protected function entryAmount() { 96 | // get all attributes the users can edit 97 | $attributes = $this->userNonDefaultAttributes(); 98 | 99 | // count the entries 100 | return $this->userAmount() * count($attributes); 101 | } 102 | 103 | /** 104 | * amount of entries the users have filled out 105 | */ 106 | protected function entriesFilled() { 107 | // get all attributes the users can edit 108 | $attributes = $this->userNonDefaultAttributes(); 109 | // get all users and their data 110 | $users = $this->contacts->getUsers(); 111 | if ($users['status'] !== 'success') return 0; 112 | // init counter 113 | $amount = 0; 114 | 115 | // count the entries 116 | foreach( $users['data'] as $user ) { 117 | foreach( $attributes as $attribute) { 118 | // check if the entry is filled 119 | if( !empty( $user['ldapAttributes'][ $attribute['name'] ] ) ) { 120 | $amount++; 121 | } 122 | } 123 | } 124 | 125 | // return the counted amount 126 | return $amount; 127 | } 128 | 129 | /** 130 | * amount of entries the users haven't filled out 131 | */ 132 | protected function entriesEmpty() { 133 | return $this->entryAmount() - $this->entriesFilled(); 134 | } 135 | 136 | /** 137 | * amount of entries the users have filled out, in percent 138 | */ 139 | protected function entriesFilledPercent() { 140 | $amount = $this->entryAmount(); 141 | return $amount > 0 ? round( $this->entriesFilled() / $amount * 100, 2 ) : 0; 142 | } 143 | 144 | /** 145 | * amount of entries the users haven't filled out, in percent 146 | */ 147 | protected function entriesEmptyPercent() { 148 | $amount = $this->entryAmount(); 149 | return $amount > 0 ? round( $this->entriesEmpty() / $amount * 100, 2 ) : 0; 150 | } 151 | 152 | /** 153 | * amount of registered users 154 | */ 155 | protected function userAmount() { 156 | $users = $this->contacts->getUsers(); 157 | return $users['status'] === 'success' ? count($users['data']) : 0; 158 | } 159 | 160 | /** 161 | * how many users have filled at least one of their entries 162 | */ 163 | protected function usersFilledEntries() { 164 | // get all attributes the users can edit 165 | $attributes = $this->userNonDefaultAttributes(); 166 | // get all users and their data 167 | $users = $this->contacts->getUsers(); 168 | if ($users['status'] !== 'success') return 0; 169 | // init counter 170 | $amount = 0; 171 | 172 | // count the entries 173 | foreach( $users['data'] as $user ) { 174 | foreach( $attributes as $attribute ) { 175 | // check if the entry is filled 176 | if( !empty( $user['ldapAttributes'][ $attribute['name'] ] ) ) { 177 | $amount++; 178 | break; 179 | } 180 | } 181 | } 182 | 183 | // return the counted amount 184 | return $amount; 185 | } 186 | 187 | /** 188 | * how many users have filled none of their entries 189 | */ 190 | protected function usersEmtpyEntries() { 191 | return $this->userAmount() - $this->usersFilledEntries(); 192 | } 193 | 194 | /** 195 | * how many users have filled at least one of their entries, in percent 196 | */ 197 | protected function usersFilledEntriesPercent() { 198 | $amount = $this->userAmount(); 199 | return $amount > 0 ? round( $this->usersFilledEntries() / $amount * 100, 2 ) : 0; 200 | } 201 | 202 | /** 203 | * how many users have filled none of their entries, in percent 204 | */ 205 | protected function usersEmptyEntriesPercent() { 206 | $amount = $this->userAmount(); 207 | return $amount > 0 ? round( $this->usersEmtpyEntries() / $amount * 100, 2 ) : 0; 208 | } 209 | } 210 | -------------------------------------------------------------------------------- /src/Main.vue: -------------------------------------------------------------------------------- 1 | 65 | 66 | 239 | -------------------------------------------------------------------------------- /lib/Controller/SettingsController.php: -------------------------------------------------------------------------------- 1 | appName = $appName; 42 | $this->config = $config; 43 | // load translation files 44 | $this->l = $l10n; 45 | // get the current users id 46 | $this->uid = $userId; 47 | // set default values 48 | $this->default = [ 49 | // available data 50 | 'userLdapAttributes' => [ 51 | [ 'name' => 'mail', 'label' => $this->l->t( 'Mail' ) ], 52 | [ 'name' => 'givenname', 'label' => $this->l->t( 'First Name' ) ], 53 | [ 'name' => 'sn', 'label' => $this->l->t( 'Last Name' ) ], 54 | [ 'name' => 'street', 'label' => $this->l->t( 'Address' ) ], 55 | [ 'name' => 'postalcode', 'label' => $this->l->t( 'zip Code' ) ], 56 | [ 'name' => 'l', 'label' => $this->l->t( 'City' ) ], 57 | [ 'name' => 'homephone', 'label' => $this->l->t( 'Phone' ) ], 58 | [ 'name' => 'mobile', 'label' => $this->l->t( 'Mobile' ) ] 59 | ], 60 | 'hiddenUsers' => [], 61 | 'hiddenGroups' => [] 62 | ]; 63 | // set default user values 64 | $this->user_default = [ 65 | 'order_by' => 'givenname' 66 | ]; 67 | } 68 | 69 | /** 70 | * gets the value for the given setting 71 | * 72 | * @NoAdminRequired 73 | * @param string $key 74 | * @param bool $DataResponse=true 75 | * @return string|DataResponse 76 | */ 77 | public function getUserValue(string $key, bool $DataResponse=true) { 78 | // check if this is a valid setting 79 | if( !isset( $this->user_default[ $key ] ) ) return false; 80 | // get the setting 81 | $data = $this->config->getUserValue( $this->uid, $this->appName, $key, $this->user_default[ $key ] ); 82 | // return message and data if given 83 | if( $DataResponse ) { 84 | if( $data !== false ) return new DataResponse( [ 'data' => $data, 'status' => 'success' ] ); 85 | else return new DataResponse( [ 'status' => 'error' ] ); 86 | } 87 | else return $data; 88 | } 89 | 90 | /** 91 | * saves the given user value and returns a DataResponse 92 | * 93 | * @NoAdminRequired 94 | * @param string $key 95 | * @param string $value 96 | * @return DataResponse 97 | */ 98 | public function setUserValue(string $key, string $value) { 99 | if( isset( $this->user_default[ $key ] ) && !$this->config->setUserValue( $this->uid, $this->appName, $key, $value ) ) { 100 | return new DataResponse( array( 'message' => $this->l->t( 'Settings saved' ), 'status' => 'success' ) ); 101 | } 102 | else { 103 | return new DataResponse( array( 'message' => $this->l->t( 'Something went wrong while saving the settings. Please try again.' ), 'status' => 'error' ) ); 104 | } 105 | } 106 | 107 | /** 108 | * returns the value for the given general setting 109 | * 110 | * @NoAdminRequired 111 | * @param string $key 112 | * @param bool $DataResponse=true 113 | * @return DataResponse 114 | */ 115 | public function getSetting(string $key, bool $DataResponse=true) { 116 | // check if this is a valid setting 117 | if( !isset( $this->default[ $key ] ) ) return false; 118 | // get the setting 119 | $data = $this->config->getAppValue( $this->appName, $key, $this->default[ $key ] ); 120 | // return message and data if given 121 | if( !is_bool( $data ) ) { 122 | // if this is an array setting, decode it 123 | if( in_array( $key, $this->array_settings ) && !is_array( $data ) ) $data = json_decode( $data, true ); 124 | 125 | // return the data 126 | if( $DataResponse ) return new DataResponse( [ 'data' => $data, 'status' => 'success' ] ); 127 | else return $data; 128 | } 129 | else if( $DataResponse ) return new DataResponse( [ 'status' => 'error' ] ); 130 | else return false; 131 | } 132 | 133 | /** 134 | * returns all settings from this app 135 | * 136 | * @NoAdminRequired 137 | * @return DataResponse 138 | */ 139 | public function getSettings() { 140 | // output buffer 141 | $data = array(); 142 | $success = true; 143 | // go through every existing setting 144 | foreach( $this->default as $key => $v ) { 145 | // get the settings value 146 | $response = $this->getSetting( $key )->getData(); 147 | // if the setting was successfuly fetched, put it to the output 148 | if( $response['status'] === 'success' ){ 149 | $data[ $key ] = $response['data']; 150 | } 151 | else { 152 | $success = false; 153 | } 154 | } 155 | // return the buffered data 156 | if( $success ) return new DataResponse( [ 'data' => $data, 'status' => 'success' ] ); 157 | else return new DataResponse( [ 'status' => 'error' ] ); 158 | } 159 | 160 | /** 161 | * updates the given setting 162 | * 163 | * @param string $key 164 | * @param mixed $value 165 | * @return bool 166 | */ 167 | public function updateSetting(string $key, $value) { 168 | $key = str_replace( "'", "", $key ); 169 | 170 | // check if the setting is an actual setting this app has 171 | if( !isset( $this->default[ $key ] ) ) return false; 172 | 173 | /** special processing for certain settings **/ 174 | if( $key === 'userLdapAttributes' ) { 175 | $array = []; 176 | // go through every attribute 177 | foreach( $value as $i => &$attr ) { 178 | // process the attributes name 179 | $attr['name'] = strtolower( trim( $attr['name'] ) ); 180 | if( empty( $attr['name'] ) ) { 181 | unset( $value[ $i ] ); 182 | continue; 183 | } 184 | 185 | // process the attributes label 186 | $attr['label'] = trim( $attr['label'] ); 187 | if( empty( $attr['label'] ) ) $attr['label'] = $attr['name']; 188 | } 189 | } 190 | 191 | // convert the value if it is an array 192 | if( is_array( $value ) ) $value = json_encode( $value ); 193 | // save the setting 194 | return !$this->config->setAppValue( $this->appName, $key, $value ); 195 | } 196 | 197 | /** 198 | * updates all the given settings 199 | * 200 | * @param array $settings 201 | * @return DataResponse 202 | */ 203 | public function updateSettings(array $settings) { 204 | $success = true; 205 | // go through every setting and update it 206 | foreach( $settings as $key => $value ) { 207 | // update the setting 208 | $success &= $this->updateSetting( $key, $value ); 209 | } 210 | // return message 211 | if( $success ) return new DataResponse( [ 'message' => $this->l->t( 'Settings saved' ), 'status' => 'success'] ); 212 | else return new DataResponse( [ 'message' => $this->l->t( 'Something went wrong while saving the settings. Please try again.' ), 'status' => 'error' ] ); 213 | } 214 | 215 | /** 216 | * remove the given key from the given settings array 217 | * 218 | * @param string $settingKey the key for the settings array to be modifyed 219 | * @param string $key the key to be removed from the array 220 | * @return bool 221 | */ 222 | public function arraySettingRemoveKey(string $settingKey, string $key) { 223 | // get the current setting 224 | $setting = $this->getSetting($settingKey, false); 225 | 226 | // check if the setting is an array 227 | if (!is_array($setting)) return false; 228 | 229 | // remove the given key from the array 230 | unset($setting[ $key ]); 231 | // update the setting 232 | return $this->updateSetting($settingKey, $setting); 233 | } 234 | 235 | /** 236 | * adds a value to the given settings array 237 | * 238 | * @param string $settingKey the key for the settings array to be modifyed 239 | * @param mixed $value the value to add 240 | * @param string $key='' the key to be removed from the array 241 | */ 242 | public function arraySettingAddKey(string $settingKey, $value, string $key='') { 243 | $key = trim($key); 244 | 245 | // get the current setting 246 | $setting = $this->getSetting($settingKey, false); 247 | 248 | // check if the setting is an array 249 | if (!is_array($setting)) return false; 250 | 251 | // add the value 252 | if (empty($key)) $setting[] = $value; 253 | else $setting[ $key ] = $value; 254 | 255 | // update the setting 256 | return $this->updateSetting( $settingKey, $setting ); 257 | } 258 | } 259 | -------------------------------------------------------------------------------- /lib/Controller/ContactController.php: -------------------------------------------------------------------------------- 1 | appName = $appName; 43 | $this->settings = $settings; 44 | $this->uid = $UserId; 45 | $this->l = $l10n; 46 | $this->entityFactory = $entityFactory; 47 | } 48 | 49 | /** 50 | * returns the main template 51 | * 52 | * @NoAdminRequired 53 | * @NoCSRFRequired 54 | * @return TemplateResponse 55 | */ 56 | public function index() { 57 | return new TemplateResponse( 'ldapcontacts', 'main' ); 58 | } 59 | 60 | /** 61 | * get all users 62 | * 63 | * @NoAdminRequired 64 | * @return DataResponse 65 | */ 66 | public function users() { 67 | return new DataResponse( $this->getUsers() ); 68 | } 69 | 70 | /** 71 | * get all hidden users 72 | * 73 | * @NoCSRFRequired 74 | * @return DataResponse 75 | */ 76 | public function hiddenUsers() { 77 | return new DataResponse( $this->getHiddenUsers() ); 78 | } 79 | 80 | /** 81 | * shows a users own data 82 | * 83 | * @NoAdminRequired 84 | * @return DataResponse 85 | */ 86 | public function show() { 87 | try { 88 | $user = $this->entityFactory->getUserByNcId($this->uid); 89 | } 90 | catch (LdapEntityNotFoundException $e) { 91 | return new DataResponse([ 'status' => 'warning', 'message' => $this->l->t("Your own data couldn't be fetched") ]); 92 | } 93 | $user->loadOwnGroups(); 94 | return $user->toDataResponse(); 95 | } 96 | 97 | /** 98 | * shows all groups 99 | * 100 | * @NoAdminRequired 101 | * @return DataResponse 102 | */ 103 | public function groups() { 104 | return new DataResponse( $this->getGroups() ); 105 | } 106 | 107 | /** 108 | * shows all hidden groups 109 | * 110 | * @return DataResponse 111 | */ 112 | public function hiddenGroups() { 113 | return new DataResponse( $this->getHiddenGroups() ); 114 | } 115 | 116 | /** 117 | * updates a users own data 118 | * 119 | * @NoAdminRequired 120 | * @param array $data 121 | * @return DataResponse 122 | */ 123 | public function update(array $data) { 124 | // modify user 125 | $user = $this->entityFactory->getUserByNcId($this->uid); 126 | $status = $user->getUuid() === $data['uuid'] ? $user->updateData($data['ldapAttributes']) : false; 127 | // return response 128 | if ($status) return new DataResponse([ 'status' => 'success', 'message' => $this->l->t( 'Your data has successfully been saved' ) ]); 129 | else return new DataResponse([ 'status' => 'error', $this->l->t( 'Something went wrong while saving your data' ) ]); 130 | } 131 | 132 | /** 133 | * get all users from the LDAP server 134 | * 135 | * @param bool $ignore_hidden 136 | * @return array 137 | */ 138 | public function getUsers(bool $ignoreHidden=false) { 139 | $userObjectList = $this->entityFactory->getAllUsers(); 140 | $userDataList = []; 141 | 142 | // order the users 143 | usort( $userObjectList, [ $this, 'orderLdapUserList' ] ); 144 | 145 | // process users 146 | foreach ($userObjectList as $i => $user) { 147 | // remove hidden 148 | if (!$ignoreHidden && $user->isHidden()) continue; 149 | // load user groups 150 | $user->loadOwnGroups($ignoreHidden); 151 | // get the users data 152 | $userDataList[] = $user->toDataArray(); 153 | } 154 | 155 | return [ 'status' => 'success', 'data' => $userDataList ]; 156 | } 157 | 158 | /** 159 | * get all hidden users 160 | * 161 | * @param array 162 | */ 163 | protected function getHiddenUsers() { 164 | $hiddenUsers = []; 165 | $hiddenUserUUIDs = $this->settings->getSetting('hiddenUsers', false); 166 | 167 | // get the user object and data for each given uuid 168 | foreach ($hiddenUserUUIDs as $uuid) { 169 | try { 170 | $user = $this->entityFactory->getUserByUuid($uuid); 171 | } 172 | catch (LdapEntityNotFoundException $e) { 173 | // skip invalid users 174 | continue; 175 | } 176 | // get the users data 177 | $hiddenUsers[ $uuid ] = $user->toDataArray(); 178 | } 179 | 180 | return [ 'status' => 'success', 'data' => $hiddenUsers ]; 181 | } 182 | 183 | /** 184 | * get all hidden groups 185 | * 186 | * @param array 187 | */ 188 | protected function getHiddenGroups() { 189 | $hiddenGroups = []; 190 | $hiddenGroupUUIDs = $this->settings->getSetting('hiddenGroups', false); 191 | 192 | // get the group object and data for each given uuid 193 | foreach ($hiddenGroupUUIDs as $uuid) { 194 | try { 195 | $group = $this->entityFactory->getGroupByUuid($uuid); 196 | } 197 | catch (LdapEntityNotFoundException $e) { 198 | // skip invalid groups 199 | continue; 200 | } 201 | 202 | // get the groups data 203 | $hiddenGroups[ $uuid ] = $group->toDataArray(); 204 | } 205 | 206 | return [ 'status' => 'success', 'data' => $hiddenGroups ]; 207 | } 208 | 209 | /** 210 | * orders the given user array by the ldap attribute selected by the user 211 | * 212 | * @param LdapUser $userA 213 | * @param LdapUser $userB 214 | * @return int 215 | */ 216 | protected function orderLdapUserList(LdapUser $userA, LdapUser $userB) { 217 | $order_by = $this->settings->getUserValue('order_by', false); 218 | 219 | // check if the arrays can be compared 220 | if ($userA->getAttributeValue($order_by) === false || $userB->getAttributeValue($order_by) === false) return 1; 221 | // compare 222 | return $userA->getAttributeValue($order_by) <=> $userB->getAttributeValue($order_by); 223 | } 224 | 225 | /** 226 | * returns an array of all existing groups 227 | * 228 | * @param bool $ignore_hidden 229 | * @return array 230 | */ 231 | protected function getGroups(bool $ignoreHidden=false) { 232 | $groupObjectList = $this->entityFactory->getAllGroups(); 233 | $groupDataList = []; 234 | 235 | // order the groups 236 | usort( $groupObjectList, function( $groupA, $groupB ) { 237 | return $groupA->getTitle() <=> $groupB->getTitle(); 238 | }); 239 | 240 | // process groups 241 | foreach ($groupObjectList as $i => $group) { 242 | // remove hidden 243 | if (!$ignoreHidden && $group->isHidden()) continue; 244 | // get the groups data 245 | $groupDataList[] = $group->toDataArray(); 246 | } 247 | 248 | return [ 'status' => 'success', 'data' => $groupDataList ]; 249 | } 250 | 251 | /** 252 | * shows the given LDAP entry 253 | * 254 | * @param string $type 'user' or 'group' 255 | * @param string $uuid 256 | */ 257 | public function showEntity(string $type, string $uuid) { 258 | $settingsKey; 259 | // check entity type 260 | switch ($type) { 261 | case EntityFactory::UserEntity: 262 | $settingsKey = 'hiddenUsers'; 263 | break; 264 | case EntityFactory::GroupEntity: 265 | $settingsKey = 'hiddenGroups'; 266 | break; 267 | default: 268 | return new DataResponse([ 'status' => 'error', 'message' => $this->l->t( 'Unknown entity type' ) ]); 269 | } 270 | 271 | // get currently hidden entities 272 | $hiddenEntities = $this->settings->getSetting($settingsKey, false); 273 | // check if the given entity is hidden 274 | $givenEntityKey = array_search($uuid, $hiddenEntities); 275 | // show the entity again 276 | $success = true; 277 | if ($givenEntityKey !== false) { 278 | unset($hiddenEntities[ $givenEntityKey ]); 279 | $success = $this->settings->updateSetting($settingsKey, $hiddenEntities); 280 | } 281 | 282 | // return message to user 283 | if ($success) { 284 | $message = $type === EntityFactory::UserEntity ? $this->l->t( 'User is now visible again' ) : $this->l->t( 'Group is now visible again' ); 285 | return new DataResponse( [ 'message' => $message, 'status' => 'success' ] ); 286 | } 287 | else { 288 | return new DataResponse( [ 'message' => $message, 'status' => 'error' ] ); 289 | $message = $type === EntityFactory::UserEntity ? $this->l->t( 'An error occured while making the user vivible again' ) : $this->l->t( 'An error occured while making the group visible again' ); 290 | } 291 | } 292 | 293 | /** 294 | * hides the given LDAP entry 295 | * 296 | * @param string $type 'user' or 'group' 297 | * @param string $uuid 298 | */ 299 | public function hideEntity(string $type, string $uuid) { 300 | $entity; 301 | $settingsKey; 302 | 303 | // check if the entity exists 304 | try { 305 | switch ($type) { 306 | case EntityFactory::UserEntity: 307 | $entity = $this->entityFactory->getUserByUuid($uuid); 308 | $settingsKey = 'hiddenUsers'; 309 | break; 310 | case EntityFactory::GroupEntity: 311 | $entity = $this->entityFactory->getGroupByUuid($uuid); 312 | $settingsKey = 'hiddenGroups'; 313 | break; 314 | default: 315 | return new DataResponse([ 'status' => 'error', 'message' => $this->l->t( 'Unknown entity type' ) ]); 316 | } 317 | } 318 | catch (LdapEntityNotFoundException $e) { 319 | return new DataResponse([ 'status' => 'error', 'message' => $this->l->t( 'Entity not found' ) ]); 320 | } 321 | 322 | // hide the entity 323 | if ($this->settings->arraySettingAddKey($settingsKey, $entity->getUuid())) { 324 | $message = $type === EntityFactory::UserEntity ? $this->l->t( 'User is now hidden' ) : $this->l->t( 'Group is now hidden' ); 325 | return new DataResponse( [ 'message' => $message, 'status' => 'success' ] ); 326 | } 327 | else { 328 | $message = $type === EntityFactory::UserEntity ? $this->l->t( 'An error occured while hiding the user' ) : $this->l->t( 'An error occured while hiding the group' ); 329 | return new DataResponse( [ 'message' => $message, 'status' => 'error' ] ); 330 | } 331 | } 332 | } 333 | -------------------------------------------------------------------------------- /lib/LDAP/EntityFactory.php: -------------------------------------------------------------------------------- 1 | ldapHelper = $ldapHelper; 63 | $this->ldapWrapper = $ldapWrapper; 64 | $this->accessFactory = $accessFactory; 65 | $this->ldapUserMapping = $ldapUserMapping; 66 | $this->ldapGroupMapping = $ldapGroupMapping; 67 | $this->settings = $settings; 68 | $this->log = $logger; 69 | $this->groupPluginManager = $groupPluginManager; 70 | $this->ldap = $ldap; 71 | } 72 | 73 | /** 74 | * @param string $uuid 75 | * @return LdapUser 76 | * @throws LdapEntityNotFoundException 77 | */ 78 | public function getUserByUuid(string $uuid) { 79 | try { return $this->getEntityByUuid($uuid, EntityFactory::UserEntity); } 80 | catch (LdapEntityNotFoundException $e) { throw $e; } 81 | } 82 | 83 | /** 84 | * @param string $userId 85 | * @return LdapUser 86 | * @throws LdapEntityNotFoundException 87 | */ 88 | public function getUserByNcId(string $userId) { 89 | try { return $this->getEntityByNcId($userId, EntityFactory::UserEntity); } 90 | catch (LdapEntityNotFoundException $e) { throw $e; } 91 | } 92 | 93 | /** 94 | * @param string $userDn 95 | * @return LdapUser 96 | * @throws LdapEntityNotFoundException 97 | */ 98 | public function getUserByDn(string $userDn) { 99 | try { return $this->getEntityByDn($userDn, EntityFactory::UserEntity); } 100 | catch (LdapEntityNotFoundException $e) { throw $e; } 101 | } 102 | 103 | /** 104 | * @param string $uuid 105 | * @return LdapGroup 106 | * @throws LdapEntityNotFoundException 107 | */ 108 | public function getGroupByUuid(string $uuid) { 109 | try { return $this->getEntityByUuid($uuid, EntityFactory::GroupEntity); } 110 | catch (LdapEntityNotFoundException $e) { throw $e; } 111 | } 112 | 113 | /** 114 | * @param string $groupId 115 | * @return LdapGroup 116 | * @throws LdapEntityNotFoundException 117 | */ 118 | public function getGroupByNcId(string $groupId) { 119 | try { return $this->getEntityByNcId($groupId, EntityFactory::GroupEntity); } 120 | catch (LdapEntityNotFoundException $e) { throw $e; } 121 | } 122 | 123 | /** 124 | * @param string $groupDn 125 | * @return LdapGroup 126 | * @throws LdapEntityNotFoundException 127 | */ 128 | public function getGroupByDn(string $groupDn) { 129 | try { return $this->getEntityByDn($groupDn, EntityFactory::GroupEntity); } 130 | catch (LdapEntityNotFoundException $e) { throw $e; } 131 | } 132 | 133 | /** 134 | * @param string $entityUuid 135 | * @param string $entityType 136 | * @throws LdapEntityNotFoundException 137 | */ 138 | private function getEntityByUuid(string $entityUuid, string $entityType) { 139 | // try to find the entity 140 | foreach ($this->getAvailableServerList() as $server) { 141 | $entityMapper = $entityType === EntityFactory::UserEntity ? $server->getUserMapper() : $server->getGroupMapper(); 142 | 143 | $entityNcId = $entityMapper->getNameByUUID($entityUuid); 144 | // if the user wasn't found on this server, check the next one 145 | if ($entityNcId === false) continue; 146 | 147 | $entityDn = EntityFactory::getEntityDnByNcId($entityNcId, $entityType, $server); 148 | // if the dn couldn't be determined, try the next server 149 | if ($entityDn === false) continue; 150 | 151 | return $this->createLdapEntity($entityNcId, $entityDn, $entityUuid, $server, $entityType); 152 | } 153 | 154 | // the entity couldn't be found 155 | switch ($entityType) { 156 | case EntityFactory::UserEntity: 157 | $e = new LdapEntityNotFoundException("The user with the following UUID couldn't be found: " . $entityUuid); 158 | break; 159 | case EntityFactory::GroupEntity: 160 | $e = new LdapEntityNotFoundException("The group with the following UUID couldn't be found: " . $entityUuid); 161 | break; 162 | default: 163 | $e = new LdapEntityNotFoundException("The entity with the following UUID couldn't be found: " . $entityUuid); 164 | break; 165 | } 166 | $this->log->logException($e); 167 | throw $e; 168 | } 169 | 170 | /** 171 | * @param string $entityId 172 | * @param string $entityType 173 | * @return LdapEntity 174 | */ 175 | private function getEntityByNcId(string $entityNcId, string $entityType) { 176 | // try to find the entity 177 | foreach ($this->getAvailableServerList() as $server) { 178 | $entityDn = EntityFactory::getEntityDnByNcId($entityNcId, $entityType, $server); 179 | // if the user wasn't found on this server, check the next one 180 | if ($entityDn === false) continue; 181 | 182 | $entityUuid = EntityFactory::getEntityUuidByDn($entityDn, $entityType, $server); 183 | // if the uuid couldn't be determined, try the next server 184 | if ($entityUuid === false) continue; 185 | 186 | return $this->createLdapEntity($entityNcId, $entityDn, $entityUuid, $server, $entityType); 187 | } 188 | 189 | // the entity couldn't be found 190 | switch ($entityType) { 191 | case EntityFactory::UserEntity: 192 | $e = new LdapEntityNotFoundException("The user with the following Nextcloud ID couldn't be found: " . $entityNcId); 193 | case EntityFactory::GroupEntity: 194 | $e = new LdapEntityNotFoundException("The group with the following Nextcloud ID couldn't be found: " . $entityNcId); 195 | default: 196 | $e = new LdapEntityNotFoundException("The entity with the following Nextcloud ID couldn't be found: " . $entityNcId); 197 | } 198 | $this->log->logException($e); 199 | $e = $e; 200 | } 201 | 202 | /** 203 | * @param string $entityDn 204 | * @param string $entityType 205 | * @return LdapEntity 206 | */ 207 | private function getEntityByDn(string $entityDn, string $entityType) { 208 | // try to find the entity 209 | foreach ($this->getAvailableServerList() as $server) { 210 | $entityNcId = EntityFactory::getEntityNcIdByDn($entityDn, $entityType, $server); 211 | // if the user wasn't found on this server, check the next one 212 | if ($entityDn === false) continue; 213 | 214 | $entityUuid = EntityFactory::getEntityUuidByDn($entityDn, $entityType, $server); 215 | // if the uuid couldn't be determined, try the next server 216 | if ($entityUuid === false) continue; 217 | 218 | return $this->createLdapEntity($entityNcId, $entityDn, $entityUuid, $server, $entityType); 219 | } 220 | 221 | // the entity couldn't be found 222 | switch ($entityType) { 223 | case EntityFactory::UserEntity: 224 | $e = new LdapEntityNotFoundException("The user with the following DN couldn't be found: " . $entityDn); 225 | case EntityFactory::GroupEntity: 226 | $e = new LdapEntityNotFoundException("The group with the following DN couldn't be found: " . $entityDn); 227 | default: 228 | $e = new LdapEntityNotFoundException("The entity with the following DN couldn't be found: " . $entityDn); 229 | } 230 | } 231 | 232 | /** 233 | * returns a list of all available ldap users 234 | * 235 | * @return LdapUser[] 236 | */ 237 | public function getAllUsers() { 238 | $userList = []; 239 | 240 | // get all users from all servers 241 | foreach ($this->getAvailableServerList() as $server) { 242 | $serverUserList = $server->fetchListOfUsers($server->connection->ldapUserFilter, ['dn']); 243 | 244 | // loop through all users 245 | foreach ($serverUserList as $dn) { 246 | try { 247 | $user = $this->getUserByDn($dn); 248 | } 249 | catch (LdapEntityNotFoundException $e) { 250 | // the user couldn't be found, so skip him 251 | continue; 252 | } 253 | 254 | $userList[] = $user; 255 | } 256 | } 257 | 258 | return $userList; 259 | } 260 | 261 | /** 262 | * returns a list of all available ldap groups 263 | * 264 | * @return LdapGroup[] 265 | */ 266 | public function getAllGroups() { 267 | $groupList = []; 268 | 269 | // get all groups from all servers 270 | foreach ($this->getAvailableServerList() as $server) { 271 | $serverGroupList = $server->fetchListOfGroups($server->connection->ldapGroupFilter, ['dn']); 272 | // loop through all groups 273 | foreach ($serverGroupList as $dn) { 274 | try { 275 | $group = $this->getGroupByDn($dn); 276 | } 277 | catch (LdapEntityNotFoundException $e) { 278 | // the group couldn't be found, so skip it 279 | continue; 280 | } 281 | 282 | $groupList[] = $group; 283 | } 284 | } 285 | 286 | return $groupList; 287 | } 288 | 289 | /** 290 | * @return AccessFactory[] 291 | */ 292 | protected function getAvailableServerList() { 293 | $serverList = []; 294 | 295 | /** establish ldap connections for each defined server **/ 296 | $ldapServerPrefixList = $this->ldapHelper->getServerConfigurationPrefixes(true); 297 | foreach ($ldapServerPrefixList as $prefix) { 298 | // check if this connection already exists 299 | if (isset($this->establishedConnections[ $prefix ])) { 300 | $serverList[] = $this->establishedConnections[ $prefix ]; 301 | continue; 302 | } 303 | 304 | $connection = new Connection($this->ldapWrapper, $prefix); 305 | // check if a connection is possible 306 | try { 307 | $connection->init(); 308 | } 309 | catch (ServerNotAvailableException $e) { 310 | $this->log->logException($e); 311 | continue; 312 | } 313 | 314 | $access = $this->accessFactory->get($connection); 315 | $access->setUserMapper($this->ldapUserMapping); 316 | $access->setGroupMapper($this->ldapGroupMapping); 317 | $serverList[] = $access; 318 | // chache the connection for later use 319 | $this->establishedConnections[ $prefix ] = $access; 320 | } 321 | 322 | return $serverList; 323 | } 324 | 325 | /** 326 | * @param string $entityNcId 327 | * @param string $entityType 328 | * @return string|false 329 | */ 330 | private static function getEntityDnByNcId(string $entityNcId, string $entityType, Access $server) { 331 | return $entityType === EntityFactory::UserEntity ? $server->username2dn($entityNcId) : $server->groupname2dn($entityNcId);; 332 | } 333 | 334 | /** 335 | * @param string $entityDn 336 | * @param string $entityType 337 | * @return string|false 338 | */ 339 | private static function getEntityNcIdByDn(string $entityDn, string $entityType, Access $server) { 340 | return $entityType === EntityFactory::UserEntity ? $server->dn2username($entityDn) : $server->dn2groupname($entityDn);; 341 | } 342 | 343 | /** 344 | * @param string $entityNcId 345 | * @param string $entityType 346 | * @return string|false 347 | */ 348 | private static function getEntityUuidByDn(string $entityDn, string $entityType, Access $server) { 349 | $isUser = $entityType === EntityFactory::UserEntity; 350 | return $server->getUUID($entityDn, $isUser); 351 | } 352 | 353 | /** 354 | * @param string $entityNcId 355 | * @param string $entityDn 356 | * @param string $entityUuid 357 | * @param Access $server 358 | * @param string $entityType 359 | * @return LdapEntity 360 | * @throws LdapEntityUnknownException 361 | */ 362 | private function createLdapEntity(string $entityNcId, string $entityDn, string $entityUuid, Access $server, string $entityType) { 363 | switch ($entityType) { 364 | case EntityFactory::UserEntity: 365 | return new LdapUser($entityNcId, $entityDn, $entityUuid, $server, $this->ldap, $this, $this->settings, $this->groupPluginManager); 366 | case EntityFactory::GroupEntity: 367 | return new LdapGroup($entityNcId, $entityDn, $entityUuid, $server, $this->ldap, $this, $this->settings); 368 | default: 369 | throw new LdapEntityUnknownException(); 370 | } 371 | } 372 | } 373 | -------------------------------------------------------------------------------- /src/Settings.vue: -------------------------------------------------------------------------------- 1 | 117 | 118 | 446 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | --------------------------------------------------------------------------------