Skip to content

Commit

Permalink
fix(install): roles invalid during install #208
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed May 29, 2019
1 parent e68607c commit cc3a880
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/controllers/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ installController.install = function (req, res) {
{
name: 'Admin',
description: 'Default role for admins',
grants: defaults.adminGrants
grants: defaults.roleDefaults.adminGrants
},
function (err, role) {
if (err) return done(err)
Expand All @@ -272,7 +272,7 @@ installController.install = function (req, res) {
{
name: 'Support',
description: 'Default role for agents',
grants: defaults.supportGrants
grants: defaults.roleDefaults.supportGrants
},
function (err, role) {
if (err) return done(err)
Expand All @@ -286,7 +286,7 @@ installController.install = function (req, res) {
{
name: 'User',
description: 'Default role for users',
grants: defaults.userGrants
grants: defaults.roleDefaults.userGrants
},
function (err, role) {
if (err) return done(err)
Expand Down
2 changes: 1 addition & 1 deletion src/models/role.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var roleSchema = mongoose.Schema(
name: { type: String, required: true, unique: true },
normalized: String,
description: String,
grants: [{ type: String, required: true, default: '' }],
grants: [{ type: String, required: true }],
hierarchy: { type: Boolean, required: true, default: true }
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/settings/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ roleDefaults.adminGrants = [
'api:*'
]

settingsDefaults.roleDefaults = roleDefaults

function rolesDefault (callback) {
var roleSchema = require('../models/role')

Expand Down

0 comments on commit cc3a880

Please sign in to comment.