mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-22 16:54:15 +01:00
(bug) disabling/removing groups
When disabling a group, another unrelated group maybe disabled/enabled; When deleting a group, another unrelated group may be deleted, instead of the requested one
This commit is contained in:
parent
9674c4cddf
commit
9caf401412
@ -14,6 +14,7 @@
|
|||||||
- Fix a bug: invalid password verification in setup script
|
- Fix a bug: invalid password verification in setup script
|
||||||
- Fix a bug: during setup, unable to chown the installation folder, if the current user does not have a self-named group
|
- Fix a bug: during setup, unable to chown the installation folder, if the current user does not have a self-named group
|
||||||
- Fix a bug: during setup, the current value in config/env is not shown
|
- Fix a bug: during setup, the current value in config/env is not shown
|
||||||
|
- Fix a bug: disabling/removing a group has side effects on other groups
|
||||||
|
|
||||||
## v5.4.15 2022 August 1
|
## v5.4.15 2022 August 1
|
||||||
|
|
||||||
|
@ -70,20 +70,23 @@ Application.Controllers.controller('GroupsController', ['$scope', 'groupsPromise
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the group at the specified index
|
* Deletes the group at the specified index
|
||||||
* @param index {number} group index in the $scope.groups array
|
* @param groupId {number} group id to delete
|
||||||
*/
|
*/
|
||||||
$scope.removeGroup = index =>
|
$scope.removeGroup = (groupId) => {
|
||||||
Group.delete({ id: $scope.groups[index].id }, function (resp) {
|
Group.delete({ id: groupId }, function (resp) {
|
||||||
growl.success(_t('app.admin.members.group_form.group_successfully_deleted'));
|
growl.success(_t('app.admin.members.group_form.group_successfully_deleted'));
|
||||||
return $scope.groups.splice(index, 1);
|
const index = $scope.groups.findIndex(e => e.id === groupId);
|
||||||
|
$scope.groups.splice(index, 1);
|
||||||
}
|
}
|
||||||
, () => growl.error(_t('app.admin.members.group_form.unable_to_delete_group_because_some_users_and_or_groups_are_still_linked_to_it')));
|
, () => growl.error(_t('app.admin.members.group_form.unable_to_delete_group_because_some_users_and_or_groups_are_still_linked_to_it')));
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/disable the group at the specified index
|
* Enable/disable the group at the specified index
|
||||||
* @param index {number} group index in the $scope.groups array
|
* @param groupId {number} id of the group to enable/disable
|
||||||
*/
|
*/
|
||||||
return $scope.toggleDisableGroup = function (index) {
|
return $scope.toggleDisableGroup = function (groupId) {
|
||||||
|
const index = $scope.groups.findIndex(e => e.id === groupId);
|
||||||
const group = $scope.groups[index];
|
const group = $scope.groups[index];
|
||||||
if (!group.disabled && (group.users > 0)) {
|
if (!group.disabled && (group.users > 0)) {
|
||||||
return growl.error(_t('app.admin.members.group_form.unable_to_disable_group_with_users', { USERS: group.users }));
|
return growl.error(_t('app.admin.members.group_form.unable_to_disable_group_with_users', { USERS: group.users }));
|
||||||
|
@ -41,11 +41,11 @@
|
|||||||
<button class="btn btn-default" ng-click="rowform.$show()">
|
<button class="btn btn-default" ng-click="rowform.$show()">
|
||||||
<i class="fa fa-edit"></i> <span class="hidden-xs hidden-sm" translate>{{ 'app.shared.buttons.edit' }}</span>
|
<i class="fa fa-edit"></i> <span class="hidden-xs hidden-sm" translate>{{ 'app.shared.buttons.edit' }}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-default" ng-click="toggleDisableGroup($index)">
|
<button class="btn btn-default" ng-click="toggleDisableGroup(group.id)">
|
||||||
<span ng-hide="group.disabled"><i class="fa fa-eye-slash"></i> <span translate>{{ 'app.admin.members.group_form.disable' }}</span></span>
|
<span ng-hide="group.disabled"><i class="fa fa-eye-slash"></i> <span translate>{{ 'app.admin.members.group_form.disable' }}</span></span>
|
||||||
<span ng-show="group.disabled"><i class="fa fa-eye"></i> <span translate>{{ 'app.admin.members.group_form.enable' }}</span></span>
|
<span ng-show="group.disabled"><i class="fa fa-eye"></i> <span translate>{{ 'app.admin.members.group_form.enable' }}</span></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-danger" ng-click="removeGroup($index)">
|
<button class="btn btn-danger" ng-click="removeGroup(group.id)">
|
||||||
<i class="fa fa-trash-o"></i>
|
<i class="fa fa-trash-o"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user