Compare commits

...

8 Commits

Author SHA1 Message Date
15747d8dfb Revert version to 2.1.4-dev
Some checks failed
Create Docker Image / Build Docker Image (arm64) (push) Has been cancelled
Create Docker Image / Build Docker Image (x86_64) (push) Has been cancelled
Create Docker Image / Final Docker Image Manifest (push) Has been cancelled
Create Docker Image / Test Application (x86_64) (push) Has been cancelled
2025-05-24 00:26:55 +10:00
9a6d80986a We should start resume the session with ApplicationSession before checking for Session keys in AllowAnonymous 2025-05-24 00:26:55 +10:00
fa989b8f10 Remove MEMCACHED startup, since it is no longer included in the container 2025-05-24 00:26:55 +10:00
4e991db8b1 Fix showing required attributes when required by a parent class of the entries objectclasses 2025-05-24 00:26:55 +10:00
181971acc4 Improvements to userPassword handling when redirecting back. No need to use old() when rendering attributes, since they have already been processed by display with any updates 2025-05-24 00:26:55 +10:00
3493504720 Fix exception 500 being raised 'Argument #1 () must be of type array' when creating new entries with a userPassword. Fixes #320 2025-05-24 00:26:55 +10:00
54f27d3d16 Fix grammar errors on home page :( 2025-05-24 00:26:55 +10:00
3c0eb876e4 In the 'Add New Attribute' select list, use the attributes LDAP name instead of its lowercased name 2025-05-24 00:26:55 +10:00
13 changed files with 46 additions and 27 deletions

View File

@ -106,11 +106,17 @@ class Attribute implements \Countable, \ArrayAccess
$this->_values = collect($values);
$this->_values_old = collect($values);
$this->oc = collect($oc);
$this->schema = (new Server)
$this->schema = config('server')
->schema('attributetypes',$name);
$this->oc = collect();
// Get the objectclass heirarchy for required attribute determination
foreach ($oc as $objectclass) {
$this->oc->push($objectclass);
$this->oc = $this->oc->merge(config('server')->schema('objectclasses',$objectclass)->getParents()->pluck('name'));
}
/*
# Should this attribute be hidden
if ($server->isAttrHidden($this->name))
@ -161,7 +167,7 @@ class Attribute implements \Countable, \ArrayAccess
// The current attribute values
'values' => ($this->no_attr_tags || $this->is_internal) ? $this->tagValues() : $this->_values,
// The original attribute values
'values_old' => $this->no_attr_tags ? $this->tagValuesOld() : $this->_values_old,
'values_old' => ($this->no_attr_tags || $this->is_internal) ? $this->tagValuesOld() : $this->_values_old,
default => throw new \Exception('Unknown key:' . $key),
};
@ -338,6 +344,12 @@ class Attribute implements \Countable, \ArrayAccess
->with('updated',$updated);
}
/**
* Return the value of the original old values
*
* @param string $dotkey
* @return string|null
*/
public function render_item_old(string $dotkey): ?string
{
return match ($this->schema->syntax_oid) {
@ -348,6 +360,12 @@ class Attribute implements \Countable, \ArrayAccess
};
}
/**
* Return the value of the new values, which would include any pending udpates
*
* @param string $dotkey
* @return string|null
*/
public function render_item_new(string $dotkey): ?string
{
return Arr::get($this->values->dot(),$dotkey);
@ -366,6 +384,12 @@ class Attribute implements \Countable, \ArrayAccess
: collect();
}
/**
* Return the new values for this attribute, which would include any pending updates
*
* @param string $tag
* @return Collection
*/
public function tagValues(string $tag=Entry::TAG_NOTAG): Collection
{
return collect($this->_values
@ -373,6 +397,12 @@ class Attribute implements \Countable, \ArrayAccess
->get($tag,[]));
}
/**
* Return the original values for this attribute, as stored in the LDAP server
*
* @param string $tag
* @return Collection
*/
public function tagValuesOld(string $tag=Entry::TAG_NOTAG): Collection
{
return collect($this->_values_old

View File

@ -114,7 +114,7 @@ class HomeController extends Controller
$o = new Entry;
$o->setDn($dn);
foreach ($request->except(['_token','key','step','rdn','rdn_value']) as $key => $value)
foreach ($request->except(['_token','key','step','rdn','rdn_value','userpassword_hash']) as $key => $value)
$o->{$key} = array_filter($value);
try {

View File

@ -16,8 +16,8 @@ return Application::configure(basePath: dirname(__DIR__))
$middleware->appendToGroup(
group: 'web',
middleware: [
AllowAnonymous::class,
ApplicationSession::class,
AllowAnonymous::class,
SwapinAuthUser::class,
ViewVariables::class,
CheckUpdate::class,

View File

@ -7,7 +7,6 @@ php=${PHP_DIR:-/app}
composer=${COMPOSER_HOME:-/var/cache/composer}
SITE_USER=${SITE_USER:-www-data}
MEMCACHED_START=${MEMCACHED_START:-FALSE}
RUN_USER=$(id -u)
[ "${RUN_USER}" = "0" ] && USE_SU=1
@ -40,12 +39,6 @@ echo "* Started with [$@]"
# Run any container setup
[ -x /sbin/init-container ] && /sbin/init-container
# General Setup
if [ -x /usr/bin/memcached -a "${MEMCACHED_START}" == "TRUE" ]; then
echo "* Starting MEMCACHED..."
/usr/bin/memcached -d -P /run/memcached/memcached.pid -u memcached
fi
# Laravel Specific
if [ -r artisan -a -e ${php}/.env ]; then
echo "* Laravel Setup..."

View File

@ -1 +1 @@
v2.1.3-rel
v2.1.4-dev

View File

@ -1,5 +1,3 @@
@use(App\Ldap\Entry)
<!-- $o=Attribute::class -->
<x-attribute.layout :edit="$edit=($edit ?? FALSE)" :new="$new=($new ?? FALSE)" :o="$o">
<div class="col-12">

View File

@ -1,10 +1,9 @@
<!-- @todo We are not handling redirect backs yet with updated passwords -->
<!-- $o=KrbPrincipleKey::class -->
<x-attribute.layout :edit="$edit" :new="$new" :o="$o">
@foreach($o->tagValuesOld($langtag) as $key => $value)
@foreach(($o->tagValues($langtag)->count() ? $o->tagValues($langtag) : [$langtag => NULL]) as $key => $value)
@if($edit)
<div class="input-group has-validation mb-3">
<input type="password" @class(['form-control','is-invalid'=>($e=$errors->get($o->name_lc.'.'.$langtag.'.'.$loop->index)),'mb-1','border-focus'=>! $o->tagValuesOld($langtag)->contains($value),'bg-success-subtle'=>$updated]) name="{{ $o->name_lc }}[{{ $langtag }}][]" value="{{ md5($value) }}" @readonly(! $new)>
<input type="password" @class(['form-control','is-invalid'=>($e=$errors->get($o->name_lc.'.'.$langtag.'.'.$loop->index)),'mb-1','border-focus'=>! $o->tagValuesOld($langtag)->contains($value),'bg-success-subtle'=>$updated]) name="{{ $o->name_lc }}[{{ $langtag }}][]" value="{{ Arr::get(old($o->name_lc),$langtag.'.'.$loop->index,$value ? md5($value) : '') }}" @readonly(! $new)>
<div class="invalid-feedback pb-2">
@if($e)

View File

@ -1,6 +1,6 @@
<!-- $o=KrbTicketFlags::class -->
<x-attribute.layout :edit="$edit" :new="$new" :o="$o">
@foreach(Arr::get(old($o->name_lc,[$langtag=>$o->tagValues($langtag)]),$langtag,[]) as $key => $value)
@foreach(($o->tagValues($langtag)->count() ? $o->tagValues($langtag) : [$langtag => NULL]) as $key => $value)
@if($edit)
<div id="32"></div>
<div id="16"></div>

View File

@ -1,6 +1,6 @@
<!-- $o=Attribute/ObjectClass::class -->
<x-attribute.layout :edit="$edit" :new="$new" :o="$o">
@foreach(Arr::get(old($o->name_lc,[$langtag=>$new ? [NULL] : $o->tagValues($langtag)]),$langtag,[]) as $key => $value)
@foreach(($o->tagValues($langtag)->count() ? $o->tagValues($langtag) : [$langtag => NULL]) as $key => $value)
@if($edit)
<x-attribute.widget.objectclass :o="$o" :edit="$edit" :new="$new" :langtag="$langtag" :updated="$updated" :value="$value" :loop="$loop" />
@else

View File

@ -1,11 +1,10 @@
<!-- @todo We are not handling redirect backs yet with updated passwords -->
<!-- $o=Password::class -->
<x-attribute.layout :edit="$edit" :new="$new" :o="$o">
@foreach(Arr::get(old($o->name_lc,[$langtag=>$new ? [NULL] : $o->tagValues($langtag)]),$langtag,[]) as $key => $value)
@foreach(($o->tagValues($langtag)->count() ? $o->tagValues($langtag) : [$langtag => NULL]) as $key => $value)
@if($edit)
<div class="input-group has-validation mb-3">
<x-form.select id="userpassword_hash_{{$loop->index}}" name="userpassword_hash[{{ $langtag }}][]" :value="$o->hash($new ? '' : $value)->id()" :options="$helpers" allowclear="false" :disabled="! $new"/>
<input type="password" @class(['form-control','is-invalid'=>($e=$errors->get($o->name_lc.'.'.$langtag.'.'.$loop->index)),'mb-1','border-focus'=>! $o->tagValuesOld($langtag)->contains($value),'bg-success-subtle'=>$updated]) name="{{ $o->name_lc }}[{{ $langtag }}][]" value="{{ md5($value) }}" @readonly(! $new)>
<input type="password" @class(['form-control','is-invalid'=>($e=$errors->get($o->name_lc.'.'.$langtag.'.'.$loop->index)),'mb-1','border-focus'=>! $o->tagValuesOld($langtag)->contains($value),'bg-success-subtle'=>$updated]) name="{{ $o->name_lc }}[{{ $langtag }}][]" value="{{ Arr::get(old($o->name_lc),$langtag.'.'.$loop->index,$value ? md5($value) : '') }}" @readonly(! $new)>
<div class="invalid-feedback pb-2">
@if($e)

View File

@ -1,6 +1,6 @@
<!-- $o=RDN::class -->
<x-attribute.layout :edit="$edit" :new="$new" :o="$o">
@foreach(($o->values->count() ? $o->values : ['']) as $value)
@foreach(($o->values->count() ? $o->values : [NULL]) as $value)
@if($edit)
<div class="input-group has-validation mb-3">
<select class="form-select @error('rdn')is-invalid @enderror" id="rdn" name="rdn">

View File

@ -13,7 +13,7 @@
<div class="row">
<div class="col-12 pt-2">
<x-form.select id="newattr" label="Select from..." :options="$o->getMissingAttributes()->sortBy('name')->unique('name')->map(fn($item)=>['id'=>$item->name,'value'=>$item->name_lc])"/>
<x-form.select id="newattr" label="Select from..." :options="$o->getMissingAttributes()->sortBy('name')->unique('name')->map(fn($item)=>['id'=>$item->name,'value'=>$item->name])"/>
</div>
</div>
</div>

View File

@ -62,7 +62,7 @@
<i class="fas fa-fw fa-file-export me-2"></i> LDIF Import/Export
</li>
<li class="ps-0 p-1">
<i class="fas fa-fw fa-clipboard-list me-2"></i> Build on RFC Standards
<i class="fas fa-fw fa-clipboard-list me-2"></i> Built using RFC Standards
</li>
<li class="ps-0 p-1">
<i class="fas fa-fw fa-pen-to-square me-2"></i> Open Source