From f1ce6380b97ed5dccd750d2416e809e0086d89b1 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 12 May 2020 20:12:57 +0200 Subject: [PATCH] LSexample: now handle LSsysaccount and and allow it to connect --- .../config.LSobjects.LSsysaccount.php | 138 ++++++++++++++++++ src/conf/config.inc.php | 5 +- .../class/class.LSobjects.LSsysaccount.php | 30 ++++ 3 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 src/conf/LSobjects/config.LSobjects.LSsysaccount.php create mode 100644 src/includes/class/class.LSobjects.LSsysaccount.php diff --git a/src/conf/LSobjects/config.LSobjects.LSsysaccount.php b/src/conf/LSobjects/config.LSobjects.LSsysaccount.php new file mode 100644 index 00000000..8337792b --- /dev/null +++ b/src/conf/LSobjects/config.LSobjects.LSsysaccount.php @@ -0,0 +1,138 @@ + array( + 'top', + 'lssysaccount', + ), + 'rdn' => 'uid', + 'container_dn' => 'ou=sysaccounts', + + 'display_name_format' => '%{uid}', + 'label' => 'System accounts', + + 'LSsearch' => array ( + 'attrs' => array ( + 'uid', + 'description', + ), + ), + + // Attributes + 'attrs' => array ( + + /* ----------- start -----------*/ + 'uid' => array ( + 'label' => 'Identifier', + 'ldap_type' => 'ascii', + 'html_type' => 'text', + 'required' => 1, + 'check_data' => array ( + 'regex' => array( + 'msg' => "Identifier must contain alphanumeric values, dots (.) and dashes (-) only.", + 'params' => array('regex' => '/^[a-zA-Z0-9-_\.]*$/') + ), + ), + 'validation' => array ( + array ( + 'filter' => 'uid=%{val}', + 'result' => 0, + 'msg' => 'This identifier is already used.', + 'except_current_object' => true, + ) + ), + 'rights' => array( + 'self' => 'r', + 'admin' => 'w', + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ), + ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ + 'userPassword' => array ( + 'label' => 'Password', + 'ldap_type' => 'password', + 'ldap_options' => array ( + 'encode' => 'ssha' + ), + 'html_type' => 'password', + 'html_options' => array( + 'generationTool' => true, + 'viewHash' => true, + 'autoGenerate' => false, + 'lenght' => 12, + 'chars' => array ( + array( + 'nb' => 3, + 'chars' => 'abcdefijklmnopqrstuvwxyz' + ), + '0123456789', + '*$.:/_-[]{}=~' + ), + ), + 'check_data' => array( + 'password' => array( + 'msg' => 'This password must contain at least 12 characters.', + 'params' => array( + 'minLength' => 12, + ) + ) + ), + 'required' => 1, + 'rights' => array( + 'self' => 'w', + 'admin' => 'w' + ), + 'form' => array ( + 'modify' => 1, + 'create' => 1, + 'lostPassword' => 1 + ), + ), + /* ----------- end -----------*/ + + /* ----------- start -----------*/ + 'description' => array ( + 'label' => 'Description', + 'ldap_type' => 'ascii', + 'html_type' => 'textarea', + 'multiple' => 1, + 'rights' => array( + 'self' => 'r', + 'admin' => 'w', + ), + 'view' => 1, + 'form' => array ( + 'modify' => 1, + 'create' => 1 + ) + ), + /* ----------- end -----------*/ + + ) // Fin args +); diff --git a/src/conf/config.inc.php b/src/conf/config.inc.php index 00189bf1..aeb73c28 100644 --- a/src/conf/config.inc.php +++ b/src/conf/config.inc.php @@ -55,6 +55,7 @@ $GLOBALS['LSconfig'] = array( 'filter' => '(|(uid=%{user})(mail=%{user}))', 'password_attribute' => 'userPassword', ), + 'LSsysaccount', ), //'allow_multi_match' => false, // Allow username multiple match (default: false) ), @@ -89,7 +90,8 @@ $GLOBALS['LSconfig'] = array( 'cacheSearch' => true, 'LSaccess' => array( 'LSpeople', - 'LSgroup' + 'LSgroup', + 'LSsysaccount', ), 'recoverPassword' => array( 'mailAttr' => 'mail', @@ -147,6 +149,7 @@ $GLOBALS['LSconfig'] = array( 'LSpeople', 'LSgroup', 'LScompany' + 'LSsysaccount' ) ), 'LSobject' => array( diff --git a/src/includes/class/class.LSobjects.LSsysaccount.php b/src/includes/class/class.LSobjects.LSsysaccount.php new file mode 100644 index 00000000..f9520b81 --- /dev/null +++ b/src/includes/class/class.LSobjects.LSsysaccount.php @@ -0,0 +1,30 @@ + + */ +class LSsysaccount extends LSldapObject { + // ~ +}