Chapter 6. Using models
This chapter covers
- Using models, attributes, methods, and connections
- Creating user identity management
- Transitioning from the default sails-disk database to PostgreSQL
- An introduction to Waterline and ORMs
Chad dropped by today. It seems he received a panicked call from the investor last night. She was using Brushfire and to her horror found hundreds of dog videos littering the site. Chad said she insisted in the strongest possible terms, “This will not stand.” We explained to Chad that although we couldn’t prevent dog videos from being added to Brushfire, we could require users to be logged in to be able to add videos. That way, if a user violated the Terms of Service (ToS), his mom/investor could ban the user’s account with extreme prejudice. To accomplish this requirement, we’ll need the user to establish their identity and prove that they’re the person who created that identity. We can then personalize the frontend and control access to the backend (based on that proven identity). With few exceptions, applications we’ve built for clients inevitably involve this sort of requirement and the features displayed in figure 6.1.
Figure 6.1. The four components of an identity, authentication, personalization, and access control system
