[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

banghart lon-capa-cvs@mail.lon-capa.org
Wed, 03 Nov 2004 21:12:12 -0000


banghart		Wed Nov  3 16:12:12 2004 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  	mark_as_readonly seems to work (superficially tested),
  	unmark_as_readonly still untested
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.559 loncom/lonnet/perl/lonnet.pm:1.560
--- loncom/lonnet/perl/lonnet.pm:1.559	Tue Nov  2 19:11:42 2004
+++ loncom/lonnet/perl/lonnet.pm	Wed Nov  3 16:12:12 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.559 2004/11/03 00:11:42 banghart Exp $
+# $Id: lonnet.pm,v 1.560 2004/11/03 21:12:12 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3786,10 +3786,10 @@
 sub mark_as_readonly {
     my ($domain,$user,$files,$what) = @_;
     my %current_permissions = &Apache::lonnet::dump('file_permissions',$domain,$user);
-    foreach my $file ($files) {
-        $current_permissions{$file}.=':'.$what.':';
+    foreach my $file (@{$files}) {
+        push (@{$current_permissions{$file}},$what);
     }
-    &Apache::lonnet::put('file_permissions',{ 'locked_files' => %current_permissions },$domain,$user);
+    &Apache::lonnet::put('file_permissions',\%current_permissions,$domain,$user);
     return;
 }
 
@@ -3797,9 +3797,9 @@
 
 sub unmark_as_readonly {
     my ($domain,$user,$file,$what) = @_;
-    my $current_permissions = &Apache::lonnet::get('file_permissions',$file,$domain,$user);
-    $current_permissions =~ s/:$file://;
-    &Apache::lonnet::put('file_permissions',{ $file => $current_permissions },$domain,$user);
+    my $current_permissions = &Apache::lonnet::dump('file_permissions',$domain,$user);
+    
+    &Apache::lonnet::put('file_permissions',$current_permissions,$domain,$user);
     return;
 }