import { Class , UserEnvelope , RoleInterface , RoleAccess } from '@boostercloud/framework-types' ; export class BoosterAuth { public static isUserAuthorized ( authorizedRoles , user ? ) { if ( authorizedRoles == 'all' ) { return true ; } if ( ! user ) { return false ; } return userHasSomeRole ( user , authorizedRoles ) ; } } function userHasSomeRole ( user , authorizedRoles ) { return authorizedRoles . some ( ( roleClass ) => user . role === roleClass . name ) ; }