- security-functions now demand user-object as argument
This commit is contained in:
parent
0cf855f457
commit
bfc3fef0f3
2 changed files with 11 additions and 11 deletions
|
@ -64,7 +64,7 @@ function url_macro(param) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function editlink_macro(param) {
|
function editlink_macro(param) {
|
||||||
if (!this.isEditDenied()) {
|
if (!this.isEditDenied(user)) {
|
||||||
res.write(param.prefix);
|
res.write(param.prefix);
|
||||||
var linkParam = new Object();
|
var linkParam = new Object();
|
||||||
linkParam.linkto = "edit";
|
linkParam.linkto = "edit";
|
||||||
|
@ -84,7 +84,7 @@ function editlink_macro(param) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function deletelink_macro(param) {
|
function deletelink_macro(param) {
|
||||||
if (!this.isDeleteDenied()) {
|
if (!this.isDeleteDenied(user)) {
|
||||||
res.write(param.prefix);
|
res.write(param.prefix);
|
||||||
var linkParam = new Object();
|
var linkParam = new Object();
|
||||||
linkParam.linkto = "delete";
|
linkParam.linkto = "delete";
|
||||||
|
@ -108,7 +108,7 @@ function show_macro(param) {
|
||||||
var img = this.thumbnail;
|
var img = this.thumbnail;
|
||||||
else
|
else
|
||||||
var img = this;
|
var img = this;
|
||||||
if (!this.isEditDenied()) {
|
if (!this.isEditDenied(user)) {
|
||||||
var linkParam = new Object();
|
var linkParam = new Object();
|
||||||
linkParam.linkto = "edit";
|
linkParam.linkto = "edit";
|
||||||
this.openLink(linkParam);
|
this.openLink(linkParam);
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
* check if user is allowed to edit this image
|
* check if user is allowed to edit this image
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isEditDenied() {
|
function isEditDenied(usr) {
|
||||||
if (!user.uid) {
|
if (!usr.uid) {
|
||||||
user.cache.referer = this.href("edit");
|
usr.cache.referer = this.href("edit");
|
||||||
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!");
|
||||||
else if (this.creator != user && !this.weblog.isUserAdmin())
|
else if (this.creator != usr && !this.weblog.isUserAdmin(usr))
|
||||||
return ("Sorry, this image belongs to someone else!");
|
return ("Sorry, this image belongs to someone else!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,10 @@ function isEditDenied() {
|
||||||
* check if user is allowed to delete this image
|
* check if user is allowed to delete this image
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isDeleteDenied() {
|
function isDeleteDenied(usr) {
|
||||||
if (user.isBlocked())
|
if (usr.isBlocked())
|
||||||
return ("Sorry, your account was disabled!");
|
return ("Sorry, your account was disabled!");
|
||||||
else if (this.creator != user && !this.weblog.isUserAdmin())
|
else if (this.creator != usr && !this.weblog.isUserAdmin(usr))
|
||||||
return ("Sorry, this image belongs to someone else!");
|
return ("Sorry, this image belongs to someone else!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue