Add docstrings and log warning in _is_leader and _is_reviewer.
refactor the permission checking into a dict.