Added logout. Auto logout if permissions not granted.