1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

[bug] users promoted to the administrator role are not in the admin group

This commit is contained in:
Sylvain 2020-05-12 15:30:57 +02:00
parent 8ea36b8a89
commit 37901e4153
3 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,7 @@
# Changelog Fab-manager
- Fix a bug: the subscription page is not available
- Fix a bug: users promoted to the administrator role are not in the admin group
## v4.4.0 2020 May 12

View File

@ -118,7 +118,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
* Switch the user's view from the reservation agenda to the plan subscription
*/
$scope.showPlans = function () {
// first, we ensure that a user was selected (admin) or logged (member)
// first, we ensure that a user was selected (admin/manager) or logged (member)
const isSelectedUser = Object.keys($scope.user).length > 0;
// all slots are in future
const areFutureSlots = _.every($scope.events.reserved, function(s) {

View File

@ -219,6 +219,9 @@ class API::MembersController < API::ApiController
@member.remove_role ex_role
@member.add_role params[:role]
# if the new role is 'admin', then change the group to the admins group
@member.update_attributes(group_id: Group.find_by(slug: 'admins').id) if params[:role] == 'admin'
NotificationCenter.call type: 'notify_user_role_update',
receiver: @member,
attached_object: @member