]> sipb.mit.edu Git - ikiwiki.git/blob - doc/forum/TMPL__95__VAR_IS__95__ADMIN/comment_4_33143bad68f3f6beae963a3d0ec5d0bd._comment
Change Projects link to point to projects DB
[ikiwiki.git] / doc / forum / TMPL__95__VAR_IS__95__ADMIN / comment_4_33143bad68f3f6beae963a3d0ec5d0bd._comment
1 [[!comment format=mdwn
2  username="http://smcv.pseudorandom.co.uk/"
3  nickname="smcv"
4  subject="comment 4"
5  date="2011-02-23T16:19:28Z"
6  content="""
7 > ... at the time the templates are compiled there isn't a concept of who is accessing the page
8
9 Yes, this is the problem with what you're asking for.
10
11 > Is there a simple way to serve a different static page based on session information?
12
13 No, the thing serving the static pages is your web server; IkiWiki isn't involved
14 at all.
15
16 > I suppose I could try to compile two static sites, one for me and one for the world
17
18 I've done similar in the past with two setup files, under the same user ID, running
19 different checkouts of the same git repository - one for me, on https with
20 [[plugins/httpauth]], and one for the world, with only [[plugins/openid]]. You have
21 to make them write their git wrappers to different filenames, and make the real
22 git hook be a shell script that runs one wiki's wrapper, then the other, to refresh
23 both wikis when something gets committed.
24
25 It's a bit fiddly to admin (you have to duplicate most setup changes in the two
26 setup files), but can be made to work. I've given up on that in favour of having
27 a single wiki reachable from both http and https, with [[plugins/httpauth]]
28 only working over https.
29
30 > I get the feeling I may be asking it to do something it wasn't meant to do.
31
32 Pretty much, yes.
33
34 > If so I'd appreciate it if someone told me to stop trying.
35
36 I can help! \"Stop trying.\" :-)
37
38 But, if you want this functionality badly enough, one way you could get
39 it would be to have all the links on all the pages (for the benefit of
40 `NoScript` users), use Javascript to make an XMLHTTPRequest (or something)
41 to to a CGI action provided by a [[plugin|plugins/write]]
42 (`ikiwiki.cgi?do=amiadminornot` or something), and if that says the user
43 isn't an admin, hide some of the links to not confuse them.
44
45 That would break the normal way that people log in to ikiwiki (by trying
46 to do something that needs them logged-in, like editing), so you'd also
47 want to add a \"Log In\" button or link (or just remember that editing your
48 Preferences has the side-effect of logging you in).
49
50 Note that hiding the links isn't useful for security, only for
51 usability - the actual edit obviously needs to check whether the
52 user is a logged-in admin, and it already does.
53 """]]