I tried to add and change roles in jhipster. First I just tried to change one use case's role to admin from user. Then I tested it and user can add employee even if the roles is ROLE_ADMIN so it didn't change anything.
I added new role as well, called MANAGER. I edited AuthoritiesConstants.java and added new role to JHI_AUTHORITY-table. Should I do something else or is this enough to get this working?
state('employee.new', {
parent: 'employee',
url: '/new',
data: {
roles: ['ROLE_ADMIN'],
},
onEnter: ['$stateParams', '$state', '$modal', function($stateParams, $state, $modal) {
$modal.open({
templateUrl: 'scripts/app/entities/employee/employee-dialog.html',
controller: 'EmployeeDialogController',
size: 'lg',
resolve: {
entity: function () {
return {nameFirst: null, nameLast: null, taxNumber: null, isFinnish: null, finnishSOTU: null, valtticard: null, birthDate: null, isContactPerson: null, isTiedonantaja: null, cOTARKENNE: null, id: null};
}
}
}).result.then(function(result) {
$state.go('employee', null, { reload: true });
}, function() {
$state.go('employee');
})
}]
})
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…