In this Grails Example, we complete the ProjectTracker application by implementing basic security. Although this is not a comprehensive discussion on web application security, you learn how to create a login page that authenticates your users against the EndUser model, as well as how to add an interceptor method to your controllers that authorizes your end users before executing any additional methods in the controller. For a complete discussion on security, please see the information on the Spring Security Core Plugin.
Additional credit for content on this video comes from Scott Davis’ article: Mastering Grails: Authentication and Authorization.
In this Grails Example, we add validation constraints to our model. This limits the data that an end-user can enter into our scaffolded views. Constraints in your model definition are automatically rendered in your scaffolded views. There are many types of constraints such as making a field required, unique, or one that only accepts a range of values.
Once we have our constraints in place, we will generate Static Scaffolding, which allows us to see the actual code behind the controllers and views that scaffolding uses. Using Static Scaffolding allows you to customize these files.
Video #15 shows how to enable data entry constraints and Static Scaffolding.
In this Grails Example, we will invoke a powerful feature of Grails called Dynamic Scaffolding. With a simple one-line command in our controllers, Grails will dynamically build an HTML 5 user interface that contains create, read, update, and delete (CRUD) functionality. The UI also recognizes the relationships between our models and adds the necessary links to connect parent and child data objects together, such as task to projects, projects to owners, etc.
Video #14 shows how to enable Dynamic Scaffolding on your models.