Skip to content

Commit

Permalink
chore: reverted org invite changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gitanjli525 committed Oct 15, 2024
1 parent 840837c commit 522a71d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
12 changes: 4 additions & 8 deletions src/screens/UserManagement/UserRevamp/UserInfo.res
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ module UserAction = {
)

let decideWhatToShow = {
if userEmail === email {
if value.entityType->UserInfoUtils.entityMapper === #Organization {
// User is at org level
NoActionAccess
} else if userEmail === email {
// User cannot update its own role
NoActionAccess
} else if userHasAccess(~groupAccess=UsersManage) === NoAccess {
Expand All @@ -30,13 +33,6 @@ module UserAction = {
value.profile.id->Option.getOr("") === profileId
) {
ManageUser
} else if (
// Merchant level user
value.org.id->Option.getOr("") === orgId &&
value.merchant.id->Option.getOr("") === merchantId &&
value.profile.id->Option.isNone
) {
ManageUser
} else if (
// Org level user
value.org.id->Option.getOr("") === orgId &&
Expand Down
24 changes: 1 addition & 23 deletions src/screens/UserManagement/UserRevamp/UserManagementHelper.res
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ module MerchantSelection = {
~label="All merchants",
~value="all_merchants",
~dropdownList=merchList,
~showAllSelection=true,
),
~deselectDisable=true,
~buttonText="Select a Merchant",
Expand Down Expand Up @@ -113,31 +112,10 @@ module ProfileSelection = {
let internalSwitch = OMPSwitchHooks.useInternalSwitch()
let profileList = Recoil.useRecoilValueFromAtom(HyperswitchAtom.profileListAtom)
let {userInfo: {userEntity}} = React.useContext(UserInfoProvider.defaultContext)
let form = ReactFinalForm.useForm()
let formState: ReactFinalForm.formState = ReactFinalForm.useFormState(
ReactFinalForm.useFormSubscription(["values"])->Nullable.make,
)

let disableSelect = switch userEntity {
| #Profile => true
| #Organization => {
let selected_merchant =
formState.values
->LogicUtils.getDictFromJsonObject
->LogicUtils.getString("merchant_value", "")
switch selected_merchant->stringToVariantForAllSelection {
| Some(#All_Merchants) => {
form.change(
"profile_value",
(#All_Profiles: UserManagementTypes.allSelectionType :> string)
->String.toLowerCase
->JSON.Encode.string,
)
true
}
| _ => false
}
}
| #Organization
| #Merchant => false
}

Expand Down

0 comments on commit 522a71d

Please sign in to comment.