/** * Uses component level meta data to match roles for component action execution. * * @see org.apache.wicket.authorization.IAuthorizationStrategy#isActionAuthorized(org.apache.wicket.Component, * org.apache.wicket.authorization.Action) */ @Override public boolean isActionAuthorized(final Component component, final Action action) { if (component == null) { throw new IllegalArgumentException("argument component has to be not null"); } if (action == null) { throw new IllegalArgumentException("argument action has to be not null"); } final Roles roles = rolesAuthorizedToPerformAction(component, action); if (roles != null) { return hasAny(roles); } return true; }
/** * Uses application level meta data to match roles for component instantiation. * * @see org.apache.wicket.authorization.IAuthorizationStrategy#isInstantiationAuthorized(java.lang.Class) */ @Override public <T extends IRequestableComponent> boolean isInstantiationAuthorized( final Class<T> componentClass) { if (componentClass == null) { throw new IllegalArgumentException("argument componentClass cannot be null"); } // as long as the interface does not use generics, we should check this if (!Component.class.isAssignableFrom(componentClass)) { throw new IllegalArgumentException("argument componentClass must be of type " + Component.class.getName()); } final Roles roles = rolesAuthorizedToInstantiate(componentClass); if (roles != null) { return hasAny(roles); } return true; }
/** * Uses component level meta data to match roles for component action execution. * * @see org.apache.wicket.authorization.IAuthorizationStrategy#isActionAuthorized(org.apache.wicket.Component, * org.apache.wicket.authorization.Action) */ @Override public boolean isActionAuthorized(final Component component, final Action action) { if (component == null) { throw new IllegalArgumentException("argument component has to be not null"); } if (action == null) { throw new IllegalArgumentException("argument action has to be not null"); } final Roles roles = rolesAuthorizedToPerformAction(component, action); if (roles != null) { return hasAny(roles); } return true; }
/** * Uses application level meta data to match roles for component instantiation. * * @see org.apache.wicket.authorization.IAuthorizationStrategy#isInstantiationAuthorized(java.lang.Class) */ @Override public <T extends IRequestableComponent> boolean isInstantiationAuthorized( final Class<T> componentClass) { if (componentClass == null) { throw new IllegalArgumentException("argument componentClass cannot be null"); } // as long as the interface does not use generics, we should check this if (!Component.class.isAssignableFrom(componentClass)) { throw new IllegalArgumentException("argument componentClass must be of type " + Component.class.getName()); } final Roles roles = rolesAuthorizedToInstantiate(componentClass); if (roles != null) { return hasAny(roles); } return true; }