Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved: facility display logic on Admin/Super user details page(#173) #271

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

R-Sourabh
Copy link
Contributor

@R-Sourabh R-Sourabh commented Sep 11, 2024

Related Issues

#173

Short Description and Why It's Useful

  • Added checks to show a text message for the Admin/Super User on the Fulfillment card.
  • If the user does not have the STOREFULFILLMENT_ADMIN permission, it shows the facility selector button.
  • Using the SecurityGroupPermission to check the user specific permissions w.r.t to group.

Screenshots of Visual Changes before/after (If There Are Any)

Screenshot from 2024-09-11 11-55-05

Contribution and Currently Important Rules Acceptance

const payload = {
inputFields: {
userLoginId,
permissionId: ['STOREFULFILLMENT_ADMIN']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we are passing list in permissionId here?

permissionId: ['STOREFULFILLMENT_ADMIN']
},
entityName: "UserLoginSecurityGroupAndPermission",
filterByDate: "Y",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we will get expired permission in this case. As the UserLoginSecurityGroupAndPermission view has dates for managing UserLogin and Security Group association (fromDate, thruDate) as well as dates for managing SecurityGroup and SecurityGroupPermission associations (SGPFromDate, SGPThruDate). The filterByDate parameter in performFind service by default consider fromDate and thruDate for filtering active records.

We need checks on both the dates which is not possible in performFind. You should use the getPermission api here which is used during login to fetch the user's permission.

@@ -326,6 +326,34 @@ const getUserSecurityGroup = async (userLoginId: string): Promise<any> => {

return userSecurityGroup
}
const isUserFulfillmentAdmin = async (userLoginId: string): Promise<any> => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the service suggest that boolean value will be returned, but you are returning data. Either return boolean or change the name of the service.

@@ -520,6 +523,7 @@ export default defineComponent({
isUserFetched: false,
showPassword: false,
shopifyShopsForProductStore: [] as any,
isUserFulfillmentAdmin: []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isUserFulfillmentAdmin should be boolean.

<ion-item lines="none" v-if="isUserFulfillmentAdmin.length">
<ion-label>{{ translate("This user has 'STOREFULFILLMENT_ADMIN' permission, enabling access to all facilities.") }}</ion-label>
</ion-item>
<ion-item lines="none" button detail v-else @click="selectFacility()" :disabled="selectedUser.securityGroup.groupId === 'INTEGRATION'">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the Actions.APP_UPDT_FULFILLMENT_FACILITY permission is removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants