added permission code (#787)

This commit is contained in:
Gabe Hernandez
2021-05-18 16:08:48 +01:00
committed by GitHub
parent ea0c6c8e3f
commit d0f839a614
3 changed files with 39 additions and 3 deletions
@@ -19,4 +19,27 @@ export default PropTypes.shape({
server: PropTypes.string,
user_name: PropTypes.string,
verify_sll_certs: PropTypes.bool,
tier: PropTypes.string,
});
export interface IConfig {
live_query_disabled: boolean;
authentication_method: string;
authentication_type: string;
configured: boolean;
domain: string;
enable_ssl_tls: boolean;
enable_start_tls: boolean;
host_expiry_enabled: boolean;
host_expiry_window: number;
kolide_server_url: string;
org_logo_url: string;
org_name: string;
password: string;
port: number;
sender_address: string;
server: string;
user_name: string;
verify_sll_certs: boolean;
tier: string;
}
+2
View File
@@ -5,6 +5,7 @@ export const frontendFormattedConfig = (config) => {
smtp_settings: smtpSettings,
sso_settings: ssoSettings,
host_expiry_settings: hostExpirySettings,
license,
} = config;
return {
@@ -13,6 +14,7 @@ export const frontendFormattedConfig = (config) => {
...smtpSettings,
...ssoSettings,
...hostExpirySettings,
...license,
};
};
+14 -3
View File
@@ -1,18 +1,29 @@
import { IUser } from "interfaces/user";
import { IConfig } from "../../interfaces/config";
const isGlobalAdmin = (user: IUser) => {
const isCoreTier = (config: IConfig): boolean => {
return config.tier === "core";
};
const isBasicTier = (config: IConfig): boolean => {
return config.tier === "basic";
};
const isGlobalAdmin = (user: IUser): boolean => {
return user.global_role === "admin";
};
const isGlobalMaintainer = (user: IUser) => {
const isGlobalMaintainer = (user: IUser): boolean => {
return user.global_role === "maintainer";
};
const isOnGlobalTeam = (user: IUser) => {
const isOnGlobalTeam = (user: IUser): boolean => {
return user.global_role !== null;
};
export default {
isCoreTier,
isBasicTier,
isGlobalAdmin,
isGlobalMaintainer,
isOnGlobalTeam,