antville/code/File/securityFunction.js
Robert Gaggl 810666d5c8 - security-functions now demand user-object as argument
- added comments to functions
2001-12-10 22:54:44 +00:00

27 lines
731 B
JavaScript

/**
* check if user is allowed to edit this goodie
*/
function isEditDenied(usr) {
if (!usr.uid) {
usr.cache.referer = this.href("edit");
return ("Please login first!");
} else if (usr.isBlocked())
return ("Sorry, your account was disabled!");
else if (this.creator != usr && !this.weblog.isUserAdmin(usr))
return ("Sorry, this goodie belongs to someone else!");
return null;
}
/**
* check if user is allowed to delete this goodie
*/
function isDeleteDenied(usr) {
if (usr.isBlocked())
return ("Sorry, your account was disabled!");
else if (this.creator != usr && !this.weblog.isUserAdmin(usr))
return ("Sorry, this goodie belongs to someone else!");
return null;
}