[prev in list] [next in list] [prev in thread] [next in thread] 

List:       trac
Subject:    Re: [Trac] Reconfiguring / Overriding trac variables
From:       "Danny W. Adair" <danny.adair () unfold ! co ! nz>
Date:       2006-04-27 20:39:36
Message-ID: f08f80370604271339t25188b9bh70274209d9f2912f () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Noah,

thanks for the pointer. That looks simple indeed.

Cheers,
Danny

On 4/27/06, kantrn@rpi.edu <kantrn@rpi.edu> wrote:
>
> Writting such a plugin is very trivial, just look at how the TracCas
> plugin on trac-hacks works.
>
> --Noah
>
> ==============Original message text===============
> On Thu, 27 Apr 2006 1:49:37 EDT "Danny W. Adair" wrote:
>
> Hi,
>
> I'm integrating trac with a couple of other things (incl. Zope), using the
> Apache module mod_auth_tkt for single sign-on.
> My login/logout pages also take care of the trac cookies, and all of this
> actually works great!
>
> However, the "metanav navigation" in trac is not hardcoded anymore (I'm
> using 0.9.4 now), and I couldn't find an easy way to override the existing
> login/logout URLs.
> My current workaround is to change the "chrome.nav.metanav" items inside
> the
> header template, just before the menu bar is generated by nav():
>
> <?cs # Mangle navigation items for customized authentication ?>
> <?cs if:trac.authname == "anonymous" || !trac.authname ?>
> <?cs set:chrome.nav.metanav.login = 'logged in as ' + trac.authname ?>
> <?cs set:chrome.nav.metanav.logout = '<a href="/logout">Logout</a>'  ?>
> <?cs else ?>
> <?cs set:chrome.nav.metanav.login = 'not logged in' ?>
> <?cs set:chrome.nav.metanav.logout = '<a href="/login">Login</a>' ?>
> <?cs /if ?>
>
> That's not only ugly, it poses two other problems:
> 1. The actual trac variables trac.href.login/logout - from which metanav
> seems to be built - remain the same: if they are used somewhere else they
> will have the wrong value
> 2. I had to swap login and logout to make it prettier - adding to the
> confusion - because Clearsilver only knows "set", not "unset"/"del".
> Rebuilding the whole list seemed insane.
>
> Is there a way - let's say in trac.ini - to redefine trac.href.login
> /logout?
> Do I really have to write a plugin that replaces (though inherits 99% of)
> the existing login module?
>
> All I want to do is change the URLs - the actual auth is sorted!
>
> Cheers,
> Danny
> ===========End of original message text===========
>
>
>
> _______________________________________________
> Trac mailing list
> Trac@lists.edgewall.com
> http://lists.edgewall.com/mailman/listinfo/trac
>



--
Danny W. Adair
Director
Unfold Limited
New Zealand

Talk:         +64 4 472 1679
Fax:          +64 4 472 1680
Write:        danny.adair@unfold.co.nz
Browse:     www.unfold.co.nz
Visit/Post: 22a Clifton Terrace, Kelburn 6005, Wellington, New Zealand

[Attachment #5 (text/html)]

Hi Noah,<br>
<br>
thanks for the pointer. That looks simple indeed.<br>
<br>
Cheers,<br>
Danny<br><br><div><span class="gmail_quote">On 4/27/06, <b \
class="gmail_sendername"><a href="mailto:kantrn@rpi.edu">kantrn@rpi.edu</a></b> \
&lt;<a href="mailto:kantrn@rpi.edu">kantrn@rpi.edu</a>&gt; wrote:</span><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;"> Writting such a plugin is very trivial, just look at \
how the TracCas<br>plugin on trac-hacks \
works.<br><br>--Noah<br><br>==============Original message text===============<br>On \
Thu, 27 Apr 2006 1:49:37 EDT &quot;Danny W. Adair&quot; wrote: <br><br>Hi,<br><br>I'm \
integrating trac with a couple of other things (incl. Zope), using the<br>Apache \
module mod_auth_tkt for single sign-on.<br>My login/logout pages also take care of \
the trac cookies, and all of this<br> actually works great!<br><br>However, the \
&quot;metanav navigation&quot; in trac is not hardcoded anymore (I'm<br>using 0.9.4 \
now), and I couldn't find an easy way to override the existing<br>login/logout \
URLs.<br>My current workaround is to change the &quot; chrome.nav.metanav&quot; items \
inside the<br>header template, just before the menu bar is generated by \
nav():<br><br>&lt;?cs # Mangle navigation items for customized authentication \
?&gt;<br>&lt;?cs if:trac.authname == &quot;anonymous&quot; || !trac.authname ?&gt; \
<br>&lt;?cs set:chrome.nav.metanav.login = 'logged in as ' + trac.authname \
?&gt;<br>&lt;?cs set:chrome.nav.metanav.logout = '&lt;a \
href=&quot;/logout&quot;&gt;Logout&lt;/a&gt;'&nbsp;&nbsp;?&gt;<br>&lt;?cs else \
?&gt;<br>&lt;?cs set: chrome.nav.metanav.login = 'not logged in' ?&gt;<br>&lt;?cs \
set:chrome.nav.metanav.logout = '&lt;a href=&quot;/login&quot;&gt;Login&lt;/a&gt;' \
?&gt;<br>&lt;?cs /if ?&gt;<br><br>That's not only ugly, it poses two other problems: \
<br>1. The actual trac variables trac.href.login/logout - from which metanav<br>seems \
to be built - remain the same: if they are used somewhere else they<br>will have the \
wrong value<br>2. I had to swap login and logout to make it prettier - adding to the \
<br>confusion - because Clearsilver only knows &quot;set&quot;, not \
&quot;unset&quot;/&quot;del&quot;.<br>Rebuilding the whole list seemed \
insane.<br><br>Is there a way - let's say in trac.ini - to redefine trac.href.login \
/logout?<br>Do I really have to write a plugin that replaces (though inherits 99% \
of)<br>the existing login module?<br><br>All I want to do is change the URLs - the \
actual auth is sorted!<br><br>Cheers,<br>Danny<br>===========End of original message \
text=========== <br><br><br><br>_______________________________________________<br>Trac \
mailing list<br><a href="mailto:Trac@lists.edgewall.com">Trac@lists.edgewall.com</a><br><a \
href="http://lists.edgewall.com/mailman/listinfo/trac">http://lists.edgewall.com/mailman/listinfo/trac
 </a><br></blockquote></div><br><br clear="all"><br>-- <br>Danny W. \
Adair<br>Director<br>Unfold Limited<br>New \
Zealand<br><br>Talk:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +64 4 472 \
1679<br>Fax:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+64 4 472 \
1680<br>Write:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a \
href="mailto:danny.adair@unfold.co.nz"> \
danny.adair@unfold.co.nz</a><br>Browse:&nbsp;&nbsp;&nbsp;&nbsp; <a \
href="http://www.unfold.co.nz">www.unfold.co.nz</a><br>Visit/Post: 22a Clifton \
Terrace, Kelburn 6005, Wellington, New Zealand



_______________________________________________
Trac mailing list
Trac@lists.edgewall.com
http://lists.edgewall.com/mailman/listinfo/trac


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic