Skip to content

Commit

Permalink
Merge pull request #782 from Arnei/typing-aclUtils
Browse files Browse the repository at this point in the history
Add typing to AclUtils.ts
  • Loading branch information
lkiesow authored Jul 2, 2024
2 parents 6a81af8 + 5525763 commit 4c754c3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/utils/aclUtils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
/*This File contains functions that are needed in several access right views*/

export const getAclTemplateText = (aclTemplates: any, formikTemplate: any) => {
import { TransformedAcl } from "../slices/aclDetailsSlice";
import { Role } from "../slices/aclSlice";

export const getAclTemplateText = (
aclTemplates: {
id: string
value: string
}[],
formikTemplate: string
) => {
if (!!aclTemplates && aclTemplates.length > 0) {
const template = aclTemplates.find(
// @ts-expect-error TS(7006): Parameter 'template' implicitly has an 'any' type.
(template) => formikTemplate === template.id
);
return !!template ? template.value : "";
Expand All @@ -12,10 +20,8 @@ export const getAclTemplateText = (aclTemplates: any, formikTemplate: any) => {
}
};

// @ts-expect-error TS(7006): Parameter 'roles' implicitly has an 'any' type.
export const filterRoles = (roles, policies) => {
export const filterRoles = (roles: Role[], policies: TransformedAcl[]) => {
return roles.filter(
// @ts-expect-error TS(7006): Parameter 'role' implicitly has an 'any' type.
(role) => !policies.find((policy) => policy.role === role.name)
);
};

0 comments on commit 4c754c3

Please sign in to comment.