[LON-CAPA-cvs] cvs: loncom /interface lonsearchcat.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Mon, 08 Jul 2002 14:28:10 -0000
matthew Mon Jul 8 10:28:10 2002 EDT
Modified files:
/loncom/interface lonsearchcat.pm
Log:
&output_results:
Added checks for copyright. This cannot be done in lonsql because
lonsql does not know the username & domain of the searcher.
Resources not able to be used by the current user are not displayed.
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.136 loncom/interface/lonsearchcat.pm:1.137
--- loncom/interface/lonsearchcat.pm:1.136 Fri Jul 5 14:56:52 2002
+++ loncom/interface/lonsearchcat.pm Mon Jul 8 10:28:10 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.136 2002/07/05 18:56:52 matthew Exp $
+# $Id: lonsearchcat.pm,v 1.137 2002/07/08 14:28:10 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1247,6 +1247,23 @@
chomp $result;
next unless $result;
%Fields = &parse_raw_result($result,$rkey);
+ #
+ # Check copyright tags and skip results the user cannot use
+ my (undef,undef,$resdom,$resname) = split('/',$Fields{'url'});
+ # Check for priv
+ if (($Fields{'copyright'} eq 'priv') &&
+ (($ENV{'user.name'} ne $resname) &&
+ ($ENV{'user.domain'} ne $resdom))) {
+$r->print("<pre>copyright = 'priv' -> Skipping $Fields{'url'}</pre>\n");
+ next;
+ }
+ # Check for domain
+ if (($Fields{'copyright'} eq 'domain') &&
+ ($ENV{'user.domain'} ne $resdom)) {
+$r->print("<pre>copyright = 'domain' -> Skipping $Fields{'url'}</pre>\n");
+ next;
+ }
+ #
$Fields{'extrashow'}=$extrashow;
if ($extrashow) {
foreach my $field (@customfields) {