# Login

## Google

This app is using the Google (oauth2) API to manage logins.  To do that you have to have a service configuration in the database.  Place the following in the XXX collection:

```
{
	service: 'google',
	clientId: 'xxx',
	secret: 'xxx'
}
```

# Roles

We are using the alanning:roles package to manage roles and attach them to users.  Currently the project has no way to bootstrap the roles and assignment of an initial admin role.  To work around this first log in with a user you want to be admin (so a user record exists), then get the _id of the user you created, and then use the following MongoDB queries to set things up:

```json
use DistrictCentral
db.createCollection("roles")
db.roles.insertMany([
{
  "_id": "laptop-management",
  "children": []
},
{
  "_id": "admin",
  "children": [
    {
      "_id": "laptop-management"
    }
  ]
}
])
db.createCollection('role-assignment')
db.role-assignment.insert({
  "role": {
    "_id": "admin"
  },
  "scope": "global",
  "user": {
    "_id": "zwbMiaSKHix4bWQ8d"
  },
  "inheritedRoles": [
    {
      "_id": "admin"
    },
    {
      "_id": "laptop-management"
    }
  ]
})
```

