Skip to content
This repository has been archived by the owner on Apr 18, 2020. It is now read-only.

Commit

Permalink
Fix formatting for Jekyll (readme headers) (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sequoia authored and superkhau committed Oct 12, 2016
1 parent a522623 commit ef2e0a0
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#loopback-example-access-control
# loopback-example-access-control

```
$ git clone https://github.com/strongloop/loopback-example-access-control
Expand All @@ -19,28 +19,28 @@ LoopBack. The application consists of four types of users:
Each user type has permission to perform tasks based on their role and the
application's ACL (access control list) entries.

##Prerequisites
## Prerequisites

###Tutorials
### 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
### 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
## Procedure

###Create the application
### Create the application

####Application information
#### Application information

- Name: `loopback-example-access-control`
- Directory to contain the project: `loopback-example-access-control`
Expand All @@ -51,9 +51,9 @@ $ slc loopback loopback-example-access-control
$ cd loopback-example-access-control
```

###Add the models
### Add the models

####Model information
#### Model information
- Name: `user`
- Datasource: `db (memory)`
- Base class: `User`
Expand Down Expand Up @@ -94,17 +94,17 @@ $ slc loopback:model user
... # follow the prompts, repeat for `team` and `project`
```

###Define the remote methods
### Define the remote methods

Define three remote methods in [`project.js`](https://github.com/strongloop/loopback-example-access-control/blob/master/common/models/project.js):

- [`listProjects`](https://github.com/strongloop/loopback-example-access-control/blob/master/common/models/project.js#L2-L13)
- [`donate`](https://github.com/strongloop/loopback-example-access-control/blob/master/common/models/project.js#L15-L31)
- [`withdraw`](https://github.com/strongloop/loopback-example-access-control/blob/master/common/models/project.js#L33-54)

###Create the model relations
### Create the model relations

####Model relation information
#### Model relation information

- `user`
- has many
Expand All @@ -128,7 +128,7 @@ Define three remote methods in [`project.js`](https://github.com/strongloop/loop
- Property name for the relation: `user`
- Custom foreign key: `ownerId`

###Add model instances
### Add model instances

Create a boot script named [`sample-models.js`](https://github.com/strongloop/loopback-example-access-control/blob/master/server/boot/sample-models.js).

Expand All @@ -143,7 +143,7 @@ This script does the following:
- [Creates a role named `admin` and adds a role mapping to make `Bob` an
`admin`](/server/boot/sample-models.js#L50-L65)

###Configure server-side views
### Configure server-side views

> LoopBack comes preconfigured with EJS out-of-box. This means we can use
> server-side templating by simply setting the proper view engine and a
Expand All @@ -160,7 +160,7 @@ Create [`index.ejs` in the views directory](https://github.com/strongloop/loopba
[Configure `server.js`](https://github.com/strongloop/loopback-example-access-control/blob/master/server/server.js#L11-L20) to use server-side
templating. Remember to import the [`path`](https://github.com/strongloop/loopback-example-access-control/blob/master/server/server.js#L4) package.

###Add routes
### Add routes

Create [`routes.js`](https://github.com/strongloop/loopback-example-access-control/blob/master/server/boot/routes.js). This script does the following:

Expand All @@ -171,13 +171,13 @@ Create [`routes.js`](https://github.com/strongloop/loopback-example-access-contr

> When you log in sucessfully, `projects.html` is rendered with the authenticated user's access token embedded into each link.
###Create the views
### Create the views

Create the [`views` directory](https://github.com/strongloop/loopback-example-access-control/tree/master/server/views) to store views.

In this directory, create [`index.ejs`](https://github.com/strongloop/loopback-example-access-control/blob/master/server/views/index.ejs) and [`projects.ejs`](https://github.com/strongloop/loopback-example-access-control/blob/master/server/views/projects.ejs).

###Create a role resolver
### Create a role resolver

Create [`role-resolver.js`](https://github.com/strongloop/loopback-example-access-control/blob/master/server/boot/role-resolver.js).

Expand All @@ -186,11 +186,11 @@ Create [`role-resolver.js`](https://github.com/strongloop/loopback-example-acces
> denied. Otherwise, we check to see if the user is a team member and process
> the request accordingly.
###Create ACL entries
### Create ACL entries

> ACLs are used to restrict access to application REST endpoints.
####ACL information
#### ACL information

- Deny access to all project REST endpoints
- Select the model to apply the ACL entry to: `(all existing models)`
Expand Down Expand Up @@ -236,9 +236,9 @@ $ slc loopback:acl
# follow the prompts, repeat for each ACL listed above
```

###Try the application
### Try the application

Start the server (`node .`) and open [`localhost:3000`][localhost] in your browser to view the app. You will see logins and explanations related to each user type we created:
Start the server (`node .`) and open [`localhost:3000`](http://localhost:3000) in your browser to view the app. You will see logins and explanations related to each user type we created:

- Guest `Guest`
- Role = $everyone, $unauthenticated
Expand Down

0 comments on commit ef2e0a0

Please sign in to comment.