diff --git a/src/components/SelectSecurityGroupModal.vue b/src/components/SelectSecurityGroupModal.vue index 2027901..9100030 100644 --- a/src/components/SelectSecurityGroupModal.vue +++ b/src/components/SelectSecurityGroupModal.vue @@ -121,4 +121,8 @@ }, }); - \ No newline at end of file + \ No newline at end of file diff --git a/src/locales/en.json b/src/locales/en.json index a0bbb78..8d11d3b 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -12,6 +12,7 @@ "Add phone number": "Add phone number", "Add profile picture": "Add profile picture", "added to product store": "added to product store", + "Add to security group": "Add to security group", "Add to a product store": "Add to a product store", "All": "All", "App": "App", @@ -178,6 +179,7 @@ "Security group created successfully.": "Security group created successfully.", "Security group name is required.": "Security group name is required.", "Security group permission association successfully updated.": "Security group permission association successfully updated.", + "Select security groups": "Select security groups", "Select a security group to view its details": "Select a security group to view its details", "Select facility": "Select facility", "Select facilities": "Select facilities", @@ -206,6 +208,7 @@ "The timezone you select is used to ensure automations you schedule are always accurate to the time you select.": "The timezone you select is used to ensure automations you schedule are always accurate to the time you select.", "This is the name of the OMS you are connected to right now. Make sure that you are connected to the right instance before proceeding.": "This is the name of the OMS you are connected to right now. Make sure that you are connected to the right instance before proceeding.", "This user was disabled due to repeated failed password attempts": "This user was disabled due to repeated failed password attempts", + "This user has 'STOREFULFILLMENT_ADMIN' permission, enabling access to all facilities.": "This user has 'STOREFULFILLMENT_ADMIN' permission, enabling access to all facilities.", "Unblock user login": "Unblock user login", "Unblocking a user will allow them to login to the OMS again with their credentials.": "Unblocking a user will allow them to login to the OMS again with their credentials.", "Update product store role": "Update product store role", diff --git a/src/services/UserService.ts b/src/services/UserService.ts index 73ac6b7..a14b90e 100644 --- a/src/services/UserService.ts +++ b/src/services/UserService.ts @@ -324,6 +324,34 @@ const getUserSecurityGroups = async (userLoginId: string): Promise => { return userSecurityGroups } +const isUserFulfillmentAdmin = async (groupIds: string): Promise => { + const payload = { + inputFields: { + groupId: groupIds, + groupId_op: "in", + permissionId: "STOREFULFILLMENT_ADMIN" + }, + entityName: "SecurityGroupPermission", + filterByDate: "Y", + viewSize: 1, + fieldList: ["groupId", "permissionId", "fromDate"] + }; + + try { + const resp: any = await api({ + url: "performFind", + method: "POST", + data: payload, + }); + if(!hasError(resp) && resp.data.docs.length) { + return true + } + return false + } catch(err) { + return false + } +} + const removeUserSecurityGroup = async (payload: any): Promise => { return api({ url: "service/removePartyUserPermission", @@ -784,6 +812,7 @@ export const UserService = { getUserFacilities, getUserProductStores, getUserSecurityGroups, + isUserFulfillmentAdmin, isUserLoginIdAlreadyExists, isRoleTypeExists, login, diff --git a/src/views/UserDetails.vue b/src/views/UserDetails.vue index 31d49d6..78e6e3b 100644 --- a/src/views/UserDetails.vue +++ b/src/views/UserDetails.vue @@ -275,7 +275,7 @@