/** * Grants authorization to instantiate the given class to just the role NO_ROLE, effectively * denying all other roles. * * @param <T> * * @param componentClass * The component class */ public static <T extends Component> void unauthorizeAll(Class<T> componentClass) { authorizeAll(componentClass); authorize(componentClass, NO_ROLE); }
/** * 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; }
/** * Grants permission to all roles to perform the given action on the given component. * * @param component * The component that is subject to the authorization * @param action * The action to authorize */ public static void authorizeAll(Component component, final Action action) { ActionPermissions permissions = component.getMetaData(ACTION_PERMISSIONS); if (permissions != null) { permissions.authorizeAll(action); } }
/** * Construct. * * @param roleCheckingStrategy * the role checking strategy */ public RoleAuthorizationStrategy(final IRoleCheckingStrategy roleCheckingStrategy) { add(new AnnotationsRoleAuthorizationStrategy(roleCheckingStrategy)); add(new MetaDataRoleAuthorizationStrategy(roleCheckingStrategy)); } }
/** * Grants permission to all roles to create instances of the given component class. * * @param <T> * * @param componentClass * The component class */ public static <T extends Component> void authorizeAll(final Class<T> componentClass) { Application application = Application.get(); InstantiationPermissions authorizedRoles = application.getMetaData(INSTANTIATION_PERMISSIONS); if (authorizedRoles != null) { authorizedRoles.authorizeAll(componentClass); } }
/** * Gets the roles for the given action/component combination. * * @param component * the component * @param action * the action * @return the roles for the action as defined with the given component */ private static Roles rolesAuthorizedToPerformAction(final Component component, final Action action) { final ActionPermissions permissions = component.getMetaData(ACTION_PERMISSIONS); if (permissions != null) { return permissions.rolesFor(action); } return null; } }
/** * Gets the roles for creation of the given component class, or null if none were registered. * * @param <T> * * @param componentClass * the component class * @return the roles that are authorized for creation of the componentClass, or null if no * specific authorization was configured */ private static <T extends IRequestableComponent> Roles rolesAuthorizedToInstantiate( final Class<T> componentClass) { final InstantiationPermissions permissions = Application.get().getMetaData( INSTANTIATION_PERMISSIONS); if (permissions != null) { return permissions.authorizedRoles(componentClass); } return null; }
/** * Grants authorization to perform the given action to just the role NO_ROLE, effectively * denying all other roles. * * @param component * the component that is subject to the authorization * @param action * the action to authorize */ public static void unauthorizeAll(final Component component, final Action action) { authorizeAll(component, action); authorize(component, action, NO_ROLE); }
@Override protected AbstractLink getEventsLink(final String linkid) { BookmarkablePageLink<Remediations> remediations = BookmarkablePageLinkBuilder.build(linkid, Remediations.class); MetaDataRoleAuthorizationStrategy.authorize(remediations, WebPage.ENABLE, StandardEntitlement.REMEDIATION_LIST); return remediations; }
/** * Grants permission to all roles to perform the given action on the given component. * * @param component * The component that is subject to the authorization * @param action * The action to authorize */ public static void authorizeAll(Component component, final Action action) { ActionPermissions permissions = component.getMetaData(ACTION_PERMISSIONS); if (permissions != null) { permissions.authorizeAll(action); } }
/** * Construct. * * @param roleCheckingStrategy * the role checking strategy */ public RoleAuthorizationStrategy(final IRoleCheckingStrategy roleCheckingStrategy) { add(new AnnotationsRoleAuthorizationStrategy(roleCheckingStrategy)); add(new MetaDataRoleAuthorizationStrategy(roleCheckingStrategy)); } }
/** * Grants permission to all roles to create instances of the given component class. * * @param <T> * * @param componentClass * The component class */ public static <T extends Component> void authorizeAll(final Class<T> componentClass) { Application application = Application.get(); InstantiationPermissions authorizedRoles = application.getMetaData(INSTANTIATION_PERMISSIONS); if (authorizedRoles != null) { authorizedRoles.authorizeAll(componentClass); } }
/** * Gets the roles for the given action/component combination. * * @param component * the component * @param action * the action * @return the roles for the action as defined with the given component */ private static Roles rolesAuthorizedToPerformAction(final Component component, final Action action) { final ActionPermissions permissions = component.getMetaData(ACTION_PERMISSIONS); if (permissions != null) { return permissions.rolesFor(action); } return null; } }
/** * Gets the roles for creation of the given component class, or null if none were registered. * * @param <T> * * @param componentClass * the component class * @return the roles that are authorized for creation of the componentClass, or null if no * specific authorization was configured */ private static <T extends IRequestableComponent> Roles rolesAuthorizedToInstantiate( final Class<T> componentClass) { final InstantiationPermissions permissions = Application.get().getMetaData( INSTANTIATION_PERMISSIONS); if (permissions != null) { return permissions.authorizedRoles(componentClass); } return null; }
/** * Grants authorization to instantiate the given class to just the role NO_ROLE, effectively * denying all other roles. * * @param <T> * * @param componentClass * The component class */ public static <T extends Component> void unauthorizeAll(Class<T> componentClass) { authorizeAll(componentClass); authorize(componentClass, NO_ROLE); }
private void authorizeList() { getListAuthRoles().forEach(role -> { MetaDataRoleAuthorizationStrategy.authorize(selectedEventsPanel, RENDER, role); }); }
/** * Grants authorization to perform the given action to just the role NO_ROLE, effectively * denying all other roles. * * @param component * the component that is subject to the authorization * @param action * the action to authorize */ public static void unauthorizeAll(final Component component, final Action action) { authorizeAll(component, action); authorize(component, action, NO_ROLE); }
public AccountPolicyDirectoryPanel(final String id, final PageReference pageRef) { super(id, PolicyType.ACCOUNT, pageRef); this.addNewItemPanelBuilder(new PolicyModalPanelBuilder<>( PolicyType.ACCOUNT, new AccountPolicyTO(), modal, pageRef), true); MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, StandardEntitlement.POLICY_CREATE); initResultTable(); }
public RemediationDirectoryPanel(final String id, final PageReference pageReference) { super(id, pageReference, true); disableCheckBoxes(); setFooterVisibility(false); modal.size(Modal.Size.Large); restClient = new RemediationRestClient(); initResultTable(); MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, StandardEntitlement.REMEDIATION_REMEDY); }