[Hippo-cms7-user] [HST] "preview only" modules

Niels van Kampenhout n.vankampenhout at onehippo.com
Wed Feb 11 01:20:32 CET 2009


Niels van Kampenhout wrote:
> Perhaps an easier solution would be to have the complete preview 
> shielded behind a login. Would that be possible? Users would still login 
> with their own CMS account.

I did a rather naive implementation of the above, and it works well (at 
least well enough for a proof of concept).

I created a servlet filter that checks if a user is logged in (by 
checking a session attribute). If not it forwards to a dedicated login 
page. This uses the login module I used earlier embedded in a webpage. 
The login module checks the username and password and sets the session 
attribute. The filter also sets a "preview" attribute on the current 
request.

Any module or JSP can now check for a logged in session, and the preview 
request attribute. If both conditions are true, the javascript that 
enables inline editing is loaded.

Niels




More information about the Hippo-cms7-user mailing list