diff --git a/app/Ldap/Entry.php b/app/Ldap/Entry.php index 3006d58..d2a507c 100644 --- a/app/Ldap/Entry.php +++ b/app/Ldap/Entry.php @@ -197,7 +197,7 @@ class Entry extends Model } } - $sort = collect(config('ldap.attr_display_order',[]))->map(fn($item)=>strtolower($item)); + $sort = collect(config('pla.attr_display_order',[]))->map(fn($item)=>strtolower($item)); // Order the attributes return $result->sortBy([function(Attribute $a,Attribute $b) use ($sort): int { @@ -215,7 +215,7 @@ class Entry extends Model if ($b_key === FALSE) $b_key = $sort->count()+1; - // Case where neither $a, nor $b are in ldap.attr_display_order, $a_key = $b_key = one greater than num elements. + // Case where neither $a, nor $b are in pla.attr_display_order, $a_key = $b_key = one greater than num elements. // So we sort them alphabetically if ($a_key === $b_key) return strcasecmp($a->name,$b->name); diff --git a/app/Ldap/Rules/LoginObjectclassRule.php b/app/Ldap/Rules/LoginObjectclassRule.php index e7e1eec..b745393 100644 --- a/app/Ldap/Rules/LoginObjectclassRule.php +++ b/app/Ldap/Rules/LoginObjectclassRule.php @@ -16,7 +16,7 @@ class LoginObjectclassRule implements Rule { public function passes(LdapRecord $user, Eloquent $model = null): bool { - if ($x=config('ldap.login.objectclass')) { + if ($x=config('pla.login.objectclass')) { return count(array_intersect($user->objectclass,$x)); // Otherwise allow the user to login diff --git a/app/helpers.php b/app/helpers.php index f172adb..259f139 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -4,12 +4,12 @@ use Illuminate\Support\Arr; function login_attr_description(): string { - return Arr::get(config('ldap.login.attr'),login_attr_name()); + return Arr::get(config('pla.login.attr'),login_attr_name()); } function login_attr_name(): string { - return key(config('ldap.login.attr')); + return key(config('pla.login.attr')); } /** diff --git a/config/ldap.php b/config/ldap.php index 976daa1..c31183b 100644 --- a/config/ldap.php +++ b/config/ldap.php @@ -72,57 +72,6 @@ return [ 'time' => env('LDAP_CACHE_TIME',5*60), // Seconds ], - /* - |-------------------------------------------------------------------------- - | Support for attrs display order - |-------------------------------------------------------------------------- - | - | Use this array if you want to have your attributes displayed in a specific - | order. Case is not important. - | - | For example, "sn" will be displayed right after "givenName". All the other - | attributes that are not specified in this array will be displayed after in - | alphabetical order. - | - */ - - 'attr_display_order' => [], - /* - 'attr_display_order' => [ - 'givenName', - 'sn', - 'cn', - 'displayName', - 'uid', - 'uidNumber', - 'gidNumber', - 'homeDirectory', - 'mail', - 'userPassword' - ], - */ - - /* - * If 'login,attr' is used above such that phpLDAPadmin will search for your DN - * at login, you may restrict the search to a specific objectClasses. EG, set this - * to array('posixAccount') or array('inetOrgPerson',..), depending upon your - * setup. - */ - 'login' => [ - 'attr' => [env('LDAP_LOGIN_ATTR','uid') => env('LDAP_LOGIN_ATTR_DESC','User ID')], // Attribute used to find user for login - 'objectclass' => explode(',',env('LDAP_LOGIN_OBJECTCLASS', 'posixAccount')), // Objectclass that users must contain to login - ], - - /* - |-------------------------------------------------------------------------- - | Custom Date Format - |-------------------------------------------------------------------------- - | - | Configuration to determine how date fields will be displayed. - | - */ - 'datetime_format' => 'Y-m-d H:i:s', - /* |-------------------------------------------------------------------------- | Validation diff --git a/config/pla.php b/config/pla.php index 82b9d6e..ee1f135 100644 --- a/config/pla.php +++ b/config/pla.php @@ -1,7 +1,47 @@ [], + /* + 'attr_display_order' => [ + 'givenName', + 'sn', + 'cn', + 'displayName', + 'uid', + 'uidNumber', + 'gidNumber', + 'homeDirectory', + 'mail', + 'userPassword' + ], + */ + + /* + |-------------------------------------------------------------------------- + | Custom Date Format + |-------------------------------------------------------------------------- + | + | Configuration to determine how date fields will be displayed. + | + */ + 'datetime_format' => 'Y-m-d H:i:s', + + /* * These attributes will be forced to MAY attributes and become optional in the * templates. If they are not defined in the templates, then they wont appear * as per normal template processing. You may want to do this because your LDAP @@ -13,4 +53,15 @@ return [ # 'force_may' => ['uidNumber','gidNumber','sambaSID'], */ 'force_may' => [], + + /* + * If 'login,attr' is used above such that phpLDAPadmin will search for your DN + * at login, you may restrict the search to a specific objectClasses. EG, set this + * to array('posixAccount') or array('inetOrgPerson',..), depending upon your + * setup. + */ + 'login' => [ + 'attr' => [env('LDAP_LOGIN_ATTR','uid') => env('LDAP_LOGIN_ATTR_DESC','User ID')], // Attribute used to find user for login + 'objectclass' => explode(',',env('LDAP_LOGIN_OBJECTCLASS', 'posixAccount')), // Objectclass that users must contain to login + ], ]; \ No newline at end of file diff --git a/resources/views/components/attribute/internal/timestamp.blade.php b/resources/views/components/attribute/internal/timestamp.blade.php index 487ac36..e4278a4 100644 --- a/resources/views/components/attribute/internal/timestamp.blade.php +++ b/resources/views/components/attribute/internal/timestamp.blade.php @@ -1,5 +1,5 @@ @foreach (old($o->name_lc,$o->values) as $value) @if($loop->index)
@endif - {{ \Carbon\Carbon::createFromTimestamp(strtotime($value))->format(config('ldap.datetime_format','Y-m-d H:i:s')) }} + {{ \Carbon\Carbon::createFromTimestamp(strtotime($value))->format(config('pla.datetime_format','Y-m-d H:i:s')) }} @endforeach \ No newline at end of file