Skip to content

Commit

Permalink
chore: request changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Desvelao committed Dec 20, 2024
1 parent 5258fe2 commit 12187ab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions plugins/wazuh-core/public/services/server-security/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export interface ServerSecuritySetupReturn {
withServerUserAuthorizationPrompt: (
permissions: ServerSecurityCombinedPermissionWithFunction | null,
otherPermissions: { isAdmininistrator: boolean | null },
) => (WrappedComponent: React.Component) => React.ReactElement;
) => (WrappedComponent: React.ComponentType) => React.ReactElement;
withServerUserLogged: (
WrappedComponent: React.Component,
WrappedComponent: React.ComponentType,
) => React.ReactElement;
};
ui: {
ServerButtonPermissions: React.Component;
ServerElementPermissions: React.Component;
ServerButtonPermissions: React.ComponentType;
ServerElementPermissions: React.ComponentType;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ enum SERVER_BUTTON_PERMISSIONS_TYPES {
EMPTY = 'empty',
ICON = 'icon',
LINK = 'link',
SWTICH = 'switch',
SWITCH = 'switch',
}

interface IServerButtonPermissionsProps
Expand All @@ -45,7 +45,7 @@ const ButtonsMap = {
[SERVER_BUTTON_PERMISSIONS_TYPES.EMPTY]: EuiButtonEmpty,
[SERVER_BUTTON_PERMISSIONS_TYPES.ICON]: EuiButtonIcon,
[SERVER_BUTTON_PERMISSIONS_TYPES.LINK]: EuiLink,
[SERVER_BUTTON_PERMISSIONS_TYPES.SWTICH]: EuiSwitch,
[SERVER_BUTTON_PERMISSIONS_TYPES.SWITCH]: EuiSwitch,
};

export const ServerButtonPermissions = ({
Expand All @@ -66,20 +66,20 @@ export const ServerButtonPermissions = ({
const additionalProps = {
...([
SERVER_BUTTON_PERMISSIONS_TYPES.LINK,
SERVER_BUTTON_PERMISSIONS_TYPES.SWTICH,
SERVER_BUTTON_PERMISSIONS_TYPES.SWITCH,
].includes(buttonType)
? { disabled }
: { isDisabled: disabled }),
onClick: disabled || !rest.onClick ? undefined : rest.onClick,
onChange:
!disabled ||
rest.onChange ||
buttonType === SERVER_BUTTON_PERMISSIONS_TYPES.SWTICH
buttonType === SERVER_BUTTON_PERMISSIONS_TYPES.SWITCH
? rest.onChange
: undefined,
};

if (buttonType === SERVER_BUTTON_PERMISSIONS_TYPES.SWTICH) {
if (buttonType === SERVER_BUTTON_PERMISSIONS_TYPES.SWITCH) {
delete additionalProps.onClick;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import wazuhPermissions from '../../../common/api-info/security-actions.json';
const RESOURCE_ANY = '*:*:*';
const RESOURCE_ANY_SHORT = '*:*';
const RBAC_MODE_WHITE = 'white';
const ALLOW = 'allow';
// Utility functions
const isAllow = (value: string) => value === 'allow';
const isAllow = (value: string) => value === ALLOW;

// Check the missing permissions of the required ones that the user does not have
export const checkMissingUserPermissions = (
Expand Down

0 comments on commit 12187ab

Please sign in to comment.