Add owner role to setup user

closes #3518
- added owner role to user that is added if no user is available
This commit is contained in:
Sebastian Gierlinger 2014-08-05 13:48:10 +02:00
parent 1b8c8c27c1
commit 766e6ff944

View File

@ -189,8 +189,10 @@ authentication = {
if (ownerUser) {
return dataProvider.User.setup(setupUser, _.extend(internal, {id: ownerUser.id}));
} else {
// TODO: needs to pass owner role when role endpoint is finished!
return dataProvider.User.add(setupUser, internal);
return dataProvider.Role.findOne({name: 'Owner'}).then(function (ownerRole) {
setupUser.roles = [ownerRole.id];
return dataProvider.User.add(setupUser, internal);
});
}
}).then(function (user) {
var userSettings = [];