/** * checks if the user is able to upload * * @return true if user is authorized false if the user is not */ public boolean shouldRenderUpload() { if (recipe != null && ui.isIsUserAuthenticated()) { return recipe.getCreator().getUserName().equals(ui.getUser().getUserName()); } else { return false; } }
/** * Returns true if the user is the creator for this recipe * * @return boolean */ public boolean isIsCreator() { if (ui.isIsUserAuthenticated() && recipe != null) { if (recipe.getCreator() == user) return true; else return false; } else { return false; } }
public boolean isEditAuthorized() { Users user = ui.getUser(); boolean editAuthorized = false; if (user != null && recipe != null) { editAuthorized = recipe.getCreator().getUserName().equals(user.getUserName()) || ui.isIsAdmin(); } return editAuthorized; }