def reject_add_task_admins(txn_key, batch_key, proposal_id, task_id, user_id,
                           reason):
    reject_payload = task_transaction_pb2.RejectAddTaskAdmin(
        proposal_id=proposal_id,
        task_id=task_id,
        user_id=user_id,
        reason=reason)

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

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

    rbac_payload = rbac_payload_pb2.RBACPayload(
        content=reject_payload.SerializeToString(),
        message_type=rbac_payload_pb2.RBACPayload.REJECT_ADD_TASK_ADMIN,
        inputs=inputs,
        outputs=outputs,
    )

    return make_header_and_batch(rbac_payload, inputs, outputs, txn_key,
                                 batch_key)
示例#2
0
def apply_reject(header, payload, state):
    reject_payload = task_transaction_pb2.RejectAddTaskAdmin()
    reject_payload.ParseFromString(payload.content)

    txn_signer_admin_address = addresser.task.admin.address(
        reject_payload.task_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)