- security-functions now demand user-object as argument
- added comments to functions
This commit is contained in:
parent
1ca61a1c5c
commit
7991672d92
1 changed files with 15 additions and 8 deletions
|
@ -1,19 +1,23 @@
|
||||||
/**
|
/**
|
||||||
* check if user is allowed to delete a comment
|
* check if user is allowed to delete a comment
|
||||||
|
* @param Obj Userobject
|
||||||
|
* @return String Reason for denial (or null if allowed)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isDeleteDenied() {
|
function isDeleteDenied(usr) {
|
||||||
if (!this.weblog.isUserAdmin())
|
if (!this.weblog.isUserAdmin(usr))
|
||||||
return ("You're not admin of this weblog, so you can't delete any postings!");
|
return ("You're not admin of this weblog, so you can't delete any postings!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if user is allowed to edit a comment
|
* check if user is allowed to edit a comment
|
||||||
|
* @param Obj Userobject
|
||||||
|
* @return String Reason for denial (or null if allowed)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isEditDenied() {
|
function isEditDenied(usr) {
|
||||||
if (this.author != user && !this.weblog.isUserAdmin())
|
if (this.author != usr && !this.weblog.isUserAdmin(usr))
|
||||||
return ("Sorry, you're not allowed to edit a posting of somebody else!");
|
return ("Sorry, you're not allowed to edit a posting of somebody else!");
|
||||||
else if (!this.weblog.hasDiscussions())
|
else if (!this.weblog.hasDiscussions())
|
||||||
return ("Sorry, discussions were disabled for this weblog!");
|
return ("Sorry, discussions were disabled for this weblog!");
|
||||||
|
@ -22,21 +26,24 @@ function isEditDenied() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if user is allowed to reply to a comment
|
* 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())
|
if (!this.weblog.hasDiscussions())
|
||||||
return ("Sorry, discussions were disabled for this weblog!");
|
return ("Sorry, discussions were disabled for this weblog!");
|
||||||
else if (!user.uid) {
|
else if (!usr.uid) {
|
||||||
user.cache.referer = this.href("reply");
|
usr.cache.referer = this.href("reply");
|
||||||
return ("Please login first!");
|
return ("Please login first!");
|
||||||
} else if (user.isBlocked())
|
} else if (usr.isBlocked())
|
||||||
return ("Sorry, your account was disabled!");
|
return ("Sorry, your account was disabled!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function explicitly allowes some macros for use in the text of a story
|
* function explicitly allowes some macros for use in the text of a story
|
||||||
|
* @param Obj Skin-object to allow macros for
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function allowTextMacros(s) {
|
function allowTextMacros(s) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue