Click here first on how to extend Rave.

If you would like to override any of the various Default[ModelName]PermissionEvaluator classes supplied by Rave, it is easy to do. For example, say you wanted to create your own ModelPermissionEvaluator for Page objects:

1) Create a class that extends AbstractModelPermissionEvaluator, such as CustomPagePermissionEvaluator, and make sure it is annotated as a Spring component:

public class CustomPagePermissionEvaluator extends AbstractModelPermissionEvaluator<Page> { ... }

2) Implement getType() to return Page.class

3) Override both hasPermission signature methods with your custom permission logic

4) Override the getLoadOrder function to return a larger number than 1. This is important as it will make the RavePermissionEvaluator register your custom implementation for the Page object instead of the default ModelPermissionEvaluator for the Page object.

public int getLoadOrder() {        
    return super.getLoadOrder() + 1;

5) Ensure your new class gets component scanned by Spring upon application startup. Click here to read about how to override the application context.