334335336337338339340341342343344
s = sessions.getSession(c.getValue()); } if(s == null) { throw new UnauthorizedException(); } } else { throw new AuthenticationException("Could not find WPISuite cookie. Please Login to recieve one.");
105106107108109110111112
} private void ensureRole(Session session, Role role) throws WPISuiteException { User user = (User) db.retrieve(User.class, "username", session.getUsername()).get(0); if(!user.getRole().equals(role)) { throw new UnauthorizedException(); } }
220221222223224225226227
return (m != null) ? true : false; } else{ logger.log(Level.WARNING, "ProjectManager Delete attempted by user with insufficient permission"); throw new UnauthorizedException("You do not have the required permissions to perform this action."); } }
234235236237238239240241
data.deleteAll(new Project("","")); } else { logger.log(Level.WARNING, "ProjectManager DeleteAll attempted by user with insufficient permission"); throw new UnauthorizedException("You do not have the required permissions to perform this action."); } }
298299300301302303304305
return toUpdate; } else { logger.log(Level.WARNING, "Unauthorized Project update attempted."); throw new UnauthorizedException("You do not have the required permissions to perform this action."); } }
192193194195196197198199200201202
return (m != null) ? true : false; } else { logger.log(Level.WARNING,"User: "+s1.getUser().getUsername()+"attempted to delete: "+id); throw new UnauthorizedException("Delete not authorized"); }
282283284285286287288289290
this.save(s, toUpdate); } else { logger.log(Level.WARNING, "Access denied to user: "+s.getUser().getUsername()); throw new UnauthorizedException("Users accessible only by Admins and themselves"); } return toUpdate; }