Story.checkEdit (usr, level)
check if user is allowed to edit a story

  • Parameter Obj:
    Userobject
  • Parameter Int:
    Permission-Level
  • Returns
    String Reason for denial (or null if allowed)
Sourcecode in Story/securityFunctions.js:
1:   function checkEdit(usr, level) {
2:      if (this.creator != usr) {
3:         if (level == null)
4:            throw new DenyException("storyEdit");
5:         else if (this.editableby == EDITABLEBY_ADMINS && (level & MAY_EDIT_ANYSTORY) == 0)
6:            throw new DenyException("storyEdit");
7:         else if (this.editableby == EDITABLEBY_CONTRIBUTORS && (level & MAY_ADD_STORY) == 0)
8:            throw new DenyException("storyEdit");
9:      }
10:     return;
11:  }