'Find all roles currently connected to relevant permissions
on the library dataset and the underlying dataset.
:param  library_dataset:      the model object
:type   library_dataset:      LibraryDataset
:rtype:     dictionary
:returns:   dict of current roles for all available permission types'

def _get_current_roles(self, trans, library_dataset):

    dataset = library_dataset.library_dataset_dataset_association.dataset
    access_roles = set(dataset.get_access_roles(trans))
    modify_roles = set(trans.app.security_agent.get_roles_for_action(library_dataset, trans.app.security_agent.permitted_actions.LIBRARY_MODIFY))
    manage_roles = set(dataset.get_manage_permissions_roles(trans))
    access_dataset_role_list = [(access_role.name, trans.security.encode_id(access_role.id)) for access_role in access_roles]
    manage_dataset_role_list = [(manage_role.name, trans.security.encode_id(manage_role.id)) for manage_role in manage_roles]
    modify_item_role_list = [(modify_role.name, trans.security.encode_id(modify_role.id)) for modify_role in modify_roles]
    return dict(access_dataset_roles=access_dataset_role_list, modify_item_roles=modify_item_role_list, manage_dataset_roles=manage_dataset_role_list)
