
public interface GatekeeperWithParams extends Gatekeeper
Gatekeeper which needs additional parameters
in order to find out if the protected Place can be revealed.
Example of use:
public class HasAllRolesGatekeeper implements GatekeeperWithParams {
private final CurrentUser currentUser;
private String[] requiredRoles;
@Inject
public HasAllRolesGatekeeper( CurrentUser currentUser ) {
this.currentUser = currentUser;
}
@Override
public GatekeeperWithParams withParams(String[] params) {
requiredRoles = params;
return this;
}
@Override
public boolean canReveal() {
return currentUser.getRoles().containsAll(Arrays.asList(requiredRoles);
}
}
You must also make sure that your custom Ginjector provides a get
method returning this GatekeeperWithParams if you want to use it
with the GatekeeperParams
annotation.
You should usually bind your GatekeeperWithParams as a singleton.| Modifier and Type | Method and Description |
|---|---|
GatekeeperWithParams |
withParams(String[] params)
Sets the parameters required by this
GatekeeperWithParams
in order to decide if Place can be revealed. |
canRevealGatekeeperWithParams withParams(String[] params)
GatekeeperWithParams
in order to decide if Place can be revealed.params - array of parametersCopyright © 2010-2014 ArcBees. All Rights Reserved.