[LON-CAPA-cvs] cvs: loncom(version_2_11_X) / lond
raeburn
raeburn at source.lon-capa.org
Sun Mar 19 23:21:08 EDT 2017
raeburn Mon Mar 20 03:21:08 2017 EDT
Modified files: (Branch: version_2_11_X)
/loncom lond
Log:
- For 2.11
- Backport 1.534
Index: loncom/lond
diff -u loncom/lond:1.489.2.26 loncom/lond:1.489.2.27
--- loncom/lond:1.489.2.26 Mon Mar 13 19:09:32 2017
+++ loncom/lond Mon Mar 20 03:21:08 2017
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.489.2.26 2017/03/13 19:09:32 raeburn Exp $
+# $Id: lond,v 1.489.2.27 2017/03/20 03:21:08 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -64,7 +64,7 @@
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.489.2.26 $'; #' stupid emacs
+my $VERSION='$Revision: 1.489.2.27 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid="default";
my $currentdomainid;
@@ -3790,6 +3790,37 @@
my ($query,$arg1,$arg2,$arg3)=split(/\:/,$tail);
$query=~s/\n*$//g;
+ if (($query eq 'usersearch') || ($query eq 'instdirsearch')) {
+ my $usersearchconf = &get_usersearch_config($currentdomainid,'directorysrch');
+ my $earlyout;
+ if (ref($usersearchconf) eq 'HASH') {
+ if ($currentdomainid eq $clienthomedom) {
+ if ($query eq 'usersearch') {
+ if ($usersearchconf->{'lcavailable'} eq '0') {
+ $earlyout = 1;
+ }
+ } else {
+ if ($usersearchconf->{'available'} eq '0') {
+ $earlyout = 1;
+ }
+ }
+ } else {
+ if ($query eq 'usersearch') {
+ if ($usersearchconf->{'lclocalonly'}) {
+ $earlyout = 1;
+ }
+ } else {
+ if ($usersearchconf->{'localonly'}) {
+ $earlyout = 1;
+ }
+ }
+ }
+ }
+ if ($earlyout) {
+ &Reply($client, "query_not_authorized\n");
+ return 1;
+ }
+ }
&Reply($client, "". &sql_reply("$clientname\&$query".
"\&$arg1"."\&$arg2"."\&$arg3")."\n",
$userinput);
@@ -7756,6 +7787,18 @@
return;
}
+sub get_usersearch_config {
+ my ($dom,$name) = @_;
+ my ($usersearchconf,$cached)=&Apache::lonnet::is_cached_new($name,$dom);
+ if (defined($cached)) {
+ return $usersearchconf;
+ } else {
+ my %domconfig = &Apache::lonnet::get_dom('configuration',['directorysrch'],$dom);
+ &Apache::lonnet::do_cache_new($name,$dom,$domconfig{'directorysrch'},3600);
+ return $domconfig{'directorysrch'};
+ }
+ return;
+}
sub distro_and_arch {
return $dist.':'.$arch;
More information about the LON-CAPA-cvs
mailing list