class RbacClient(object):
    def __init__(self, url, key):
        if url is None:
            url = REST_ENDPOINT
        self._client = RestClient(base_url=url)
        self._key = key

    def return_state(self):
        items = []
        for item in self._client.list_state(
                subtree=addresser.NAMESPACE)["data"]:
            if addresser.address_is(
                    item["address"]) == addresser.AddressSpace.USER:
                user_container = user_state_pb2.UserContainer()
                user_container.ParseFromString(b64decode(item["data"]))
                items.append((user_container, addresser.AddressSpace.USER))
        return items

    def create_user(self, key, name, user_name, user_id, manager_id=None):
        batch_list, signature = create_user(
            txn_key=key,
            batch_key=self._key,
            name=name,
            user_name=user_name,
            user_id=user_id,
            metadata=uuid4().hex,
            manager_id=manager_id,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def create_role(self, key, role_name, role_id, metadata, admins, owners):
        batch_list, signature = role_transaction_creation.create_role(
            txn_key=key,
            batch_key=self._key,
            role_name=role_name,
            role_id=role_id,
            metadata=metadata,
            admins=admins,
            owners=owners,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def propose_update_manager(self, key, proposal_id, user_id, new_manager_id,
                               reason, metadata):

        batch_list, signature = manager_transaction_creation.propose_manager(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            user_id=user_id,
            new_manager_id=new_manager_id,
            reason=reason,
            metadata=metadata,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def confirm_update_manager(self, key, proposal_id, reason, user_id,
                               manager_id):
        batch_list, signature = manager_transaction_creation.confirm_manager(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            reason=reason,
            user_id=user_id,
            manager_id=manager_id,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def reject_update_manager(self, key, proposal_id, reason, user_id,
                              manager_id):
        batch_list, signature = manager_transaction_creation.reject_manager(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            reason=reason,
            user_id=user_id,
            manager_id=manager_id,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def propose_add_role_admins(self, key, proposal_id, role_id, user_id,
                                reason, metadata):
        batch_list, signature = role_transaction_creation.propose_add_role_admins(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            role_id=role_id,
            user_id=user_id,
            reason=reason,
            metadata=metadata,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def confirm_add_role_admins(self, key, proposal_id, role_id, user_id,
                                reason):
        batch_list, signature = role_transaction_creation.confirm_add_role_admins(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            role_id=role_id,
            user_id=user_id,
            reason=reason,
        )

        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def reject_add_role_admins(self, key, proposal_id, role_id, user_id,
                               reason):

        batch_list, signature = role_transaction_creation.reject_add_role_admins(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            role_id=role_id,
            user_id=user_id,
            reason=reason,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def propose_add_role_owners(self, key, proposal_id, role_id, user_id,
                                reason, metadata):
        batch_list, signature = role_transaction_creation.propose_add_role_owners(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            role_id=role_id,
            user_id=user_id,
            reason=reason,
            metadata=metadata,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def confirm_add_role_owners(self, key, proposal_id, role_id, user_id,
                                reason):
        batch_list, signature = role_transaction_creation.confirm_add_role_owners(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            role_id=role_id,
            user_id=user_id,
            reason=reason,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def reject_add_role_owners(self, key, proposal_id, role_id, user_id,
                               reason):
        batch_list, signature = role_transaction_creation.reject_add_role_owners(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            role_id=role_id,
            user_id=user_id,
            reason=reason,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def propose_add_role_members(self, key, proposal_id, role_id, user_id,
                                 reason, metadata):
        batch_list, signature = role_transaction_creation.propose_add_role_members(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            role_id=role_id,
            user_id=user_id,
            reason=reason,
            metadata=metadata,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def confirm_add_role_members(self, key, proposal_id, role_id, user_id,
                                 reason):
        batch_list, signature = role_transaction_creation.confirm_add_role_members(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            role_id=role_id,
            user_id=user_id,
            reason=reason,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def reject_add_role_members(self, key, proposal_id, role_id, user_id,
                                reason):
        batch_list, signature = role_transaction_creation.reject_add_role_members(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            role_id=role_id,
            user_id=user_id,
            reason=reason,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def propose_add_role_tasks(self, key, proposal_id, role_id, task_id,
                               reason, metadata):
        batch_list, signature = role_transaction_creation.propose_add_role_tasks(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            role_id=role_id,
            task_id=task_id,
            reason=reason,
            metadata=metadata,
        )

        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def confirm_add_role_tasks(self, key, proposal_id, role_id, task_id,
                               reason):
        batch_list, signature = role_transaction_creation.confirm_add_role_tasks(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            role_id=role_id,
            task_id=task_id,
            reason=reason,
        )

        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def reject_add_role_tasks(self, key, proposal_id, role_id, task_id,
                              reason):
        batch_list, signature = role_transaction_creation.reject_add_role_tasks(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            role_id=role_id,
            task_id=task_id,
            reason=reason,
        )

        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def create_task(self, key, task_id, task_name, admins, owners, metadata):

        batch_list, signature = task_transaction_creation.create_task(
            txn_key=key,
            batch_key=self._key,
            task_id=task_id,
            task_name=task_name,
            admins=admins,
            owners=owners,
            metadata=metadata,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def propose_add_task_admins(self, key, proposal_id, task_id, user_id,
                                reason, metadata):
        batch_list, signature = task_transaction_creation.propose_add_task_admins(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            task_id=task_id,
            user_id=user_id,
            reason=reason,
            metadata=metadata,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def confirm_add_task_admins(self, key, proposal_id, task_id, user_id,
                                reason):
        batch_list, signature = task_transaction_creation.confirm_add_task_admins(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            task_id=task_id,
            user_id=user_id,
            reason=reason,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def reject_add_task_admins(self, key, proposal_id, task_id, user_id,
                               reason):
        batch_list, signature = task_transaction_creation.reject_add_task_admins(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            task_id=task_id,
            user_id=user_id,
            reason=reason,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def propose_add_task_owners(self, key, proposal_id, task_id, user_id,
                                reason, metadata):
        batch_list, signature = task_transaction_creation.propose_add_task_owner(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            task_id=task_id,
            user_id=user_id,
            reason=reason,
            metadata=metadata,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def confirm_add_task_owners(self, key, proposal_id, task_id, user_id,
                                reason):
        batch_list, signature = task_transaction_creation.confirm_add_task_owners(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            task_id=task_id,
            user_id=user_id,
            reason=reason,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def reject_add_task_owners(self, key, proposal_id, task_id, user_id,
                               reason):
        batch_list, signature = task_transaction_creation.reject_add_task_owners(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            task_id=task_id,
            user_id=user_id,
            reason=reason,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def propose_delete_task_admins(self, key, proposal_id, task_id, user_id,
                                   reason, metadata):
        batch_list, signature = task_transaction_creation.propose_remove_task_admins(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            task_id=task_id,
            user_id=user_id,
            reason=reason,
            metadata=metadata,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)

    def propose_delete_task_owners(self, key, proposal_id, task_id, user_id,
                                   reason, metadata):

        batch_list, signature = task_transaction_creation.propose_remove_task_owners(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            task_id=task_id,
            user_id=user_id,
            reason=reason,
            metadata=metadata,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)
Exemple #2
0
class RbacClient(object):
    """RBAC Client test class."""
    def __init__(self, url, key):
        if url is None:
            url = REST_ENDPOINT
        self._client = RestClient(base_url=url)
        self._key = key

    def create_user(self, key, name, username, next_id, manager_id=None):
        """Create a new user."""
        batch_list = User().batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            name=name,
            username=username,
            next_id=next_id,
            metadata=uuid4().hex,
            manager_id=manager_id,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def create_role(self, key, role_name, role_id, metadata, admins, owners):
        """Create a new role."""
        batch_list = Role().batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            name=role_name,
            role_id=role_id,
            metadata=metadata,
            admins=admins,
            owners=owners,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_update_manager(self, key, proposal_id, next_id, new_manager_id,
                               reason, metadata):
        """Propose an update of user's manager."""
        batch_list = User().manager.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            next_id=next_id,
            new_manager_id=new_manager_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_update_manager(self, key, proposal_id, reason, next_id,
                               manager_id):
        """Confirm the update of a user's manager."""
        batch_list = User().manager.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            reason=reason,
            object_id=next_id,
            related_id=manager_id,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_update_manager(self, key, proposal_id, reason, next_id,
                              manager_id):
        """Reject the update of a user's manager."""
        batch_list = User().manager.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            reason=reason,
            object_id=next_id,
            related_id=manager_id,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_add_role_admins(self, key, proposal_id, role_id, next_id,
                                reason, metadata):
        """Propose adding admin to role."""
        batch_list = Role().admin.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            role_id=role_id,
            next_id=next_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_add_role_admins(self, key, proposal_id, role_id, next_id,
                                reason):
        """Confirm addition of admin to role."""
        batch_list = Role().admin.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=next_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_add_role_admins(self, key, proposal_id, role_id, next_id,
                               reason):
        """Reject addition of admin to role."""
        batch_list = Role().admin.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=next_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_add_role_owners(self, key, proposal_id, role_id, next_id,
                                reason, metadata):
        """Propose adding owner to role."""
        batch_list = Role().owner.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            role_id=role_id,
            next_id=next_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_add_role_owners(self, key, proposal_id, role_id, next_id,
                                reason):
        """Confirm addition of owner to role."""
        batch_list = Role().owner.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=next_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_add_role_owners(self, key, proposal_id, role_id, next_id,
                               reason):
        """Reject addition of role owner."""
        batch_list = Role().owner.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=next_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_add_role_members(self, key, proposal_id, role_id, next_id,
                                 reason, metadata):
        """Propose adding role member."""
        batch_list = Role().member.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            role_id=role_id,
            next_id=next_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_add_role_members(self, key, proposal_id, role_id, next_id,
                                 reason):
        """Confirm addition of role member."""
        batch_list = Role().member.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=next_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_add_role_members(self, key, proposal_id, role_id, next_id,
                                reason):
        """Reject addition of role member."""
        batch_list = Role().member.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=next_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_add_role_tasks(self, key, proposal_id, role_id, task_id,
                               reason, metadata):
        """Propose adding task to role."""
        batch_list = Role().task.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            role_id=role_id,
            task_id=task_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_add_role_tasks(self, key, proposal_id, role_id, task_id,
                               reason):
        """Confirm addition of task to role."""
        batch_list = Role().task.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=task_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_add_role_tasks(self, key, proposal_id, role_id, task_id,
                              reason):
        """Reject addition of task to role."""
        batch_list = Role().task.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=task_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def create_task(self, key, task_id, task_name, admins, owners, metadata):
        """Create a new task."""
        batch_list = Task().batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            task_id=task_id,
            name=task_name,
            admins=admins,
            owners=owners,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_add_task_admins(self, key, proposal_id, task_id, next_id,
                                reason, metadata):
        """Propose adding a task admin."""
        batch_list = Task().admin.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            task_id=task_id,
            next_id=next_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_add_task_admins(self, key, proposal_id, task_id, next_id,
                                reason):
        """Confirm addition of task admin."""
        batch_list = Task().admin.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=task_id,
            related_id=next_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_add_task_admins(self, key, proposal_id, task_id, next_id,
                               reason):
        """Reject addition of task admin."""
        batch_list = Task().admin.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=task_id,
            related_id=next_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_add_task_owners(self, key, proposal_id, task_id, next_id,
                                reason, metadata):
        """Propose adding a task owner."""
        batch_list = Task().owner.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            task_id=task_id,
            next_id=next_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_add_task_owners(self, key, proposal_id, task_id, next_id,
                                reason):
        """Confirm addition of task owner."""
        batch_list = Task().owner.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=task_id,
            related_id=next_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_add_task_owners(self, key, proposal_id, task_id, next_id,
                               reason):
        """Reject addition of task owner."""
        batch_list = Task().owner.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=task_id,
            related_id=next_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)
Exemple #3
0
class RbacClient(object):
    def __init__(self, url, key):
        if url is None:
            url = REST_ENDPOINT
        self._client = RestClient(base_url=url)
        self._key = key

    def create_user(self, key, name, username, user_id, manager_id=None):
        batch_list = rbac.user.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            name=name,
            username=username,
            user_id=user_id,
            metadata=uuid4().hex,
            manager_id=manager_id,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def create_role(self, key, role_name, role_id, metadata, admins, owners):
        batch_list = rbac.role.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            name=role_name,
            role_id=role_id,
            metadata=metadata,
            admins=admins,
            owners=owners,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_update_manager(
        self, key, proposal_id, user_id, new_manager_id, reason, metadata
    ):

        batch_list = rbac.user.manager.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            user_id=user_id,
            new_manager_id=new_manager_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_update_manager(self, key, proposal_id, reason, user_id, manager_id):
        batch_list = rbac.user.manager.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            reason=reason,
            object_id=user_id,
            related_id=manager_id,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_update_manager(self, key, proposal_id, reason, user_id, manager_id):
        batch_list = rbac.user.manager.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            reason=reason,
            object_id=user_id,
            related_id=manager_id,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_add_role_admins(
        self, key, proposal_id, role_id, user_id, reason, metadata
    ):
        batch_list = rbac.role.admin.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            role_id=role_id,
            user_id=user_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_add_role_admins(self, key, proposal_id, role_id, user_id, reason):
        batch_list = rbac.role.admin.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=user_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_add_role_admins(self, key, proposal_id, role_id, user_id, reason):

        batch_list = rbac.role.admin.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=user_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_add_role_owners(
        self, key, proposal_id, role_id, user_id, reason, metadata
    ):
        batch_list = rbac.role.owner.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            role_id=role_id,
            user_id=user_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_add_role_owners(self, key, proposal_id, role_id, user_id, reason):
        batch_list = rbac.role.owner.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=user_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_add_role_owners(self, key, proposal_id, role_id, user_id, reason):
        batch_list = rbac.role.owner.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=user_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_add_role_members(
        self, key, proposal_id, role_id, user_id, reason, metadata
    ):
        batch_list = rbac.role.member.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            role_id=role_id,
            user_id=user_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_add_role_members(self, key, proposal_id, role_id, user_id, reason):
        batch_list = rbac.role.member.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=user_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_add_role_members(self, key, proposal_id, role_id, user_id, reason):
        batch_list = rbac.role.member.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=user_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_add_role_tasks(
        self, key, proposal_id, role_id, task_id, reason, metadata
    ):
        batch_list = rbac.role.task.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            role_id=role_id,
            task_id=task_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_add_role_tasks(self, key, proposal_id, role_id, task_id, reason):
        batch_list = rbac.role.task.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=task_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_add_role_tasks(self, key, proposal_id, role_id, task_id, reason):
        batch_list = rbac.role.task.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=role_id,
            related_id=task_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def create_task(self, key, task_id, task_name, admins, owners, metadata):

        batch_list = rbac.task.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            task_id=task_id,
            name=task_name,
            admins=admins,
            owners=owners,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_add_task_admins(
        self, key, proposal_id, task_id, user_id, reason, metadata
    ):
        batch_list = rbac.task.admin.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            task_id=task_id,
            user_id=user_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_add_task_admins(self, key, proposal_id, task_id, user_id, reason):
        batch_list = rbac.task.admin.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=task_id,
            related_id=user_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_add_task_admins(self, key, proposal_id, task_id, user_id, reason):
        batch_list = rbac.task.admin.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=task_id,
            related_id=user_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def propose_add_task_owners(
        self, key, proposal_id, task_id, user_id, reason, metadata
    ):
        batch_list = rbac.task.owner.propose.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            task_id=task_id,
            user_id=user_id,
            reason=reason,
            metadata=metadata,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def confirm_add_task_owners(self, key, proposal_id, task_id, user_id, reason):
        batch_list = rbac.task.owner.confirm.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=task_id,
            related_id=user_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)

    def reject_add_task_owners(self, key, proposal_id, task_id, user_id, reason):
        batch_list = rbac.task.owner.reject.batch_list(
            signer_keypair=key,
            signer_user_id=key.public_key,
            proposal_id=proposal_id,
            object_id=task_id,
            related_id=user_id,
            reason=reason,
        )
        batch_ids = batcher.get_batch_ids(batch_list=batch_list)
        self._client.send_batches(batch_list)
        return self._client.get_statuses(batch_ids, wait=10)