|
| 1 | +# HTML::FormFu::Model::LDAP - Integrate FormFu and LDAP |
| 2 | + |
| 3 | +`HTML::FormFu::Model::LDAP` is a module to integrate |
| 4 | +[HTML::FormFu](https://metacpan.org/pod/HTML::FormFu) (a form creation and |
| 5 | +validation framework) with the |
| 6 | +[LDAP](https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol) |
| 7 | +directory information services system. By integrating these systems, it is |
| 8 | +possible to set a form's default values from information gleaned from a |
| 9 | +given LDAP system as well as to update values in LDAP from a submitted form. |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +Currently, the best way to install this module is directly from its [GitHub |
| 14 | +repository](https://github.com/FormFu/HTML-FormFu-Model-LDAP). |
| 15 | + |
| 16 | +First, clone the repository: |
| 17 | + |
| 18 | +``` |
| 19 | +$ git clone https://github.com/FormFu/HTML-FormFu-Model-LDAP.git |
| 20 | +``` |
| 21 | + |
| 22 | +then change into the `HTML-FormFu-Model-LDAP/` directory, install the |
| 23 | +dependencies and build the `Makefile`: |
| 24 | + |
| 25 | +``` |
| 26 | +$ cd HTML-FormFu-Model-LDAP/ |
| 27 | +$ cpanm --installdeps . |
| 28 | +$ perl Makefile.PL |
| 29 | +``` |
| 30 | + |
| 31 | +If you wish, you can run the test suite like so: |
| 32 | + |
| 33 | +``` |
| 34 | +$ make test |
| 35 | +``` |
| 36 | + |
| 37 | +To install the distribution, simply run |
| 38 | + |
| 39 | +``` |
| 40 | +$ make install |
| 41 | +``` |
| 42 | + |
| 43 | +## Basic usage |
| 44 | + |
| 45 | +Make sure you set the form's default model for `HTML::FormFu` to `LDAP`: |
| 46 | + |
| 47 | +``` |
| 48 | +--- |
| 49 | +default_model: LDAP |
| 50 | +``` |
| 51 | + |
| 52 | +To set a form's default values from LDAP, use the `default_values()` method: |
| 53 | + |
| 54 | +```perl |
| 55 | +$form->model->default_values($ldap_entry); |
| 56 | +``` |
| 57 | + |
| 58 | +To update LDAP with values from a submitted form, simply call the `update()` |
| 59 | +method: |
| 60 | + |
| 61 | +```perl |
| 62 | +if ($form->submitted_and_valid) { |
| 63 | + $form->model->update($ldap_entry); |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +See the |
| 68 | +[HTML::FormFu::Model::DBIC documentation](https://metacpan.org/pod/HTML::FormFu::Model::DBIC) |
| 69 | +for more usage information. |
0 commit comments