addded permission logic