1 25 26 package net.killingar.forum.actions.wiki; 27 28 import net.killingar.forum.actions.ActionForumSupport; 29 import net.killingar.forum.internal.AccessLevel; 30 31 public class CheckEditAccess extends ActionForumSupport 32 { 33 String wiki; 35 String context = "wiki"; 36 37 public String getWiki() { return wiki; } 39 public void setWiki(String wiki) { this.wiki = wiki; } 40 public String getContext() { return context; } 41 public void setContext(String in) { context = in; } 42 43 protected String doExecute() 45 { 46 if (!manager.isLoggedIn() ) 47 return "loginerror"; 48 49 69 70 try 71 { 72 if (!manager.hasAccess(AccessLevel.myWiki)) 73 { 74 addErrorMessage("access denied"); 75 return ERROR; 76 } 77 78 long userContext = Long.parseLong(context); 79 if (userContext != manager.getUserID()) 80 { 81 addErrorMessage("attempt to modify another users private page"); 82 83 return ERROR; 84 } 85 } 86 catch (NumberFormatException e) 87 { 88 } 90 catch (java.sql.SQLException e) 91 { 92 addErrorMessage(e.toString()); 93 return ERROR; 94 } 95 96 return SUCCESS; 97 } 98 } 99 | Popular Tags |