Require logged-in in order to revert a wiki page
authorArt Cancro <ajc@citadel.org>
Tue, 11 Jan 2011 04:41:27 +0000 (23:41 -0500)
committerArt Cancro <ajc@citadel.org>
Tue, 11 Jan 2011 04:41:27 +0000 (23:41 -0500)
citadel/modules/wiki/serv_wiki.c
webcit/wiki.c

index 6dcf880bae8e753dbb21b858e1b19ec7888e4ae6..1f171c588f54e01f44924e0ba0e8985818214e4e 100644 (file)
@@ -484,6 +484,14 @@ void wiki_rev(char *pagename, char *rev, char *operation)
                return;
        }
 
+       if (!strcasecmp(operation, "revert")) {
+               r = CtdlDoIHavePermissionToPostInThisRoom(temp, sizeof temp, NULL, POST_LOGGED_IN, 0);
+               if (r != 0) {
+                       cprintf("%d %s\n", r, temp);
+                       return;
+               }
+       }
+
        /* Begin by fetching the current version of the page.  We're going to patch
         * backwards through the diffs until we get the one we want.
         */
index faaf926c6dca126385918cabdd55b4052ca9312c..452fc82ec4df569a2c3b0012492567729a4a8fc4 100644 (file)
@@ -217,7 +217,7 @@ void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP)
                                        ChrPtr(rev_uuid),
                                        _("(show)")
                                );
-                               wc_printf("<td><a href=\"wiki?page=%s?rev=%s?revert=1\">%s</a></td>",
+                               wc_printf("<td><a href=\"javascript:GetLoggedInFirst(encodeURIComponent('wiki?page=%s?rev=%s?revert=1'))\">%s</a></td>",
                                        bstr("page"),
                                        ChrPtr(rev_uuid),
                                        _("(revert)")