def _check_rule_ok(self, username, rule, conan_reference):
        """Checks if a rule specified in config file applies to current conans
        reference and current user"""
        try:
            rule_ref = ConanFileReference.loads(rule[0])
        except Exception:
            # TODO: Log error
            raise InternalErrorException("Invalid server configuration. "
                                         "Contact the administrator.")
        authorized_users = rule[1].split(",")
        if len(authorized_users) < 1:
            raise InternalErrorException("Invalid server configuration. "
                                         "Contact the administrator.")

        # Check if rule apply conan_reference
        if self._check_ref_apply_for_rule(rule_ref, conan_reference):
            if authorized_users[0] == "*" or username in authorized_users:
                return True  # Ok, applies and match username
            else:
                raise ForbiddenException("Unauthorized")

        return False
dataset/ETHPy150Open conan-io/conan/conans/server/service/authorize.py/BasicAuthorizer._check_rule_ok/original