add permission logic