[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
banghart
lon-capa-cvs@mail.lon-capa.org
Wed, 03 Nov 2004 00:11:43 -0000
banghart Tue Nov 2 19:11:43 2004 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
Added mark_as_readonly and unmark_as_readonly. Not tested at all,
only saving work.
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.558 loncom/lonnet/perl/lonnet.pm:1.559
--- loncom/lonnet/perl/lonnet.pm:1.558 Tue Nov 2 18:22:47 2004
+++ loncom/lonnet/perl/lonnet.pm Tue Nov 2 19:11:42 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.558 2004/11/02 23:22:47 albertel Exp $
+# $Id: lonnet.pm,v 1.559 2004/11/03 00:11:42 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3781,6 +3781,27 @@
return $listing;
}
+# ------------------------------------------------------------- Mark as Read Only
+
+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.':';
+ }
+ &Apache::lonnet::put('file_permissions',{ 'locked_files' => %current_permissions },$domain,$user);
+ return;
+}
+
+# ------------------------------------------------------------ Unmark as Read Only
+
+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);
+ return;
+}
# ------------------------------------------------------------ Directory lister