antville/code/Root/new.hac
Robert Gaggl 82f06be359 (optional) limit creation of weblogs to sysAdmins or trusted users.
needs property "limitNewWeblogs" in app.properties (thanks to kris!)
2002-04-12 11:34:46 +00:00

26 lines
886 B
Text

checkIfLoggedIn(this.href(req.action));
var limit = getProperty("limitNewWeblogs").toLowerCase();
if (limit == "sysadmin" && !user.isSysAdmin ()) {
res.message = "Sorry! Only administrators are allowed to create new Weblogs."
res.redirect(root.href());
} else if (limit == "trusted" && !(user.isSysAdmin () || user.isTrusted ())) {
res.message = "Sorry! You are not allowed to create new Weblogs."
res.redirect(root.href());
}
if (req.data.submit == "cancel" || req.data.cancel)
res.redirect(root.href());
else if (req.data.submit == "create" || req.data.create) {
var result = this.evalWeblog(req.data.title,req.data.alias,user);
res.message = result.message;
if (!result.error)
res.redirect(result.weblog.href());
}
res.skin = "root.page";
res.data.title = "Antville";
var newLog = new weblog();
res.data.body = newLog.renderSkinAsString("new");