function isPermittedAux(role, permission) {
    const permissions = memoryDB.PA[role]
    for(let i = 0; i<permissions.length; i++){
        if(JSON.stringify(permission).match(JSON.stringify(permissions[i])))
            return true
    }

    const hierarchy = memoryDB.RH[role]
    for(let i = 0; i<hierarchy.length; i++){
        if(isPermittedAux(hierarchy[i], permission))
            return true
    }
    return false
}
/**
 * Auxiliary method to isPermitted()
 *
 * @param role role to check permission
 * @param permission permission to check
 * @return {boolean} true if role permits permission
 */
Auxiliary method to isPermitted()
@param role role to check permission
@param permission permission to check
@return {boolean} true if role permits permission
Auxiliary method to isPermitted () @param role role to check permission @param permission permission to check @return { boolean } true if role permits permission
function isPermittedAux(role, permission) {
    const permissions = memoryDB.PA[role]
    for(let i = 0; i<permissions.length; i++){
        if(JSON.stringify(permission).match(JSON.stringify(permissions[i])))
            return true
    }
    const hierarchy = memoryDB.RH[role]
    for(let i = 0; i<hierarchy.length; i++){
        if(isPermittedAux(hierarchy[i], permission))
            return true
    }
    return false
}
function isPermittedAux ( role , permission ) { const permissions = memoryDB . PA [ role ] for ( let i = 0 ; i < permissions . length ; i ++ ) { if ( JSON . stringify ( permission ) . match ( JSON . stringify ( permissions [ i ] ) ) ) return true } const hierarchy = memoryDB . RH [ role ] for ( let i = 0 ; i < hierarchy . length ; i ++ ) { if ( isPermittedAux ( hierarchy [ i ] , permission ) ) return true } return false }
Auxiliary method to isPermitted()
 @param role role to check permission
 @param permission permission to check
 @return {boolean} true if role permits permission
Auxiliary method to isPermitted () @param role role to check permission @param permission permission to check @return { boolean } true if role permits permission