mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Merge pull request #4931 from Infisical/fix/minor-bugs-in-project-role-access-tree
fix: minor bugs in project role access tree
This commit is contained in:
@@ -87,17 +87,24 @@ const shouldShowConditionalAccess = (
|
|||||||
folderPath: string,
|
folderPath: string,
|
||||||
conditionalFields: string[]
|
conditionalFields: string[]
|
||||||
): boolean => {
|
): boolean => {
|
||||||
return actionRuleMap.some((rule) => {
|
// Find all rules that apply to this environment/path
|
||||||
|
const applicableRules = actionRuleMap.filter((rule) => {
|
||||||
const ruleConditions = rule[action]?.conditions;
|
const ruleConditions = rule[action]?.conditions;
|
||||||
if (!ruleConditions) return false;
|
if (!ruleConditions) return false;
|
||||||
|
|
||||||
// Check if any of the conditional fields are present
|
|
||||||
const hasConditionalField = conditionalFields.some((field) => ruleConditions[field]);
|
|
||||||
if (!hasConditionalField) return false;
|
|
||||||
|
|
||||||
// Check if base conditions (environment and secretPath) apply
|
|
||||||
return doBaseConditionsApply(ruleConditions, environment, folderPath);
|
return doBaseConditionsApply(ruleConditions, environment, folderPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// If no rules apply, don't show conditional
|
||||||
|
if (applicableRules.length === 0) return false;
|
||||||
|
|
||||||
|
// Check if ALL applicable rules have conditional fields and if at least one rule applies without conditional fields, show full access
|
||||||
|
const allRulesHaveConditionalFields = applicableRules.every((rule) => {
|
||||||
|
const ruleConditions = rule[action]?.conditions;
|
||||||
|
if (!ruleConditions) return false;
|
||||||
|
return conditionalFields.some((field) => ruleConditions[field]);
|
||||||
|
});
|
||||||
|
|
||||||
|
return allRulesHaveConditionalFields;
|
||||||
};
|
};
|
||||||
|
|
||||||
const determineAccessLevel = (
|
const determineAccessLevel = (
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import {
|
|||||||
faArrowRight,
|
faArrowRight,
|
||||||
faArrowRightToBracket,
|
faArrowRightToBracket,
|
||||||
faArrowUp,
|
faArrowUp,
|
||||||
|
faCheck,
|
||||||
|
faCopy,
|
||||||
faFilter,
|
faFilter,
|
||||||
faFingerprint,
|
faFingerprint,
|
||||||
faFolder,
|
faFolder,
|
||||||
@@ -79,6 +81,7 @@ import {
|
|||||||
usePopUp,
|
usePopUp,
|
||||||
useResetPageHelper,
|
useResetPageHelper,
|
||||||
useResizableHeaderHeight,
|
useResizableHeaderHeight,
|
||||||
|
useTimedReset,
|
||||||
useToggle
|
useToggle
|
||||||
} from "@app/hooks";
|
} from "@app/hooks";
|
||||||
import {
|
import {
|
||||||
@@ -194,6 +197,15 @@ export const OverviewPage = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [copiedSlug, , setCopiedSlug] = useTimedReset<string>({
|
||||||
|
initialState: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
const copyToClipboard = (value: string, slug: string) => {
|
||||||
|
navigator.clipboard.writeText(value);
|
||||||
|
setCopiedSlug(slug);
|
||||||
|
};
|
||||||
|
|
||||||
const [filter, setFilter] = useState<Filter>(DEFAULT_FILTER_STATE);
|
const [filter, setFilter] = useState<Filter>(DEFAULT_FILTER_STATE);
|
||||||
const [filterHistory, setFilterHistory] = useState<
|
const [filterHistory, setFilterHistory] = useState<
|
||||||
Map<string, { filter: Filter; searchFilter: string }>
|
Map<string, { filter: Filter; searchFilter: string }>
|
||||||
@@ -1324,19 +1336,33 @@ export const OverviewPage = () => {
|
|||||||
>
|
>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
content={
|
content={
|
||||||
collapseEnvironments ? (
|
<div className="flex flex-col gap-2">
|
||||||
<p className="whitespace-break-spaces">{name}</p>
|
{collapseEnvironments ? (
|
||||||
) : (
|
<p className="whitespace-break-spaces text-mineshaft-300">{name}</p>
|
||||||
""
|
) : (
|
||||||
)
|
""
|
||||||
|
)}
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<p className="text-xs text-mineshaft-300">{slug}</p>
|
||||||
|
<IconButton
|
||||||
|
variant="plain"
|
||||||
|
colorSchema="secondary"
|
||||||
|
ariaLabel="Copy environment slug"
|
||||||
|
onClick={() => copyToClipboard(slug, slug)}
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon icon={copiedSlug === slug ? faCheck : faCopy} />
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
side="bottom"
|
side="bottom"
|
||||||
sideOffset={-1}
|
sideOffset={5}
|
||||||
align="end"
|
align="center"
|
||||||
className="max-w-xl text-xs normal-case"
|
className="max-w-xl text-xs normal-case"
|
||||||
rootProps={{
|
rootProps={{
|
||||||
disableHoverableContent: true
|
disableHoverableContent: false
|
||||||
}}
|
}}
|
||||||
|
key={`tooltip-${name}-${index + 1}`}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
|
|||||||
Reference in New Issue
Block a user