Assign project role to the user when the user is created
In the angular create user form page, when the new user is created, the role selected by the administrator is not assigned to the user, which will result in the creation of the user can not log in normally. This patch uses the existing service, when the new user is created, then Assign project role for the new user. Change-Id: I52b9bb3bc986cc89439cf22deb1e250a9252938a Closes-Bug:#1743596
This commit is contained in:
parent
6340e80465
commit
259648bcf7
@ -73,14 +73,16 @@
|
||||
|
||||
function submit(context) {
|
||||
return keystone.createUser(context.model).then(success);
|
||||
}
|
||||
|
||||
function success(response) {
|
||||
var user = response.data;
|
||||
toast.add('success', interpolate(message.success, [user.name]));
|
||||
return actionResultService.getActionResult()
|
||||
.created(resourceType, user.id)
|
||||
.result;
|
||||
function success(response) {
|
||||
var user = response.data;
|
||||
toast.add('success', interpolate(message.success, [user.name]));
|
||||
// Assign project role for the new user.
|
||||
keystone.grantRole(user.default_project_id, context.model.role, user.id);
|
||||
return actionResultService.getActionResult()
|
||||
.created(resourceType, user.id)
|
||||
.result;
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
@ -72,6 +72,7 @@
|
||||
var deferred = $q.defer();
|
||||
spyOn(keystone, 'createUser').and.returnValue(deferred.promise);
|
||||
spyOn(toast, 'add').and.callFake(angular.noop);
|
||||
spyOn(keystone, 'grantRole');
|
||||
var handler = jasmine.createSpyObj('handler', ['success']);
|
||||
|
||||
deferred.resolve({data: {name: 'saved', id: '12345'}});
|
||||
|
Loading…
Reference in New Issue
Block a user