POD conversion
authorJamie Cameron <jcameron@webmin.com>
Tue, 23 Dec 2008 23:56:46 +0000 (23:56 +0000)
committerJamie Cameron <jcameron@webmin.com>
Tue, 23 Dec 2008 23:56:46 +0000 (23:56 +0000)
passwd/passwd-lib.pl

index 57870cc..0f2c447 100644 (file)
@@ -1,12 +1,27 @@
-# passwd-lib.pl
-# Common functions for the password module
+=head1 passwd-lib.pl
+
+Functions to support the change passwords module. Some example code :
+
+ foreign_require('passwd', 'passwd-lib.pl');
+ $user = passwd::find_user('joe');
+ if ($user) {
+   passwd::change_password($user, 'smeg', 0);
+ }
+
+=cut
 
 do '../web-lib.pl';
 &init_config();
 do '../ui-lib.pl';
 %access = &get_module_acl();
 
-# can_edit_passwd(&user)
+=head2 can_edit_passwd(&user)
+
+Returns 1 if the current Webmin user can change the password for the Unix
+user whose details are in the given hash ref, which is in the format returned
+by useradmin::list_users.
+
+=cut
 sub can_edit_passwd
 {
 if ($access{'mode'} == 0) {
@@ -50,9 +65,12 @@ else {
        }
 }
 
-# find_user(name)
-# Looks up the user structure for some name, in the useradmin, ldap-useradmin
-# and nis modules
+=head2 find_user(name)
+
+Looks up the user structure for some name, in the useradmin, ldap-useradmin
+and nis modules, and returns it.
+
+=cut
 sub find_user
 {
 local $mod;
@@ -72,8 +90,14 @@ foreach $mod ([ "useradmin", "user-lib.pl" ],
 return undef;
 }
 
-# change_password(&user, pass, do-others)
-# Actually update a user's password
+=head2 change_password(&user, pass, do-others)
+
+Updates a user's password. The required parameters are :
+user - A hash ref of user details, in the format supplied by find_user
+pass - The new password, in plain text
+do-others - If set to 1, the password is changed in other Webmin modules too
+
+=cut
 sub change_password
 {
 local ($user, $pass, $others) = @_;