Changeset 1062 for branches/2.0/LATMOS-Accounts-Web
- Timestamp:
- 07/24/12 11:18:18 (12 years ago)
- Location:
- branches/2.0/LATMOS-Accounts-Web
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web.pm
r861 r1062 27 27 28 28 # Configure the application. 29 30 my $config_file = '/etc/latmos-accounts/latmos-accounts-web.yml'; 31 if (-r $config_file ) { 32 __PACKAGE__->config( 'Plugin::ConfigLoader' => { 33 file => $config_file 34 } 35 ); 36 } 29 # 30 # Note that settings in LATMOS::Accounts::Web.yml (or other external 31 # configuration file that you set up manually) take precedence 32 # over this when using ConfigLoader. Thus configuration 33 # details given here can function as a default configuration, 34 # with a external configuration file acting as an override for 35 # local deployment. 37 36 38 37 # http://stackoverflow.com/questions/1664816/is-there-a-way-to-force-c-urifor-in-catalyst-to-generate-a-uri-that-begins-wit -
branches/2.0/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Users.pm
r861 r1062 79 79 if ($msg ne 'ok') { 80 80 $c->stash->{pmerror} = $msg . ', mot de passe inchangé'; 81 } elsif ($suser && $suser-> set_password($c->req->param('passwd'))) {81 } elsif ($suser && $suser->_set_password($c->req->param('passwd'))) { 82 82 $c->stash->{pmerror} = 'Mot de passe changé'; 83 83 $sync->commit; … … 162 162 $c->stash->{db} = $base; 163 163 $c->stash->{template} = 'users/my.tt'; 164 last; 164 165 }; 165 166 /^dump$/ and do { -
branches/2.0/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrFilter.pm
r861 r1062 19 19 group => [ qw(cn description gidNumber sutype) ], 20 20 site => [ qw(l) ], 21 nethost => [ qw(name cname otherName ip macaddr owner serialNumber) ],21 nethost => [ qw(name cname otherName ip macaddr owner) ], 22 22 netzone => [ qw(net group type site) ], 23 23 }; -
branches/2.0/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrForms.pm
r861 r1062 80 80 siteNick => [ 'Acronyme' ], 81 81 serialNumber => [ 'N° de série' ], 82 snNative => [ 'Nom d\'origine' ], 83 givenNameNative => [ 'Prénom d\'origine' ], 84 wWWHomePage => [ 'Site Web' ], 85 halReference => [ 'Référence HAL' ], 82 user => [ 'Utilisateur' ], 86 83 }; 87 84 … … 114 111 contratType 115 112 expire 116 ) ],117 },118 usermy => {119 name => 'My',120 attrs => [ qw(121 snNative122 givenNameNative123 wWWHomePage124 halReference125 113 ) ], 126 114 }, … … 175 163 serialNumber 176 164 owner 165 user 177 166 ip 178 167 macaddr … … 498 487 } 499 488 500 sub write_attributes {489 sub set_attrs { 501 490 my ($self) = @_; 502 my @attrs; 491 $self->{c}->req->param($self->label) or return; 492 my $prefix = $self->{object}->id . '_'; 493 my %fields; 503 494 foreach ($self->attributes) { 504 495 my $attr = ($self->{object} … … 506 497 : $self->base->attribute($self->otype, $_)) or next; 507 498 $attr->readonly and next; 508 push(@attrs, $_);509 }510 @attrs;511 }512 513 sub set_attrs {514 my ($self) = @_;515 $self->{c}->req->param($self->label) or return;516 my $prefix = $self->{object}->id . '_';517 my %fields;518 foreach ($self->write_attributes) {519 my $attr = ($self->{object}520 ? $self->{object}->attribute($_)521 : $self->base->attribute($self->otype, $_)) or next;522 499 if (($attrs->{$_}[1] || '') eq 'checkbox') { 523 500 $fields{$_} = $self->{c}->req->param("$prefix$_") ? 1 : 0; -
branches/2.0/LATMOS-Accounts-Web/root/html/groups/index.tt
r861 r1062 10 10 <table border="0"> 11 11 <tr><td colspan="2">[% groupslist.size %] groupes</td></tr> 12 <tr><th>Nom</th><th>Description</th>< th></th></tr>12 <tr><th>Nom</th><th>Description</th></tr> 13 13 [% FOREACH groupname = groupslist %] 14 14 [% group = db.get_object('group', groupname) %] 15 15 <tr> 16 <td><a href="[% c.uri_for('/groups', groupname) %]"> 17 <img src="[% c.uri_for('/static', 'icons', 'icon_edit.png') %]" 16 <td>[% group.id | html %]</td> 17 <td>[% group.get_c_field('description') | truncate(30) | html %] 18 <a href="[% c.uri_for('/groups', groupname) %]"> 19 <img src="[% c.uri_for('/static', 'icons', 'arrow-right.png') %]" 18 20 height="16" width="16" 19 21 alt="[% "edit " _ groupname | html %]"> 20 </a> [% group.id | html %]</td> 21 <td> 22 <span title="[% group.get_c_field('description') | html %]"> 23 [% group.get_c_field('description') | truncate(30) | html %] 24 </span> 25 </td> 22 </a></td> 26 23 </tr> 27 24 [% END %] -
branches/2.0/LATMOS-Accounts-Web/root/html/includes/form.tt
r861 r1062 13 13 <tr><th>[% form.attr_label(attr) %]</th><td>[% form.attr_field(attr) %]</td> 14 14 [% IF loop.last %] 15 [% IF form.write_attributes %]16 15 <tr><td colspan=2>[% form.submit %]</td></tr> 17 [% END %]18 16 </table> 19 17 </form> -
branches/2.0/LATMOS-Accounts-Web/root/html/includes/header.tt
r861 r1062 32 32 </span> 33 33 [% END %] 34 35 34 [% BLOCK user_flag %] 36 [% INCLUDE object_flag object = ouser %] 37 [% END %] 38 39 [% BLOCK object_flag %] 40 [% IF object.type == 'user' %] 41 [% IF object.get_attributes('unexported') %] 35 [% IF ouser.get_attributes('unexported') %] 42 36 <img src="[% c.uri_for('/static', 'icons', 'gtk-delete.png') %]" 43 37 class="notice" title="Ce compte est désactivé" alt="disable"> 44 [% ELSIF object.get_attributes('expired') %]38 [% ELSIF ouser.get_attributes('expired') %] 45 39 <img src="[% c.uri_for('/static', 'icons', 'emblem-urgent.png') %]" 46 class="notice" title="Ce compte est expiré ([% o bject.get_attributes('expired') %])" alt="expired">47 [% ELSIF object.get_attributes('expire') %]40 class="notice" title="Ce compte est expiré ([% ouser.get_attributes('expired') %])" alt="expired"> 41 [% ELSIF ouser.get_attributes('expire') %] 48 42 <img src="[% c.uri_for('/static', 'icons', 'appointment-new.png') %]" 49 class="notice" title="Ce compte est temporaire ([% object.get_attributes('expire') %])" alt="temporary"> 50 [% END %] 51 [% ELSE %] 52 [% IF object.get_attributes('unexported') %] 53 <img src="[% c.uri_for('/static', 'icons', 'gtk-delete.png') %]" 54 class="notice" title="Cette entrée est désactivés" alt="disable"> 55 [% END %] 43 class="notice" title="Ce compte est temporaire ([% ouser.get_attributes('expire') %])" alt="temporary"> 56 44 [% END %] 57 45 [% END %] … … 61 49 <div id="head"> 62 50 <div class="pmenu"> 63 [% IF c.config.company %] 64 Gestion informatique - [% c.config.company | html %] 65 [% ELSE %] 66 Gestion informatique 67 [% END %] 51 Gestion informatique du LATMOS 68 52 [% IF c.user.username %] 69 53 <span style="float:right; font-size: 0.5em;"> -
branches/2.0/LATMOS-Accounts-Web/root/html/nethosts/default.tt
r861 r1062 1 <!-- $Id: default.tt 3 673 2010-09-17 16:57:32Z nanardon $ -->1 <!-- $Id: default.tt 3055 2010-08-20 17:34:56Z nanardon $ --> 2 2 [% IF NOT nethost %] 3 3 No group [% nethostname | html %] found. … … 24 24 [% END %] 25 25 26 [% IF c.model('Accounts').db.check_acl('nethost', 'ip', 'w') %] 27 <tr><th>Ajouter une ip libre:</th> 26 28 <tr><td> 27 [% IF c.model('Accounts').db.check_acl('nethost', 'ip', 'w') %]28 <fieldset>29 <legend>Ajouter une ip libre:</legend>30 29 <form action="[% c.uri_for(nethostname) %]" method="POST"> 31 30 <label for="zone">Zone:</label> <select name="zone" id="zone"> … … 48 47 <input type="submit" name="addip"> 49 48 </form> 50 </ fieldset>49 </td></tr> 51 50 [% END %] 52 51 53 52 [% IF c.model('Accounts').db.check_acl('nethost', '@CREATE', 'w') %] 54 <fieldset><legend>Renommer la machine en:</legend> 53 <tr><th>Renommer la machine en:</th></tr> 54 <tr><td> 55 55 <form action="[% c.uri_for(nethostname) %]" method="POST"> 56 56 <input type="text" name="to"><br> … … 59 59 <input type="submit" name="rename"> 60 60 </form> 61 </ fieldset>61 </td></tr> 62 62 [% END %] 63 63 … … 75 75 // --> 76 76 </script> 77 < fieldset>78 < legend>Supprimer cet hÃŽte</legend>77 <tr><th>Supprimer cet hÃŽte</th></tr> 78 <tr><td> 79 79 <form action="[% c.uri_for(nethostname) %]" method="POST" onsubmit="return confirmSubmit()"> 80 <input type="image" name="delete" value="Supprimer" title="Supprimer" alt="effacer" src="[% 81 c.uri_for('/static', 'images', 'edit-delete.png') %]"> 82 <input type="hidden" name="delete" value="Supprimer"> 80 <input type="submit" name="delete" value="Supprimer"> 83 81 </form> 84 </ fieldset>82 </td></tr> 85 83 [% END %] 86 84 87 </td></tr>88 85 </table> 89 86 </div> -
branches/2.0/LATMOS-Accounts-Web/root/html/nethosts/index.tt
r861 r1062 9 9 10 10 <table border="0"> 11 <tr><td colspan=" 3">11 <tr><td colspan="2"> 12 12 [% IF initials %] 13 13 Pages: … … 22 22 [% END %] 23 23 </td></tr> 24 <tr><t d></td><th>Nom</th><th>Description</th></tr>24 <tr><th>Nom</th><th>Description</th></tr> 25 25 [% FOREACH nethostname = nethostlist %] 26 26 [% nethost = db.get_object('nethost', nethostname) %] 27 27 <tr> 28 <td>[% nethostname | html %]</td> 28 29 <td> 29 [% INCLUDE 'object_flag' object=nethost %]30 </td>31 <td>32 <a href="[% c.uri_for('/nethosts', nethostname) %]">33 <img src="[% c.uri_for('/static', 'icons', 'icon_edit.png') %]"34 height="16" width="16"35 alt="[% "edit " _ nethostname | html %]">36 </a>[% username | html %]37 [% nethostname | html %]38 30 [% IF nethost.get_attributes('owner') %] 39 31 (<a href="[% c.uri_for('/users', nethost.get_attributes('owner')) %]">[% nethost.get_attributes('owner') %]</a>) 40 32 [% END %] 41 </td>42 <td>43 <span title="[% nethost.get_attributes('description') | html %]">44 33 [% nethost.get_attributes('description') | truncate(20) | html %] 45 </span> 46 </td> 34 <a href="[% c.uri_for('/nethosts', nethostname) %]"> 35 <img src="[% c.uri_for('/static', 'icons', 'arrow-right.png') %]" 36 height="16" width="16" 37 alt="[% "edit " _ nethostname | html %]"> 38 </a></td> 47 39 </tr> 48 40 [% END %] -
branches/2.0/LATMOS-Accounts-Web/root/html/netzones/default.tt
r861 r1062 1 <!-- $Id: default.tt 3673 2010-09-17 16:57:32Z nanardon $ -->1 <!-- $Id: default.tt 2902 2010-08-07 13:49:21Z nanardon $ --> 2 2 [% IF NOT netzone %] 3 3 No group [% netzonename | html %] found. … … 22 22 <td> 23 23 [% END %] 24 [% ohost = c.model('Accounts').db.get_object('nethost', host) %]25 24 <a href="[% c.uri_for('/nethosts', host) %]">[% host | html %]</a><br> 26 [% INCLUDE object_flag object = ohost %]27 25 [% IF loop.last %] 28 26 </td> … … 38 36 <td> 39 37 [% END %] 40 [% ohost = c.model('Accounts').db.get_object('nethost', host) %] 41 <a href="[% c.uri_for('/nethosts', host) %]">[% host | html %]</a> 42 [% INCLUDE object_flag object = ohost %] 43 <br> 38 <a href="[% c.uri_for('/nethosts', host) %]">[% host | html %]</a><br> 44 39 [% IF loop.last %] 45 40 </td></tr> -
branches/2.0/LATMOS-Accounts-Web/root/html/netzones/index.tt
r861 r1062 18 18 <td> 19 19 <a href="[% c.uri_for('/netzones', netzonename) %]"> 20 <img src="[% c.uri_for('/static', 'icons', ' icon_edit.png') %]"20 <img src="[% c.uri_for('/static', 'icons', 'arrow-right.png') %]" 21 21 height="16" width="16" 22 22 alt="[% "edit " _ netzonename | html %]"> … … 33 33 [% netzonelist = db.search_objects('netzone', 'type=' _ netztype) %] 34 34 [% FOREACH netzonename = netzonelist.sort %] 35 [% netzone = db.get_object('netzone', netzonename) %]36 35 [% IF loop.first %] 37 <t r><th colspan="2">[% netztype | ucfirst | html %]</th></tr>38 <tr><th >Nom</th><th>Description</th></tr>36 <table> 37 <tr><th colspan="2">[% netztype | html %]</th></tr> 39 38 [% END %] 40 39 <tr> 40 <td>[% netzonename | html %]</td> 41 41 <td> 42 42 <a href="[% c.uri_for('/netzones', netzonename) %]"> 43 <img src="[% c.uri_for('/static', 'icons', ' icon_edit.png') %]"43 <img src="[% c.uri_for('/static', 'icons', 'arrow-right.png') %]" 44 44 height="16" width="16" 45 45 alt="[% "edit " _ netzonename | html %]"> 46 </a> 47 [% netzonename | html %] 48 </td> 49 <td> 50 <span title="[% netzone.get_c_field('description') | html %]"> 51 [% netzone.get_c_field('description') | truncate(20) | html %] 52 </span> 53 </td> 46 </a></td> 54 47 </tr> 55 48 [% IF loop.last %] 49 </table> 56 50 [% END %] 57 51 [% END %] -
branches/2.0/LATMOS-Accounts-Web/root/html/users/address.tt
r861 r1062 20 20 </form> 21 21 22 [% IF address.base.check_acl(address, '@DELETE', 'w') %]23 22 <table border=1><tr><td align="center"> 24 23 <form action="[% c.uri_for(username, subform) %]" method="POST"> … … 29 28 </form> 30 29 </td></tr></table> 31 [% END %]32 30 33 31 </div> -
branches/2.0/LATMOS-Accounts-Web/root/html/users/address_form.tt
r861 r1062 63 63 <td>[% form.attr_field('co', fieldtype) %]</td> 64 64 </tr> 65 [% IF form.write_attributes %]66 65 <tr> 67 66 <th></th> 68 <td> 69 [% form.submit %] 70 </td> 67 <td>[% form.submit %]</td> 71 68 </tr> 72 [% END %]73 69 </table> -
branches/2.0/LATMOS-Accounts-Web/root/html/users/index.tt
r861 r1062 9 9 10 10 <table border="0"> 11 <tr><td colspan=" 5">11 <tr><td colspan="3"> 12 12 [% IF initials %] 13 13 Pages: … … 22 22 [% END %] 23 23 </td></tr> 24 <tr><td></td><th>Login</th><th>Nom</th>< th>Description</th><th>Mail</th></tr>24 <tr><td></td><th>Login</th><th>Nom</th></tr> 25 25 [% FOREACH username = userslist %] 26 26 [% user = db.get_object('user', username) %] … … 29 29 [% INCLUDE 'user_flag' ouser=user %] 30 30 </td> 31 <td><a href="[% c.uri_for('/users', username) %]"> 32 <img src="[% c.uri_for('/static', 'icons', 'icon_edit.png') %]" 33 height="16" width="16" 34 alt="[% "edit " _ username | html %]"> 35 </a>[% username | html %]</td> 31 <td>[% username | html %]</td> 36 32 <td> 37 33 [% user.get_c_field('sn') | html %] 38 34 [% user.get_c_field('givenName') | html %] 39 </td> 40 <td> 41 <span title="[% user.get_c_field('description') | html %]"> 42 [% user.get_c_field('description') | truncate(20) | html %] 43 </span> 44 </td> 45 <td><span title="[% user.get_c_field('mail') | html %]"> 46 [% user.get_c_field('mail') | truncate(20) | html %]</span> 47 </td> 35 [% user.get_c_field('description') | truncate(20) | html %] 36 <a href="[% c.uri_for('/users', username) %]"> 37 <img src="[% c.uri_for('/static', 'icons', 'arrow-right.png') %]" 38 height="16" width="16" 39 alt="[% "edit " _ username | html %]"> 40 </a></td> 48 41 </tr> 49 42 [% END %] -
branches/2.0/LATMOS-Accounts-Web/root/html/users/my.tt
r861 r1062 1 <!-- $Id: my.tt 7943 2011-11-10 15:33:13Z nanardon $ -->1 <!-- $Id: my.tt 3103 2010-08-26 12:47:15Z nanardon $ --> 2 2 [% IF NOT user %] 3 3 No user [% username | html %] found. … … 6 6 <div id="objectform" class="objectform"> 7 7 [% INCLUDE 'users/menu.tt' %] 8 9 [% INCLUDE 'includes/form.tt'10 form = form11 form_uri = c.uri_for(username, subform) %]12 8 13 9 <div class="oform"> -
branches/2.0/LATMOS-Accounts-Web/root/html/users/passwd.tt
r861 r1062 3 3 [% INCLUDE 'users/menu.tt' %] 4 4 5 <script type="text/javascript">6 function check_passwd() {7 new Ajax.Updater(8 'perror',9 '[% c.uri_for('/ajax', 'cracklib', username) %]',10 { parameters: 'passwd=' + document.getElementById("passwd").value +11 '&cpasswd=' + document.getElementById("cpasswd").value }12 )13 }14 </script>15 16 5 <div id="oform"> 17 6 [% IF c.model('Accounts').db.check_acl(user, 'userPassword', 'w') %] 18 7 <form id="fpasswd" action="[% c.uri_for(username, subform) %]" method="POST"> 8 [% c.prototype.observe_form('fpasswd', { 9 url => c.uri_for('/ajax', 'cracklib', username), 10 update => 'perror', 11 frequency => 1, 12 }) %] 19 13 <table border="1"> 20 14 <tr> 21 15 <th>Nouveau mot de passe:</th> 22 <td><input type="password" name="passwd" id="passwd" onkeyup="check_passwd()"></td>16 <td><input type="password" name="passwd"></td> 23 17 </tr> 24 18 <tr> 25 19 <th>Confirmation:</th> 26 <td><input type="password" name="cpasswd" id="cpasswd" onkeyup="check_passwd()"></td>20 <td><input type="password" name="cpasswd"></td> 27 21 </tr> 28 22 <tr><td colspan="2"><span id="perror">[% pmerror | html %]</span></td></tr>
Note: See TracChangeset
for help on using the changeset viewer.