Skip to content

Commit e007db3

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents f9f06d2 + b3792bf commit e007db3

File tree

12 files changed

+124
-16
lines changed

12 files changed

+124
-16
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3289,6 +3289,15 @@
32893289
"contributions": [
32903290
"code"
32913291
]
3292+
},
3293+
{
3294+
"login": "azmcnutt",
3295+
"name": "James M",
3296+
"avatar_url": "https://avatars.githubusercontent.com/u/31522486?v=4",
3297+
"profile": "https://github.com/azmcnutt",
3298+
"contributions": [
3299+
"code"
3300+
]
32923301
}
32933302
]
32943303
}

CONTRIBUTORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
5353
| [<img src="https://avatars.githubusercontent.com/u/55590532?v=4" width="110px;"/><br /><sub>squintfox</sub>](https://github.com/squintfox)<br />[💻](https://github.com/snipe/snipe-it/commits?author=squintfox "Code") | [<img src="https://avatars.githubusercontent.com/u/1380084?v=4" width="110px;"/><br /><sub>Jeff Clay</sub>](https://github.com/jeffclay)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jeffclay "Code") | [<img src="https://avatars.githubusercontent.com/u/52716446?v=4" width="110px;"/><br /><sub>Phil J R</sub>](https://github.com/PP-JN-RL)<br />[💻](https://github.com/snipe/snipe-it/commits?author=PP-JN-RL "Code") | [<img src="https://avatars.githubusercontent.com/u/1496725?v=4" width="110px;"/><br /><sub>i_virus</sub>](https://www.corelight.com/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=chandanchowdhury "Code") | [<img src="https://avatars.githubusercontent.com/u/1020541?v=4" width="110px;"/><br /><sub>Paul Grime</sub>](https://github.com/gitgrimbo)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gitgrimbo "Code") | [<img src="https://avatars.githubusercontent.com/u/922815?v=4" width="110px;"/><br /><sub>Lee Porte</sub>](https://leeporte.co.uk)<br />[💻](https://github.com/snipe/snipe-it/commits?author=LeePorte "Code") | [<img src="https://avatars.githubusercontent.com/u/23613427?v=4" width="110px;"/><br /><sub>BRYAN </sub>](https://github.com/bryanlopezinc)<br />[💻](https://github.com/snipe/snipe-it/commits?author=bryanlopezinc "Code") [⚠️](https://github.com/snipe/snipe-it/commits?author=bryanlopezinc "Tests") |
5454
| [<img src="https://avatars.githubusercontent.com/u/64061710?v=4" width="110px;"/><br /><sub>U-H-T</sub>](https://github.com/U-H-T)<br />[💻](https://github.com/snipe/snipe-it/commits?author=U-H-T "Code") | [<img src="https://avatars.githubusercontent.com/u/5395363?v=4" width="110px;"/><br /><sub>Matt Tyree</sub>](https://github.com/Tyree)<br />[📖](https://github.com/snipe/snipe-it/commits?author=Tyree "Documentation") | [<img src="https://avatars.githubusercontent.com/u/292081?v=4" width="110px;"/><br /><sub>Florent Bervas</sub>](http://spoontux.net)<br />[💻](https://github.com/snipe/snipe-it/commits?author=FlorentDotMe "Code") | [<img src="https://avatars.githubusercontent.com/u/4498077?v=4" width="110px;"/><br /><sub>Daniel Albertsen</sub>](https://ditscheri.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=dbakan "Code") | [<img src="https://avatars.githubusercontent.com/u/100710244?v=4" width="110px;"/><br /><sub>r-xyz</sub>](https://github.com/r-xyz)<br />[💻](https://github.com/snipe/snipe-it/commits?author=r-xyz "Code") | [<img src="https://avatars.githubusercontent.com/u/47491036?v=4" width="110px;"/><br /><sub>Steven Mainor</sub>](https://github.com/DrekiDegga)<br />[💻](https://github.com/snipe/snipe-it/commits?author=DrekiDegga "Code") | [<img src="https://avatars.githubusercontent.com/u/65785975?v=4" width="110px;"/><br /><sub>arne-kroeger</sub>](https://github.com/arne-kroeger)<br />[💻](https://github.com/snipe/snipe-it/commits?author=arne-kroeger "Code") |
5555
| [<img src="https://avatars.githubusercontent.com/u/167117705?v=4" width="110px;"/><br /><sub>Glukose1</sub>](https://github.com/Glukose1)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Glukose1 "Code") | [<img src="https://avatars.githubusercontent.com/u/1197791?v=4" width="110px;"/><br /><sub>Scarzy</sub>](https://github.com/Scarzy)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Scarzy "Code") | [<img src="https://avatars.githubusercontent.com/u/37372069?v=4" width="110px;"/><br /><sub>setpill</sub>](https://github.com/setpill)<br />[💻](https://github.com/snipe/snipe-it/commits?author=setpill "Code") | [<img src="https://avatars.githubusercontent.com/u/3755203?v=4" width="110px;"/><br /><sub>swift2512</sub>](https://github.com/swift2512)<br />[🐛](https://github.com/snipe/snipe-it/issues?q=author%3Aswift2512 "Bug reports") | [<img src="https://avatars.githubusercontent.com/u/6136439?v=4" width="110px;"/><br /><sub>Darren Rainey</sub>](https://darrenraineys.co.uk)<br />[💻](https://github.com/snipe/snipe-it/commits?author=DarrenRainey "Code") | [<img src="https://avatars.githubusercontent.com/u/133033121?v=4" width="110px;"/><br /><sub>maciej-poleszczyk</sub>](https://github.com/maciej-poleszczyk)<br />[💻](https://github.com/snipe/snipe-it/commits?author=maciej-poleszczyk "Code") | [<img src="https://avatars.githubusercontent.com/u/143394709?v=4" width="110px;"/><br /><sub>Sebastian Groß</sub>](https://github.com/sgross-emlix)<br />[💻](https://github.com/snipe/snipe-it/commits?author=sgross-emlix "Code") |
56-
| [<img src="https://avatars.githubusercontent.com/u/41107778?v=4" width="110px;"/><br /><sub>Anouar Touati</sub>](https://github.com/AnouarTouati)<br />[💻](https://github.com/snipe/snipe-it/commits?author=AnouarTouati "Code") | [<img src="https://avatars.githubusercontent.com/u/25596663?v=4" width="110px;"/><br /><sub>aHVzY2g</sub>](https://github.com/aHVzY2g)<br />[💻](https://github.com/snipe/snipe-it/commits?author=aHVzY2g "Code") | [<img src="https://avatars.githubusercontent.com/u/13408130?v=4" width="110px;"/><br /><sub>林博仁 Buo-ren Lin</sub>](https://brlin.me)<br />[💻](https://github.com/snipe/snipe-it/commits?author=brlin-tw "Code") | [<img src="https://avatars.githubusercontent.com/u/18550946?v=4" width="110px;"/><br /><sub>Adugna Gizaw</sub>](https://orbalia.pythonanywhere.com/)<br />[🌍](#translation-addex12 "Translation") | [<img src="https://avatars.githubusercontent.com/u/760989?v=4" width="110px;"/><br /><sub>Jesse Ostrander</sub>](https://github.com/jostrander)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jostrander "Code") |
56+
| [<img src="https://avatars.githubusercontent.com/u/41107778?v=4" width="110px;"/><br /><sub>Anouar Touati</sub>](https://github.com/AnouarTouati)<br />[💻](https://github.com/snipe/snipe-it/commits?author=AnouarTouati "Code") | [<img src="https://avatars.githubusercontent.com/u/25596663?v=4" width="110px;"/><br /><sub>aHVzY2g</sub>](https://github.com/aHVzY2g)<br />[💻](https://github.com/snipe/snipe-it/commits?author=aHVzY2g "Code") | [<img src="https://avatars.githubusercontent.com/u/13408130?v=4" width="110px;"/><br /><sub>林博仁 Buo-ren Lin</sub>](https://brlin.me)<br />[💻](https://github.com/snipe/snipe-it/commits?author=brlin-tw "Code") | [<img src="https://avatars.githubusercontent.com/u/18550946?v=4" width="110px;"/><br /><sub>Adugna Gizaw</sub>](https://orbalia.pythonanywhere.com/)<br />[🌍](#translation-addex12 "Translation") | [<img src="https://avatars.githubusercontent.com/u/760989?v=4" width="110px;"/><br /><sub>Jesse Ostrander</sub>](https://github.com/jostrander)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jostrander "Code") | [<img src="https://avatars.githubusercontent.com/u/31522486?v=4" width="110px;"/><br /><sub>James M</sub>](https://github.com/azmcnutt)<br />[💻](https://github.com/snipe/snipe-it/commits?author=azmcnutt "Code") |
5757
<!-- ALL-CONTRIBUTORS-LIST:END -->
5858

5959
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

app/Console/Commands/LdapSync.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,15 @@ public function handle()
361361
// (Specifically, we don't handle a value of '0.0' correctly)
362362
$raw_value = @$results[$i][$ldap_map["active_flag"]][0];
363363
$filter_var = filter_var($raw_value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
364+
364365
$boolean_cast = (bool) $raw_value;
365-
366-
$user->activated = $filter_var ?? $boolean_cast; // if filter_var() was true or false, use that. If it's null, use the $boolean_cast
366+
367+
if (Setting::getSettings()->ldap_invert_active_flag === 1) {
368+
// Because ldap_active_flag is set, if filter_var is true or boolean_cast is true, then user is suspended
369+
$user->activated = !($filter_var ?? $boolean_cast);
370+
}else{
371+
$user->activated = $filter_var ?? $boolean_cast; // if filter_var() was true or false, use that. If it's null, use the $boolean_cast
372+
}
367373

368374
} elseif (array_key_exists('useraccountcontrol', $results[$i])) {
369375
// ....otherwise, (ie if no 'active' LDAP flag is defined), IF the UAC setting exists,

app/Http/Controllers/SettingsController.php

100755100644
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,7 @@ public function postLdapSettings(StoreLdapSettings $request) : RedirectResponse
851851
$setting->ldap_auth_filter_query = $request->input('ldap_auth_filter_query');
852852
$setting->ldap_version = $request->input('ldap_version', 3);
853853
$setting->ldap_active_flag = $request->input('ldap_active_flag');
854+
$setting->ldap_invert_active_flag = $request->input('ldap_invert_active_flag');
854855
$setting->ldap_emp_num = $request->input('ldap_emp_num');
855856
$setting->ldap_email = $request->input('ldap_email');
856857
$setting->ldap_manager = $request->input('ldap_manager');

app/Livewire/CategoryEditForm.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ class CategoryEditForm extends Component
1212

1313
public $originalSendCheckInEmailValue;
1414

15-
public $requireAcceptance;
15+
public bool $requireAcceptance;
1616

17-
public $sendCheckInEmail;
17+
public bool $sendCheckInEmail;
1818

19-
public $useDefaultEula;
19+
public bool $useDefaultEula;
2020

2121
public function mount()
2222
{
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::table('settings', function (Blueprint $table) {
15+
$table->boolean('ldap_invert_active_flag')->default(false);
16+
});
17+
}
18+
19+
/**
20+
* Reverse the migrations.
21+
*/
22+
public function down(): void
23+
{
24+
Schema::table('settings', function (Blueprint $table) {
25+
$table->dropColumn('ldap_invert_active_flag');
26+
});
27+
}
28+
};

resources/lang/en-US/admin/settings/general.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@
118118
'ldap_version' => 'LDAP Version',
119119
'ldap_active_flag' => 'LDAP Active Flag',
120120
'ldap_activated_flag_help' => 'This value is used to determine whether a synced user can login to Snipe-IT. <strong>It does not affect the ability to check items in or out to them</strong>, and should be the <strong>attribute name</strong> within your AD/LDAP, <strong>not the value</strong>. <br><br>If this field is set to a field name that does not exist in your AD/LDAP, or the value in the AD/LDAP field is set to <code>0</code> or <code>false</code>, <strong>user login will be disabled</strong>. If the value in the AD/LDAP field is set to <code>1</code> or <code>true</code> or <em>any other text</em> means the user can log in. When the field is blank in your AD, we respect the <code>userAccountControl</code> attribute, which usually allows non-suspended users to log in.',
121+
'ldap_invert_active_flag' => 'LDAP Invert Active Flag',
122+
'ldap_invert_active_flag_help' => 'If enabled: when the value returned by LDAP Active Flag is <code>0</code> or <code>false</code> the user account will be active.',
121123
'ldap_emp_num' => 'LDAP Employee Number',
122124
'ldap_email' => 'LDAP Email',
123125
'ldap_test' => 'Test LDAP',

resources/views/categories/edit.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
<livewire:category-edit-form
2727
:default-eula-text="$snipeSettings->default_eula_text"
2828
:eula-text="old('eula_text', $item->eula_text)"
29-
:require-acceptance="old('require_acceptance', $item->require_acceptance)"
30-
:send-check-in-email="old('checkin_email', $item->checkin_email)"
31-
:use-default-eula="old('use_default_eula', $item->use_default_eula)"
29+
:require-acceptance="(bool) old('require_acceptance', $item->require_acceptance)"
30+
:send-check-in-email="(bool) old('checkin_email', $item->checkin_email)"
31+
:use-default-eula="(bool) old('use_default_eula', $item->use_default_eula)"
3232
/>
3333

3434
@include ('partials.forms.edit.image-upload', ['image_path' => app('categories_upload_path')])

resources/views/livewire/category-edit-form.blade.php

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,25 @@
2323
<div class="col-md-9 col-md-offset-3">
2424
@if ($defaultEulaText!='')
2525
<label class="form-control">
26-
{{ Form::checkbox('use_default_eula', '1', $useDefaultEula, ['wire:model.live' => 'useDefaultEula', 'aria-label'=>'use_default_eula']) }}
26+
<input
27+
type="checkbox"
28+
name="use_default_eula"
29+
value="1"
30+
wire:model.live="useDefaultEula"
31+
aria-label="use_default_eula"
32+
/>
2733
<span>{!! trans('admin/categories/general.use_default_eula') !!}</span>
2834
</label>
2935
@else
3036
<label class="form-control form-control--disabled">
31-
{{ Form::checkbox('use_default_eula', '0', $useDefaultEula, ['wire:model.live' => 'useDefaultEula', 'class'=>'disabled','disabled' => 'disabled', 'aria-label'=>'use_default_eula']) }}
37+
<input
38+
type="checkbox"
39+
name="use_default_eula"
40+
value="0"
41+
wire:model.live="useDefaultEula"
42+
aria-label="use_default_eula"
43+
disabled
44+
/>
3245
<span>{!! trans('admin/categories/general.use_default_eula_disabled') !!}</span>
3346
</label>
3447
@endif
@@ -39,7 +52,13 @@
3952
<div class="form-group">
4053
<div class="col-md-9 col-md-offset-3">
4154
<label class="form-control">
42-
{{ Form::checkbox('require_acceptance', '1', $requireAcceptance, ['wire:model.live' => 'requireAcceptance', 'aria-label'=>'require_acceptance']) }}
55+
<input
56+
type="checkbox"
57+
name="require_acceptance"
58+
value="1"
59+
wire:model.live="requireAcceptance"
60+
aria-label="require_acceptance"
61+
/>
4362
{{ trans('admin/categories/general.require_acceptance') }}
4463
</label>
4564
</div>
@@ -49,7 +68,14 @@
4968
<div class="form-group">
5069
<div class="col-md-9 col-md-offset-3">
5170
<label class="form-control">
52-
{{ Form::checkbox('checkin_email', '1', $sendCheckInEmail, ['wire:model.live' => 'sendCheckInEmail', 'aria-label'=>'checkin_email', 'disabled' => $this->sendCheckInEmailDisabled]) }}
71+
<input
72+
type="checkbox"
73+
name="checkin_email"
74+
value="1"
75+
wire:model.live="sendCheckInEmail"
76+
aria-label="checkin_email"
77+
@disabled($this->sendCheckInEmailDisabled)
78+
/>
5379
{{ trans('admin/categories/general.checkin_email') }}
5480
</label>
5581
@if ($this->shouldDisplayEmailMessage)

resources/views/livewire/custom-field-set-default-values-for-model.blade.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@
1010
<div class="col-md-3">
1111
@if ($fieldset_id)
1212
<label class="form-control">
13-
14-
{{ Form::checkbox('add_default_values', 1, old('add_default_values', $add_default_values), ['data-livewire-component' => $this->getId(), 'id' => 'add_default_values', 'wire:model.live' => 'add_default_values', 'disabled' => $this->fields->isEmpty()]) }}
13+
<input
14+
type="checkbox"
15+
name="add_default_values"
16+
value="1"
17+
id="add_default_values"
18+
wire:model.live="add_default_values"
19+
data-livewire-component="{{ $this->getId() }}"
20+
@disabled($this->fields->isEmpty())
21+
/>
1522
{{ trans('admin/models/general.add_default_values') }}
1623
</label>
1724
@endif

0 commit comments

Comments
 (0)