Fossil SCM

Make sure auto-hyperlink works for anonymous.

drh 2016-08-18 11:03 trunk merge
Commit a2730fea395dd1a72d1cc3ac98ddd49f4173e97b
1 file changed +13 -2
+13 -2
--- src/login.c
+++ src/login.c
@@ -1005,17 +1005,18 @@
10051005
g.isHuman = 1;
10061006
}
10071007
10081008
/* Set the capabilities */
10091009
login_replace_capabilities(zCap, 0);
1010
- login_set_anon_nobody_capabilities();
10111010
10121011
/* The auto-hyperlink setting allows hyperlinks to be displayed for users
10131012
** who do not have the "h" permission as long as their UserAgent string
10141013
** makes it appear that they are human. Check to see if auto-hyperlink is
10151014
** enabled for this repository and make appropriate adjustments to the
1016
- ** permission flags if it is.
1015
+ ** permission flags if it is. This should be done before the permissions
1016
+ ** are (potentially) copied to the anonymous permission set; otherwise,
1017
+ ** those will be out-of-sync.
10171018
*/
10181019
if( zCap[0]
10191020
&& !g.perm.Hyperlink
10201021
&& g.isHuman
10211022
&& db_get_boolean("auto-hyperlink",1)
@@ -1022,10 +1023,20 @@
10221023
){
10231024
g.perm.Hyperlink = 1;
10241025
g.javascriptHyperlink = 1;
10251026
}
10261027
1028
+ /*
1029
+ ** At this point, the capabilities for the logged in user are not going
1030
+ ** to be modified anymore; therefore, we can copy them over to the ones
1031
+ ** for the anonymous user.
1032
+ **
1033
+ ** WARNING: In the future, please do not add code after this point that
1034
+ ** modifies the capabilities for the logged in user.
1035
+ */
1036
+ login_set_anon_nobody_capabilities();
1037
+
10271038
/* If the public-pages glob pattern is defined and REQUEST_URI matches
10281039
** one of the globs in public-pages, then also add in all default-perms
10291040
** permissions.
10301041
*/
10311042
zPublicPages = db_get("public-pages",0);
10321043
--- src/login.c
+++ src/login.c
@@ -1005,17 +1005,18 @@
1005 g.isHuman = 1;
1006 }
1007
1008 /* Set the capabilities */
1009 login_replace_capabilities(zCap, 0);
1010 login_set_anon_nobody_capabilities();
1011
1012 /* The auto-hyperlink setting allows hyperlinks to be displayed for users
1013 ** who do not have the "h" permission as long as their UserAgent string
1014 ** makes it appear that they are human. Check to see if auto-hyperlink is
1015 ** enabled for this repository and make appropriate adjustments to the
1016 ** permission flags if it is.
 
 
1017 */
1018 if( zCap[0]
1019 && !g.perm.Hyperlink
1020 && g.isHuman
1021 && db_get_boolean("auto-hyperlink",1)
@@ -1022,10 +1023,20 @@
1022 ){
1023 g.perm.Hyperlink = 1;
1024 g.javascriptHyperlink = 1;
1025 }
1026
 
 
 
 
 
 
 
 
 
 
1027 /* If the public-pages glob pattern is defined and REQUEST_URI matches
1028 ** one of the globs in public-pages, then also add in all default-perms
1029 ** permissions.
1030 */
1031 zPublicPages = db_get("public-pages",0);
1032
--- src/login.c
+++ src/login.c
@@ -1005,17 +1005,18 @@
1005 g.isHuman = 1;
1006 }
1007
1008 /* Set the capabilities */
1009 login_replace_capabilities(zCap, 0);
 
1010
1011 /* The auto-hyperlink setting allows hyperlinks to be displayed for users
1012 ** who do not have the "h" permission as long as their UserAgent string
1013 ** makes it appear that they are human. Check to see if auto-hyperlink is
1014 ** enabled for this repository and make appropriate adjustments to the
1015 ** permission flags if it is. This should be done before the permissions
1016 ** are (potentially) copied to the anonymous permission set; otherwise,
1017 ** those will be out-of-sync.
1018 */
1019 if( zCap[0]
1020 && !g.perm.Hyperlink
1021 && g.isHuman
1022 && db_get_boolean("auto-hyperlink",1)
@@ -1022,10 +1023,20 @@
1023 ){
1024 g.perm.Hyperlink = 1;
1025 g.javascriptHyperlink = 1;
1026 }
1027
1028 /*
1029 ** At this point, the capabilities for the logged in user are not going
1030 ** to be modified anymore; therefore, we can copy them over to the ones
1031 ** for the anonymous user.
1032 **
1033 ** WARNING: In the future, please do not add code after this point that
1034 ** modifies the capabilities for the logged in user.
1035 */
1036 login_set_anon_nobody_capabilities();
1037
1038 /* If the public-pages glob pattern is defined and REQUEST_URI matches
1039 ** one of the globs in public-pages, then also add in all default-perms
1040 ** permissions.
1041 */
1042 zPublicPages = db_get("public-pages",0);
1043

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button