[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm

raeburn raeburn at source.lon-capa.org
Tue Nov 16 00:20:02 EST 2021


raeburn		Tue Nov 16 05:20:02 2021 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  - Modified roles/courses page when /adm/roles is error document for 406 
    (unauthorized access) and session was launched via deeplink, with 
    Roles/Courses link disabled in menu collection. 
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.354 loncom/auth/lonroles.pm:1.355
--- loncom/auth/lonroles.pm:1.354	Mon Nov 15 22:36:38 2021
+++ loncom/auth/lonroles.pm	Tue Nov 16 05:20:02 2021
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.354 2021/11/15 22:36:38 raeburn Exp $
+# $Id: lonroles.pm,v 1.355 2021/11/16 05:20:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1068,6 +1068,10 @@
         $recent = &mt('Recent Courses');
         $standby = &mt('Course selected. Please stand by.');
     }
+    if (($norolelist) && ((split(/:/,$env{'user.error.msg'}))[2])) {
+        $crumbtext = 'Access Denied';
+        $pagetitle = 'Unauthorized';
+    }
     my $brcrum =[{href=>"/adm/roles",text=>$crumbtext}];
 
     my %roles_in_env;
@@ -1104,11 +1108,13 @@
         $start_page=&Apache::loncommon::start_page($pagetitle,undef,
                                                   {bread_crumbs=>$brcrum,crstype=>'Placement'});
     } else {
-        $funcs = &get_roles_functions($showcount,$cattype);
-        my $crumbsright;
-        if ($env{'browser.mobile'}) {
-            $crumbsright = $funcs;
-            undef($funcs);
+        my $crumbsright);
+        unless (($norolelist) && ((split(/:/,$env{'user.error.msg'}))[2])) {
+            $funcs = &get_roles_functions($showcount,$cattype);
+            if ($env{'browser.mobile'}) {
+                $crumbsright = $funcs;
+                undef($funcs);
+            }
         }
         $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum,
                                                                      bread_crumbs_component=>$crumbsright});
@@ -1216,8 +1222,16 @@
     }
     if ($nochoose) {
 	$r->print("<h2>".&mt('Sorry ...')."</h2>\n<span class='LC_error'>".
-		  &mt('This action is currently not authorized.').'</span>'.
-		  &Apache::loncommon::end_page());
+		  &mt('This action is currently not authorized.').'</span>');
+        if ($error && $norolelist) {
+            $r->print('<br /><br /><h4><span class="LC_error">'.
+                      &mt('As your session was launched from a web page external to LON-CAPA some course content may be unavailable, including the resource you were trying to access.').
+                     '</span></h4>'.
+                     '<h4><span class="LC_error">'.
+                     &mt('You may need to login to LON-CAPA directly, or re-launch from a different external system.').
+                     '</span></h4>');
+        }
+        $r->print(&Apache::loncommon::end_page());
 	return OK;
     } else {
         if ($updateresult || $reqauthor || $hotlist) {




More information about the LON-CAPA-cvs mailing list