sub {
my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
my( $whom, $target ) = split( / /, $what, 2 );
-
+
unless( exists( $heap->{ 'useraccess' }->{ uc( $target ) } ) ) {
$kernel->post( $src, $replypath, "'$target' has no access; link not allowed.", $dest );
return;
}
-
- if( access2( $heap->{ 'useraccess' }, $target, {} ) > accessLevel( $kernel, $heap, $who ) ) {
+
+ if( access2( $heap->{ 'useraccess' }, $target, {} ) > accessLevel( $kernel, $heap, $who, $src ) ) {
$kernel->post( $src, $replypath, "You may not grant access exceeding your own.", $dest );
return;
}
if( $heap->{ 'users' }->{ uc( $who ) } eq md5_hex( $old ) ) {
$heap->{ 'users' }->{ uc( $who ) } = md5_hex( $new );
DumpFile( "users.yaml", $heap->{ 'users' } );
- $kernel->post( $src, $replypath, "Passwords changed.", $dest );
+ $kernel->post( $src, $replypath, "Password changed.", $dest );
} else {
$kernel->post( $src, $replypath, "Old passwords do not match.", $dest );
}
}
}
+SETPASSWORD: |-
+ sub {
+ use Digest::MD5 qw( md5_hex );
+ my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
+ my @args = split( / /, $what );
+ if( $#args != 1 ) {
+ $kernel->post( $src, $replypath, "USAGE: SETPASSWORD <user> <pass>", $dest );
+ return;
+ }
+ my( $whom, $pass ) = split( / /, $what );
+ if( exists( $heap->{ 'users' }->{ uc( $whom ) } ) ) {
+ $heap->{ 'users' }->{ uc( $who ) } = md5_hex( $pass );
+ DumpFile( "users.yaml", $heap->{ 'users' } );
+ $kernel->post( $src, $replypath, "Password changed.", $dest );
+ } else {
+ $kernel->post( $src, $replypath, "'$whom' is not registered.", $dest );
+ }
+ }
+
CONFIG: |-
sub {
my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
}
FLUSHURLS: |-
sub {
+ my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
$heap->{ 'urls' } = {};
$kernel->post( $src, $replypath, "URL cache flushed.", $dest );
}