Implement filter context

closes #2559
- Added a new unit test for context based filters
- Accept new parameter `context` in doFilter
Added email sending endpoint to the API.
closes #2550

- Added new API module named 'mail'
- Added routes for the mail endpoint
- Added 'send a test email' button to the debug settigns page
- Added handler to this button which sends and AJAX request to the mail API endpoint
Added functional tests for admin content screen

issue #2273
- test draft/page/published label
- test green add new post button
- test status and author in preview header
- test edit post button
- test delete modal
Merge pull request #2586 from jaswilli/issue-2273

Added functional tests for admin content screen
Set input field types to match expected input values

ref #2588
- Change name field in User Profile to be type text
- Change website field in User Profile to be type url
Merge pull request #2589 from jaswilli/userprofile

Set input field types to match expected input values
Move post API to primary document format

closes #2580
- added new format to post API methods
- added post object parsing and wrapping to admin
- removed unused ‚user‘ object from API response
- updated tests
Add warning message about master branch to grunt prod

closes #2594
Merge pull request #2596 from sebgie/issue#2580-move-obj

Move post API to primary document format
Merge pull request #2595 from ErisDS/issue-2594

Add warning message about master branch to grunt prod
Merge pull request #2560 from halfdan/filter-context

Implement filter context
Add app permission checking to canThis

- Pass permissions loading to buildObjectTypeHandlers to eliminate
shared state
- Load both app and user permissions to check
- Check app permissions if present
- Create apps table and App model
- Move effectiveUserPermissions to permissions/effective
- Change permissable interface to take context; user and app.
- Add unit tests for app canThis checks and effective permissions
Schema additions for apps.

fixes #2102
- Added app_settings, app_fields, app_fields_relations tables
Implements Models & Data API for Apps

closes #2138
- Adds new models for AppField and AppSetting
- Removed permitted attributes from App model (handled by base)
- Added reference from Post to AppFields
- Added fixture data to DataGenerator
- Added integration tests for Apps, AppSettings, AppFields
- Added import for Apps
- Added app_fields to default fixtures
App Permissions from package.json

Progress on #2095

- Add new AppPermissions class with read() method
- has default permissions to read and browse posts
- uses default permissions if no package.json
- uses default permissions if no ghost object in package.json
- errors when reading malformed package.json
- uses ghost.permissions if found in package.json
Add new permissions to fixtures

closes #2325
- added new permissions
- added relation to user roles
- added updateFixtures to migrateUp
- removed validation per model to fix tests
Adds additional fields to apps schema.

fixes #2356
- Adds slug, version and status fields to apps schema
- Added fields to data generator
canThis() improvements

- Handle passing undefined user to canThis
  - Add existence check to parseContext if statement
  - Add unit test that passes undefined to canThis
- Allow internal canThis() checks
  - Allow passing 'internal' or { internal: true } as context
  - Do not lookup user permissions unless context.user found
  - If context.internal, resolve immediately
  - Add unit tests for passing 'internal' and { internal: true }
Use current user in models

closes #2058
- fixed apiContext as suggested in the issue
- added user to options object for models
- added api.users.register() for public registration
- changed models to use options.user for created_by, updated_by,
author_id and published_by
- added override to session model to avoid created_by and updated_by
values
- added user (id: 1) to tests
- added user (id: 1) for registration
- added user (id: 1) for import, fixtures and default settings
- added user (id: 1) for user update
- added user (id: 1) for settings update (dbHash, installedApps, update
check)
- updated bookshelf to version 0.6.8
Add permissions to API

closes #2264
- added permissions check to db, users and posts
- added register method to users
- added doesUserExist method to users
- added user from session to internal calls
- changed permissible to overwrite canThis
- removed action map and action type from permissable method