- security-functions now demand user-object as argument

- added comments to functions
This commit is contained in:
Robert Gaggl 2001-12-10 22:38:46 +00:00
parent 1ca61a1c5c
commit 7991672d92

View file

@ -1,19 +1,23 @@
/**
* check if user is allowed to delete a comment
* @param Obj Userobject
* @return String Reason for denial (or null if allowed)
*/
function isDeleteDenied() {
if (!this.weblog.isUserAdmin())
function isDeleteDenied(usr) {
if (!this.weblog.isUserAdmin(usr))
return ("You're not admin of this weblog, so you can't delete any postings!");
return null;
}
/**
* check if user is allowed to edit a comment
* @param Obj Userobject
* @return String Reason for denial (or null if allowed)
*/
function isEditDenied() {
if (this.author != user && !this.weblog.isUserAdmin())
function isEditDenied(usr) {
if (this.author != usr && !this.weblog.isUserAdmin(usr))
return ("Sorry, you're not allowed to edit a posting of somebody else!");
else if (!this.weblog.hasDiscussions())
return ("Sorry, discussions were disabled for this weblog!");
@ -22,21 +26,24 @@ function isEditDenied() {
/**
* check if user is allowed to reply to a comment
* @param Obj Userobject
* @return String Reason for denial (or null if allowed)
*/
function isReplyDenied() {
function isReplyDenied(usr) {
if (!this.weblog.hasDiscussions())
return ("Sorry, discussions were disabled for this weblog!");
else if (!user.uid) {
user.cache.referer = this.href("reply");
else if (!usr.uid) {
usr.cache.referer = this.href("reply");
return ("Please login first!");
} else if (user.isBlocked())
} else if (usr.isBlocked())
return ("Sorry, your account was disabled!");
return null;
}
/**
* function explicitly allowes some macros for use in the text of a story
* @param Obj Skin-object to allow macros for
*/
function allowTextMacros(s) {