Skip to content

A free open source IT asset/license management system

adds default group to LDAP

Godfrey Mf9ac447dd1de
diff --cc app/Console/Commands/LdapSync.php
index 5be22127ae,36505eba11..a87155fba6
--- a/app/Console/Commands/LdapSync.php
+++ b/app/Console/Commands/LdapSync.php
@@@ -3,6 -3,6 +3,7 @@@
namespace App\Console\Commands;
use App\Models\Department;
++use App\Models\Group;
use Illuminate\Console\Command;
use App\Models\Setting;
use App\Models\Ldap;
@@@ -218,6 -216,6 +219,13 @@@ class LdapSync extends Comman
$user->country = $item['country'];
$user->department_id = $department->id;
++ if($ldap_default_group != null) {
++
++ $default = Group::select()->where('id', $ldap_default_group)->first();
++ $user->permissions = $default->permissions;
++
++ }
++
if($item['manager'] != null) {
// Get the LDAP Manager
$ldap_manager = Ldap::findLdapUsers($item['manager'], -1, $this->option('filter'));
@@@ -304,11 -302,6 +312,7 @@@
if ($user->save()) {
$item['note'] = $item['createorupdate'];
$item['status'] = 'success';
+
- if($ldap_default_group != null) {
-
- $user->groups()->sync($ldap_default_group);
- }
} else {
foreach ($user->getErrors()->getMessages() as $key => $err) {
$errors .= $err[0];
diff --cc composer.lock
index 3f5b1ae7b5,9de93e404d..4eea0f2174
--- a/composer.lock
+++ b/composer.lock
@@@ -12132,122 -12050,6 +12055,125 @@@
"time": "2022-03-03T13:19:32+00:00"
},
{
++<<<<<<< HEAD
+ "name": "n98/junit-xml",
+ "version": "1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/cmuench/junit-xml.git",
+ "reference": "0017dd92ac8cb619f02e32f4cffd768cfe327c73"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/cmuench/junit-xml/zipball/0017dd92ac8cb619f02e32f4cffd768cfe327c73",
+ "reference": "0017dd92ac8cb619f02e32f4cffd768cfe327c73",
+ "shasum": ""
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.5.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "N98\\JUnitXml\\": "src/N98/JUnitXml"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Christian Münch",
+ "email": "[email protected]"
+ }
+ ],
+ "description": "JUnit XML Document generation library",
+ "support": {
+ "issues": "https://github.com/cmuench/junit-xml/issues",
+ "source": "https://github.com/cmuench/junit-xml/tree/1.1.0"
+ },
+ "time": "2020-12-25T09:08:58+00:00"
+ },
+ {
+ "name": "overtrue/phplint",
+ "version": "3.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/overtrue/phplint.git",
+ "reference": "66be32d54b763a4b0ba1a820d3c867cd2e252ea5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/overtrue/phplint/zipball/66be32d54b763a4b0ba1a820d3c867cd2e252ea5",
+ "reference": "66be32d54b763a4b0ba1a820d3c867cd2e252ea5",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "n98/junit-xml": "1.1.0",
+ "php": ">=5.5.9",
+ "symfony/console": "^3.2|^4.0|^5.0",
+ "symfony/finder": "^3.0|^4.0|^5.0",
+ "symfony/process": "^3.3|^4.0|^5.0",
+ "symfony/yaml": "^3.0|^4.0|^5.0"
+ },
+ "require-dev": {
+ "brainmaestro/composer-git-hooks": "^2.7",
+ "friendsofphp/php-cs-fixer": "^2.16",
+ "jakub-onderka/php-console-highlighter": "^0.3.2 || ^0.4"
+ },
+ "bin": [
+ "bin/phplint"
+ ],
+ "type": "library",
+ "extra": {
+ "hooks": {
+ "pre-commit": [
+ "composer fix-style"
+ ],
+ "pre-push": [
+ "composer check-style"
+ ]
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Overtrue\\PHPLint\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "overtrue",
+ "email": "[email protected]"
+ }
+ ],
+ "description": "`phplint` is a tool that can speed up linting of php files by running several lint processes at once.",
+ "keywords": [
+ "check",
+ "lint",
+ "phplint",
+ "syntax"
+ ],
+ "support": {
+ "issues": "https://github.com/overtrue/phplint/issues",
+ "source": "https://github.com/overtrue/phplint/tree/3.1.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/overtrue",
+ "type": "github"
+ }
+ ],
+ "time": "2022-06-21T05:52:47+00:00"
+ },
+ {
++=======
++>>>>>>> develop
"name": "phar-io/manifest",
"version": "2.0.3",
"source": {
@@@ -13639,82 -13445,7 +13565,83 @@@
"description": "Eases DOM navigation for HTML and XML documents",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/dom-crawler/tree/v4.4.42"
+ "source": "https://github.com/symfony/dom-crawler/tree/v4.4.45"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2022-08-03T12:57:57+00:00"
+ },
+ {
++<<<<<<< HEAD
+ "name": "symfony/yaml",
+ "version": "v5.4.12",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/yaml.git",
+ "reference": "7a3aa21ac8ab1a96cc6de5bbcab4bc9fc943b18c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/7a3aa21ac8ab1a96cc6de5bbcab4bc9fc943b18c",
+ "reference": "7a3aa21ac8ab1a96cc6de5bbcab4bc9fc943b18c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2.5",
+ "symfony/deprecation-contracts": "^2.1|^3",
+ "symfony/polyfill-ctype": "^1.8"
+ },
+ "conflict": {
+ "symfony/console": "<5.3"
+ },
+ "require-dev": {
+ "symfony/console": "^5.3|^6.0"
+ },
+ "suggest": {
+ "symfony/console": "For validating YAML files using the lint command"
+ },
+ "bin": [
+ "Resources/bin/yaml-lint"
+ ],
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Yaml\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "[email protected]"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Loads and dumps YAML files",
+ "homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/yaml/tree/v5.4.12"
},
"funding": [
{
@@@ -13730,9 -13461,9 +13657,11 @@@
"type": "tidelift"
}
],
- "time": "2022-04-30T18:34:00+00:00"
+ "time": "2022-08-02T15:52:22+00:00"
},
{
++=======
++>>>>>>> develop
"name": "theseer/tokenizer",
"version": "1.2.1",
"source": {