--- loncom/interface/lonwishlist.pm 2014/02/28 19:24:03 1.21 +++ loncom/interface/lonwishlist.pm 2014/05/31 16:01:33 1.22 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility-routines for wishlist # -# $Id: lonwishlist.pm,v 1.21 2014/02/28 19:24:03 bisitz Exp $ +# $Id: lonwishlist.pm,v 1.22 2014/05/31 16:01:33 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1361,16 +1361,30 @@ sub wishlistImport { foreach my $n (@$nodes) { my $index = $n->value()->nindex(); + + # + # Determine which resources in stored links may be imported into a course/community. + # (a) Import of directories in /res space is not supported. + # (b) Import of a resource into a community requires user has 'bro' privilege for resource + # (i.e., user has author or co-author role for corresponcding Authoring Space). + # (c) Import of a resource into a course requires user has 'be' privilege for resource. + # + if ($n->value()->path() =~ m{^(/res/$match_domain/$match_username/)}) { - if ($is_community) { - unless (&Apache::lonnet::allowed('bro',$n->value()->path())) { - $nopick{$n->value()->path()} = $n->value()->title(); - $$numskipped ++; - } + if ($n->value()->path() =~ m{/$}) { + $nopick{$n->value()->path()} = $n->value()->title(); + $$numskipped ++; } else { - unless (&Apache::lonnet::allowed('bre',$n->value()->path())) { - $nopick{$n->value()->path()} = $n->value()->title(); - $$numskipped ++; + if ($is_community) { + unless (&Apache::lonnet::allowed('bro',$n->value()->path())) { + $nopick{$n->value()->path()} = $n->value()->title(); + $$numskipped ++; + } + } else { + unless (&Apache::lonnet::allowed('bre',$n->value()->path())) { + $nopick{$n->value()->path()} = $n->value()->title(); + $$numskipped ++; + } } } }