| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
package net.sourceforge.pebble.web.action; |
| 33 |
|
|
| 34 |
|
import net.sourceforge.pebble.Constants; |
| 35 |
|
import net.sourceforge.pebble.domain.Blog; |
| 36 |
|
import net.sourceforge.pebble.domain.StaticPage; |
| 37 |
|
import net.sourceforge.pebble.service.StaticPageService; |
| 38 |
|
import net.sourceforge.pebble.service.StaticPageServiceException; |
| 39 |
|
import net.sourceforge.pebble.util.StringUtils; |
| 40 |
|
import net.sourceforge.pebble.web.view.RedirectView; |
| 41 |
|
import net.sourceforge.pebble.web.view.View; |
| 42 |
|
import org.apache.commons.logging.Log; |
| 43 |
|
import org.apache.commons.logging.LogFactory; |
| 44 |
|
|
| 45 |
|
import javax.servlet.ServletException; |
| 46 |
|
import javax.servlet.http.HttpServletRequest; |
| 47 |
|
import javax.servlet.http.HttpServletResponse; |
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
@author |
| 53 |
|
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 5 |
Complexity Density: 0,38 |
|
| 54 |
|
public class UnlockStaticPageAction extends SecureAction { |
| 55 |
|
|
| 56 |
|
private static final Log log = LogFactory.getLog(UnlockStaticPageAction.class); |
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 60 |
|
|
| 61 |
|
@param |
| 62 |
|
@param |
| 63 |
|
@return |
| 64 |
|
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 4 |
Complexity Density: 0,33 |
|
| 65 |
0
|
public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {... |
| 66 |
0
|
Blog blog = (Blog)getModel().get(Constants.BLOG_KEY); |
| 67 |
0
|
StaticPageService service = new StaticPageService(); |
| 68 |
|
|
| 69 |
0
|
String id = request.getParameter("page"); |
| 70 |
0
|
if (id != null) { |
| 71 |
0
|
try { |
| 72 |
0
|
StaticPage staticPage = service.getStaticPageById(blog, id); |
| 73 |
0
|
if (staticPage != null) { |
| 74 |
0
|
service.unlock(staticPage); |
| 75 |
0
|
blog.info("Static page <a href=\"" + staticPage.getLocalPermalink() + "\">" + staticPage.getTitle() + "</a> unlocked."); |
| 76 |
|
} |
| 77 |
|
} catch (StaticPageServiceException e) { |
| 78 |
0
|
blog.warn(e.getClass().getName() + " Error while unlocking static page - " + StringUtils.transformHTML(e.getMessage())); |
| 79 |
0
|
log.warn("Error while unlocking static page", e); |
| 80 |
|
} |
| 81 |
|
} |
| 82 |
|
|
| 83 |
0
|
return new RedirectView(blog.getUrl() + "viewStaticPages.secureaction"); |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
|
| 87 |
|
|
| 88 |
|
|
| 89 |
|
@return |
| 90 |
|
@param |
| 91 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 92 |
0
|
public String[] getRoles(HttpServletRequest request) {... |
| 93 |
0
|
return new String[]{ |
| 94 |
|
Constants.BLOG_ADMIN_ROLE, |
| 95 |
|
Constants.BLOG_OWNER_ROLE, |
| 96 |
|
Constants.BLOG_CONTRIBUTOR_ROLE |
| 97 |
|
}; |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
} |