Skip to content

Commit

Permalink
fix disabled user enable
Browse files Browse the repository at this point in the history
  • Loading branch information
ipula committed Nov 1, 2024
1 parent 149a526 commit cdde464
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 11 additions & 1 deletion src/managers/UserAccessManager/UserAccessManagerStore.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {defineComponentStore} from '@/utils/defineComponentStore';
import {useApiUrl} from '@/composables/useApiUrl';
import {useUrl} from '@/composables/useUrl';
import {useAnnouncer} from '@/composables/useAnnouncer';
import {useTranslation} from '@/composables/useTranslation';
import {useFetchPaginated} from '@/composables/useFetchPaginated';
Expand Down Expand Up @@ -58,6 +59,14 @@ export const useUserAccessManagerStore = defineComponentStore(
/**
* Actions
*/

/*
* redirect to send invitation page
*/
const {pageUrl: sendInvitationPageUrl} = useUrl('invitation/editUser');
function editUser(userObj) {
window.location = sendInvitationPageUrl.value + '/' + userObj.id;
}
const _userAccessActionsFns = useUserAccessManagerActions();
function getItemActions(userObj) {
return _userAccessActionsFns.getItemActions(userObj);
Expand All @@ -68,7 +77,7 @@ export const useUserAccessManagerStore = defineComponentStore(
}

function disableUser(userObj) {
_userAccessActionsFns.disableUser(userObj.id, triggerDataChangeCallback);
_userAccessActionsFns.disableUser(userObj, triggerDataChangeCallback);
}

function removeUser(userObj) {
Expand Down Expand Up @@ -97,6 +106,7 @@ export const useUserAccessManagerStore = defineComponentStore(
mergeUser,
loginAs,
getItemActions,
editUser,
};
},
);
6 changes: 3 additions & 3 deletions src/managers/UserAccessManager/useUserAccessManagerActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,18 @@ export function useUserAccessManagerActions() {
openLegacyModal({title: t('grid.user.email')}, finishedCallback);
}

function disableUser(userId, finishedCallback) {
function disableUser(user, finishedCallback) {
const {openLegacyModal} = useLegacyGridUrl({
component: 'grid.settings.user.UserGridHandler',
op: 'edit-disable-user',
params: {
rowId: userId,
rowId: user.id,
enable: user.disabled ? '1' : '',
},
});

openLegacyModal({title: t('grid.user.disable')}, (closeData) => {
if (closeData.dataChanged[0]) {
console.log(closeData.dataChanged[0]);
finishedCallback();
} else {
finishedCallback();
Expand Down

0 comments on commit cdde464

Please sign in to comment.