18 Sep 07:58
Re: Protected Page
Matthias L. Jugel <leo <at> mud.de>
2005-09-18 05:58:16 GMT
2005-09-18 05:58:16 GMT
This would need some hacking in 1.0b2-uttoxeter. It can be achieved
by using the label mechanism in conjunction with a small script.
It will only protect the content of the snip, not labels, attachments
or the meta-data, but its a start:
Create a Snip somewhere, like SnipSnap/SecuredContentViewer
Paste the following into this snip:
<%
org.snipsnap.app.Application app = org.snipsnap.app.Application.get();
org.snipsnap.user.User user = app.getUser();
org.snipsnap.user.Roles roles = new org.snipsnap.user.Roles();
roles.add(org.snipsnap.user.Roles.AUTHENTICATED);
if(org.snipsnap.user.Security.hasRoles(user, roles)) {
println(app.getParameters().get("viewed").getXMLContent());
} else {
println("You are not allowed to view the contents of this snip.");
}
%>
Then add a label to this snip, Select TypeLabel and use text/gsp as
type.
Go back to the normal view of this snip and click [lock] as an admin
user (important!)
Then go to the snip you want to protect:
add a TypeLabel and select anything (i.e. Summary) and select
(Continue reading)
RSS Feed