Passing permissions and roles into calculate function in attemppts to
fix travis tests.