<commit_before>#loopback-example-access-control

```
git clone git://github.com/strongloop/loopback-example-access-control.git
cd loopback-example-access-control
npm install
slc run
```

In this example, we create "Startkicker" (a basic Kickstarter-like
application) to demonstrate authentication and authorization mechanisms in
LoopBack. The application consists of four types of users:

 - `guest`
 - `owner`
 - `team member`
 - `administrator`

Each user type has permission to perform tasks based on their role and the
application's ACL (access control list) entries.

- [Prerequisites](#prerequisites)
- [Procedure](#procedure)
  - [1. Create the application](#1-create-the-application)
  - [2. Add the model](#2-add-the-models)
  - [3. Define the remote methods](#3-define-the-remote-methods)
  - [4. Create the model relations](#4-create-the-model-relations)
  - [5. Add model instances](#5-add-model-instances)
  - [6. Configure server-side views](#6-configure-server-side-views)
  - [7. Add routes](#7-add-routes)
  - [8. Create the views](#8-create-the-views)
  - [9. Create a role resolver](#9-create-a-role-resolver)
  - [10. Create ACL entries](#10-create-acl-entries)
  - [11. Try the application](#11-try-the-application)
  - [12. Conclusion](#12-conclusion)

##Prerequisites

###Tutorials

- [Getting started with LoopBack](http://docs.strongloop.com/display/LB/Getting+started+with+LoopBack)
- [Tutorial series - step 1](https://github.com/strongloop/loopback-example#step-one---the-basics)
- [Tutorial series - step 2](https://github.com/strongloop/loopback-example#step-two---relations-and-filter)
- [Tutorial series - step 3](https://github.com/strongloop/loopback-example#step-three---adding-application-logic)

###Knowledge

- [EJS](https://github.com/visionmedia/ejs)
- [body-parser](https://github.com/expressjs/body-parser)
- [JSON](http://json.org/)
- [LoopBack models](http://docs.strongloop.com/display/LB/Defining+models)
- [LoopBack adding application logic](http://docs.strongloop.com/display/LB/Adding+application+logic)

##Procedure

###1. Create the application

####Application information

- Name: `loopback-example-access-control`
- Directory to contain the project: `loopback-example-access-control`

```
slc loopback loopback-example-access-control
... # follow the prompts
cd loopback-example-access-control
```

###2. Add the models

####Model information
- Name: `user`
  - Datasource: `db (memory)`
  - Base class: `User`
  - Expose via REST: `No`
  - Custom plural form: *Leave blank*
  - Properties
    - *None*
- Name: `team`
  - Datasource: `db (memory)`
  - Base class: `PersistedModel`
  - Expose via REST: `No`
  - Custom plural form: *Leave blank*
  - Properties
    - `ownerId`
      - Number
      - Not required
    - `balance`
      - Number
      - Not required
- Name: `project`
  - Datasource: `db (memory)`<commit_msg>Updated "Add the models" in README.md to correct steps for creating team model.<commit_after>#loopback-example-access-control

```
git clone git://github.com/strongloop/loopback-example-access-control.git
cd loopback-example-access-control
npm install
slc run
```

In this example, we create "Startkicker" (a basic Kickstarter-like
application) to demonstrate authentication and authorization mechanisms in
LoopBack. The application consists of four types of users:

 - `guest`
 - `owner`
 - `team member`
 - `administrator`

Each user type has permission to perform tasks based on their role and the
application's ACL (access control list) entries.

- [Prerequisites](#prerequisites)
- [Procedure](#procedure)
  - [1. Create the application](#1-create-the-application)
  - [2. Add the model](#2-add-the-models)
  - [3. Define the remote methods](#3-define-the-remote-methods)
  - [4. Create the model relations](#4-create-the-model-relations)
  - [5. Add model instances](#5-add-model-instances)
  - [6. Configure server-side views](#6-configure-server-side-views)
  - [7. Add routes](#7-add-routes)
  - [8. Create the views](#8-create-the-views)
  - [9. Create a role resolver](#9-create-a-role-resolver)
  - [10. Create ACL entries](#10-create-acl-entries)
  - [11. Try the application](#11-try-the-application)
  - [12. Conclusion](#12-conclusion)

##Prerequisites

###Tutorials

- [Getting started with LoopBack](http://docs.strongloop.com/display/LB/Getting+started+with+LoopBack)
- [Tutorial series - step 1](https://github.com/strongloop/loopback-example#step-one---the-basics)
- [Tutorial series - step 2](https://github.com/strongloop/loopback-example#step-two---relations-and-filter)
- [Tutorial series - step 3](https://github.com/strongloop/loopback-example#step-three---adding-application-logic)

###Knowledge

- [EJS](https://github.com/visionmedia/ejs)
- [body-parser](https://github.com/expressjs/body-parser)
- [JSON](http://json.org/)
- [LoopBack models](http://docs.strongloop.com/display/LB/Defining+models)
- [LoopBack adding application logic](http://docs.strongloop.com/display/LB/Adding+application+logic)

##Procedure

###1. Create the application

####Application information

- Name: `loopback-example-access-control`
- Directory to contain the project: `loopback-example-access-control`

```
slc loopback loopback-example-access-control
... # follow the prompts
cd loopback-example-access-control
```

###2. Add the models

####Model information
- Name: `user`
  - Datasource: `db (memory)`
  - Base class: `User`
  - Expose via REST: `No`
  - Custom plural form: *Leave blank*
  - Properties
    - *None*
- Name: `team`
  - Datasource: `db (memory)`
  - Base class: `PersistedModel`
  - Expose via REST: `No`
  - Custom plural form: *Leave blank*
  - Properties
    - `ownerId`
      - Number
      - Not required
    - `memberId`
      - Number
      - Required
- Name: `project`
  - Datasource: `db (memory)`
{'fraction_non_alphanumeric': 0.1543751074436995, 'fraction_numerical': 0.012033694344163659, 'mean_word_length': 3.8808724832214767, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1932961', 'n_tokens_mistral': 1978, 'n_tokens_neox': 1857, 'n_words': 446}