move _has_access to be general function