[Arsperl-devel] ARSperl/example ChangePassword.pl, NONE, 1.1 ars_DateToJulianDate.pl, NONE, 1.1 get
Brought to you by:
jeffmurphy
From: Michiel B. <mb...@us...> - 2009-03-31 13:30:01
|
Update of /cvsroot/arsperl/ARSperl/example In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv3947 Added Files: ChangePassword.pl ars_DateToJulianDate.pl getCharSets.pl Log Message: added new examples: ChangePassword.pl, ars_DateToJulianDate.pl, getCharSets.pl --- NEW FILE: ChangePassword.pl --- #!/usr/bin/perl # # NAME # ChangePassword.pl server username password newpassword # # DESCRIPTION # This script allows a user to change his password. Since user accounts are just # plain records in a form we use the common getlistentry and setentry calls to # fetch the user's record and update the password field. # Note that on some systems permissions are set strangely and depending on # the type of license you have you might not be able to update your password # (Think Read Restricted licenses...) # Also on some systems the User form is renamed to something other than "User". # # AUTHOR # Michiel Beijen, Mansolutions, 2007. # use ARS; use strict; die "usage: ChangePassword.pl server username password newpassword\n" unless ( $#ARGV >= 3 ); my ( $server, $user, $password, $newpassword ) = ( shift, shift, shift, shift ); #Logging in to the server ( my $ctrl = ars_Login( $server, $user, $password ) ) || die "ars_Login: $ars_errstr"; # Creating qualifier to look up the entry ID of the username; Login Name field is 101. ( my $userqualifier = ars_LoadQualifier( $ctrl, "User", "'101' = \"$user\"" ) ) || die "ars_LoadQualifier(User): $ars_errstr"; # fetch the Entry ID for this user by using GetListEntry with the qualifier we # just specified, otherwise die. my @userentry = ars_GetListEntry( $ctrl, "User", $userqualifier, 0, 0 ); die "No such user $user? ($ars_errstr)\n" if ( $#userentry == -1 ); # Change the password for this user by setting field 102 (the password field) with the new value ars_SetEntry( $ctrl, "User", $userentry[0], 0, 102, $newpassword ) || die "Error updating password: $ars_errstr"; print "Password changed for user $user on server $server\n"; --- NEW FILE: ars_DateToJulianDate.pl --- #!/usr/local/bin/perl # # $Header: /cvsroot/arsperl/ARSperl/example/ars_DateToJulianDate.pl,v 1.1 2009/03/31 13:29:50 mbeijen Exp $ # # NAME # ars_DateToJulianDate.pl # # USAGE # ars_DateToJulianDate.pl [server] [username] [password] [year] [ month] [date] # # DESCRIPTION # Converts a year-month-date value to a JulianDate. # # AUTHOR # Michiel Beijen # # $Log: ars_DateToJulianDate.pl,v $ # Revision 1.1 2009/03/31 13:29:50 mbeijen # added new examples: ChangePassword.pl, ars_DateToJulianDate.pl, getCharSets.pl # # use ARS; use strict; die "usage: $0 server username password year month day\n" unless ( $#ARGV >= 5 ); my ( $server, $user, $password, $year, $month, $day, ) = ( shift, shift, shift, shift, shift, shift, ); #Logging in to the server ( my $ctrl = ars_Login( $server, $user, $password ) ) || die "ars_Login: $ars_errstr"; print "Converting year $year month $month day $day to Julian...\n"; ( my $juliandate = ars_DateToJulianDate( $ctrl, $year, $month, $day ) ) || die "ERR: $ars_errstr\n"; ars_Logoff($ctrl); print "The JulianDate value is $juliandate\n"; --- NEW FILE: getCharSets.pl --- #!/usr/local/bin/perl # # $Header: /cvsroot/arsperl/ARSperl/example/getCharSets.pl,v 1.1 2009/03/31 13:29:50 mbeijen Exp $ # # NAME # GetCharSets.pl # # USAGE # GetCharSets.pl [server] [username] [password] # # DESCRIPTION # Fetches and prints the charsets used by client and server # # AUTHOR # Michiel Beijen # # $Log: getCharSets.pl,v $ # Revision 1.1 2009/03/31 13:29:50 mbeijen # added new examples: ChangePassword.pl, ars_DateToJulianDate.pl, getCharSets.pl # # use ARS; use strict; die "usage: $0 server username password \n" unless ( $#ARGV >= 2 ); my ( $server, $user, $password, ) = ( shift, shift, shift ); # if you'd like to use UTF8: # $ENV{'LANG'} = "en_US.utf8"; #Logging in to the server ( my $ctrl = ars_Login( $server, $user, $password ) ) || die "ars_Login: $ars_errstr"; print "Fetching the charsets - easy...\n"; ( my $servercharset = ars_GetServerCharSet($ctrl) ) || die "ERR: $ars_errstr\n"; ( my $clientcharset = ars_GetClientCharSet($ctrl) ) || die "ERR: $ars_errstr\n"; ars_Logoff($ctrl); print "The server uses the $servercharset character set and the client uses $clientcharset.\n"; |