def reject_add_task_owners(txn_key, batch_key, proposal_id, task_id, user_id,
                           reason):
    reject = task_transaction_pb2.RejectAddTaskOwner(proposal_id=proposal_id,
                                                     task_id=task_id,
                                                     user_id=user_id,
                                                     reason=reason)

    inputs = [
        addresser.proposal.address(task_id, user_id),
        addresser.user.address(txn_key.public_key),
        addresser.task.admin.address(task_id, txn_key.public_key),
        addresser.task.owner.address(task_id, txn_key.public_key),
    ]

    outputs = [addresser.proposal.address(task_id, user_id)]

    rbac_payload = rbac_payload_pb2.RBACPayload(
        content=reject.SerializeToString(),
        message_type=rbac_payload_pb2.RBACPayload.REJECT_ADD_TASK_OWNER,
        inputs=inputs,
        outputs=outputs,
    )

    return make_header_and_batch(rbac_payload, inputs, outputs, txn_key,
                                 batch_key)
def apply_reject(header, payload, state):
    reject_payload = task_transaction_pb2.RejectAddTaskOwner()
    reject_payload.ParseFromString(payload.content)

    txn_signer_admin_address = addresser.make_task_admins_address(
        task_id=reject_payload.task_id, user_id=header.signer_public_key)

    state_entries = task_validator.validate_task_admin_or_owner(
        header=header,
        confirm=reject_payload,
        txn_signer_rel_address=txn_signer_admin_address,
        task_rel_address="",
        state=state,
        is_remove=False,
    )

    state_change.reject_task_action(state_entries, header, reject_payload,
                                    state)