+ {serverResponse.details?.missingPermissions?.map((el, index) => {
+ const hasConditions = Boolean(Object.keys(el.conditions || {}).length);
+ return (
+
+
+ You are not authorized to perform the {el.action} action on the{" "}
+ {el.subject} resource.{" "}
+ {hasConditions &&
+ "Your permission does not allow access to the following conditions:"}
+
+ {hasConditions && (
+
+ {Object.keys(el.conditions || {}).flatMap((field, fieldIndex) => {
+ const operators = (
+ el.conditions as Record<
+ string,
+ | string
+ | { [K in PermissionConditionOperators]: string | string[] }
+ >
+ )[field];
+
+ const formattedFieldName = camelCaseToSpaces(field).toLowerCase();
+ if (typeof operators === "string") {
+ return (
+ -
+
+ {formattedFieldName}
+ {" "}
+ equal to{" "}
+ {operators}
+
+ );
+ }
+
+ return Object.keys(operators).map((operator, operatorIndex) => (
+ -
+
+ {formattedFieldName}
+ {" "}
+
+ {
+ formatedConditionsOperatorNames[
+ operator as PermissionConditionOperators
+ ]
+ }
+ {" "}
+
+ {operators[
+ operator as PermissionConditionOperators
+ ].toString()}
+
+
+ ));
+ })}
+
+ )}
+
+ );
+ })}
+
+