--- loncom/lonnet/perl/lonnet.pm	2024/03/29 17:58:49	1.1172.2.146.2.20
+++ loncom/lonnet/perl/lonnet.pm	2024/08/19 00:27:52	1.1172.2.146.2.21
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1172.2.146.2.20 2024/03/29 17:58:49 raeburn Exp $
+# $Id: lonnet.pm,v 1.1172.2.146.2.21 2024/08/19 00:27:52 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3700,10 +3700,15 @@ sub can_edit_resource {
                     return;
                 }
             } elsif (!$crsedit) {
+                if ($env{'request.role'} =~ m{^st\./$cdom/$cnum}) {
 #
 # No edit allowed where CC has switched to student role.
 #
-                return;
+                    return;
+                } elsif (($resurl !~ m{^/res/$match_domain/$match_username/}) ||
+                         ($resurl =~ m{^/res/lib/templates/})) {
+                    return;
+                }
             }
         }
     }