Skip to content

Commit

Permalink
Merge pull request #2180 from abilpraju-aot/bugfix/FWF-3552-permission
Browse files Browse the repository at this point in the history
updated the multi-tenancy  condition
  • Loading branch information
arun-s-aot authored Aug 8, 2024
2 parents 587ca83 + 867a1ce commit e37bf8a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import {
import { fetchAllForms } from "../../../../apiManager/services/bpmFormServices";
import { fetchUserList } from "../../../../apiManager/services/bpmTaskServices";
import { filterSelectOptionByLabel } from "../../../../helper/helper";
import { removeTenantKey } from "../../../../helper/helper";

const initialValueOfTaskAttribute = {
applicationId: true,
Expand Down Expand Up @@ -115,7 +116,7 @@ export default function CreateNewFilterDrawer({
const [selectedForm, setSelectedForm] = useState(null);
const [taskVariablesKeys, setTaskVariablesKeys] = useState({});
const [processLoading, setProcessLoading] = useState(false);
const loginedUserRoles = useSelector((state) => state.user.roles || []);
//const loginedUserRoles = useSelector((state) => state.user.roles || []);

const [overlayGroupShow, setOverlayGroupShow] = useState(false);
const [overlayUserShow, setOverlayUserShow] = useState(false);
Expand Down Expand Up @@ -398,7 +399,7 @@ export default function CreateNewFilterDrawer({
processDefinitionKey: definitionKeyId,
candidateGroup:
MULTITENANCY_ENABLED && candidateGroup
? tenantKey + "-" + candidateGroup
? tenantKey + "-" + trimFirstSlash(candidateGroup)
: candidateGroup,
assignee: assignee,
includeAssignedTasks:
Expand All @@ -420,6 +421,7 @@ export default function CreateNewFilterDrawer({
isTasksForCurrentUserGroupsEnabled: isTasksForCurrentUserGroupsEnabled,
isMyTasksEnabled: isMyTasksEnabled,
};

/**
* If a form is selected, set the formId property in the data object
* to the id of the selected form.
Expand Down Expand Up @@ -543,19 +545,19 @@ export default function CreateNewFilterDrawer({
label: `${user.username}`,
}));
}, [userList]);

const candidateOptions = useMemo(() => {
return MULTITENANCY_ENABLED
? loginedUserRoles.map((role) => ({
value: role,
label: role,
? candidateGroups.map((group) => ({
value: removeTenantKey(group, tenantKey),
label: removeTenantKey(group, tenantKey),
}))
: candidateGroups.map((group) => ({
value: trimFirstSlash(group),
label: group,
}));
}, [candidateGroups, loginedUserRoles, MULTITENANCY_ENABLED]);

}, [candidateGroups, MULTITENANCY_ENABLED]);
const handleAssignee = (selectedOption) => {
setAssignee(selectedOption ? selectedOption.value : null);
};
Expand Down
2 changes: 1 addition & 1 deletion forms-flow-web/src/helper/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const addTenantkey = (value, tenantkey) => {
const removeTenantKey = (value, tenantkey) => {
const tenantKeyCheck = value.match(`${tenantkey}-`);
if (
tenantKeyCheck &&
tenantKeyCheck && tenantKeyCheck.length &&
tenantKeyCheck[0].toLowerCase() === `${tenantkey.toLowerCase()}-`
) {
return value.replace(`${tenantkey.toLowerCase()}-`, "");
Expand Down

0 comments on commit e37bf8a

Please sign in to comment.