I am new to modx and using it to create a website for our department at work. Fot this site we will have public facing general information along with private material that one must login to see.
I followed this tutorial on setting up "member's only" pages:
http://rtfm.modx.com/display/revolution20/Making+Member-Only+Pages
Using useful information I found about the Login snippet I found here:
http://rtfm.modx.com/display/ADDON/Login.Login
I then created the following chunk with an "IF" snippet call that prints whose (not) logged in and a login/login link.
[[!If?
&subject=`[[+modx.user.id]]`
&operator=`EQ`
&operand=`0`
&then=`<b>Not Logged In</b>   <a href="[[~34]]" id="login" title="logout">(login)</a>`
&else=`logged in as:    <b>[[+modx.user.username]]</b>   <a href="[[~34 &service=logout]]" id="logout" title="logout">(logout)</a>`
]]
After manually clearing the cache from the from the manager, it works great for the first login. After I follow the "logout" link, the user is logged out, but the username displayed (with the associated logout link) is still displayed on any page I visited while logged in as that user. If I go back and clear the cache, it works again for the first login.
It seems like this is due to the username/id not flushing/reseting in the cache after a logout, but perhaps it is something to do with my "if" conditional?
Once I have this working correctly, I would also like to restrict access to static resources (namely a Sphinx documentation site) I am linking to, based on the user's login status. The only way I have thought of doing this is by using Active Directory/LDAP authentication to modx, then also having AD/LDAP authentication to the directory that the site/resource resides in. Is there a better way of doing this?
In addition what is the best way of authenicating to modx using a Linux LDAP server?
Thanks for the help!!!
Some helpful info
----------------------------------------------
Web Server:
* PHP 5.3.3
* Apache 2.2.3
* CentosOS release 5.6
Database:
* mysql Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (x86_64) using readline 5.1
MODx:
* MODX Revolution 2.2.0-pl2 (traditional)
* Using plugin: TinyMCE, GalleryCustomTV
* Installed but not 'using': ActiveDirectory, ldapAuth
Browser/Client:
* Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.18) Gecko/20110622 CentOS/3.6-1.el5.centos Firefox/3.6.18