List of usage examples for org.apache.wicket.authorization Action RENDER
String RENDER
To view the source code for org.apache.wicket.authorization Action RENDER.
Click Source Link
From source file:au.org.theark.security.CustomAuthorizationStrategy.java
License:Open Source License
public boolean isActionAuthorized(final Component component, final Action action) { ShiroAction _action = (action.getName().equals(Action.RENDER)) ? ShiroAction.RENDER : ShiroAction.ENABLE; Class<? extends Component> clazz = component.getClass(); SecurityConstraint fail = checkInvalidInstantiation(clazz.getAnnotations(), _action); if (fail == null) { fail = checkInvalidInstantiation(clazz.getPackage().getAnnotations(), _action); }//from ww w . j a v a 2s .c o m return fail == null; }
From source file:org.obiba.onyx.webapp.administration.page.AdministrationPage.java
License:Open Source License
public AdministrationPage() { AjaxLink<?> userTab = new AdminTab("userTab") { @Override/*from w w w .java 2 s. com*/ public Component getTabComponent() { return new UserSearchPanel(getContentId()); } }; add(userTab.setOutputMarkupId(true)); links.add(userTab); AjaxLink<?> dataTab = new AdminTab("dataTab") { @Override public Component getTabComponent() { return new DataManagementPanel(getContentId()); } }; add(dataTab.setOutputMarkupId(true)); links.add(dataTab); AjaxLink<?> editorTab = new EditorTab("editorTab") { @Override public Component getTabComponent() { for (Module module : moduleRegistry.getModules()) { Component editorComponent = module.getEditorPanel(getContentId()); if (editorComponent != null) return editorComponent; } return null; } }; add(editorTab.setOutputMarkupId(true)); links.add(editorTab); AjaxLink<?> devTab = new AdminTab("devTab") { @Override public Component getTabComponent() { return new DevelopersPanel(getContentId()); } @Override public boolean isVisible() { return ((OnyxApplication) WebApplication.get()).isDevelopmentMode(); } }; add(devTab.setOutputMarkupId(true)); links.add(devTab); // Display first permitted tab for (AjaxLink<?> link : links) { if (link.isActionAuthorized(new Action(Action.RENDER))) { Component tabComponent = ((Link) link).getTabComponent(); add(tabComponent.setOutputMarkupId(true)); link.add(new AttributeModifier("class", true, new Model<String>("obiba-button ui-corner-all selected"))); break; } } }
From source file:org.wicketstuff.security.swarm.actions.SwarmActionFactoryTest.java
License:Apache License
/** * //from w w w. ja v a2s . com * @see SwarmActionFactory#getAction(String) */ public void testGetActionString() { WaspAction action = factory.getAction(Action.RENDER); assertNotNull(action); assertEquals(factory.getAction(Render.class), action); assertEquals(factory.getAction(Access.class), factory.getAction((String) null)); assertEquals(factory.getAction(Access.class), factory.getAction("")); try { factory.getAction("foo"); fail("foo is not registered action"); } catch (IllegalArgumentException e) { log.debug(e.getMessage()); } }
From source file:org.wicketstuff.shiro.annotation.AnnotationsShiroAuthorizationStrategy.java
License:Apache License
/** * {@inheritDoc}/*from w w w . j a va 2 s .c o m*/ */ public boolean isActionAuthorized(final Component component, final Action action) { final ShiroAction _action = action.getName().equals(Action.RENDER) ? ShiroAction.RENDER : ShiroAction.ENABLE; final Class<? extends Component> clazz = component.getClass(); Annotation[] componentClassAnnotations = clazz.getAnnotations(); ShiroSecurityConstraint fail = checkInvalidInstantiation( findShiroSecurityConstraintAnnotations(componentClassAnnotations), _action); if (fail == null) { //TODO: Allow ShiroSecurityConstraint annotations on packages OR remove this check as the annotation is // currently only allowed on types Annotation[] packageAnnotations = clazz.getPackage().getAnnotations(); fail = checkInvalidInstantiation(findShiroSecurityConstraintAnnotations(packageAnnotations), _action); } return fail == null; }