'This method is historical (it is not currently used), but may be useful again at some
point.  It returns a dictionary whose keys are library objects and whose values are a
comma-separated string of folder ids.  This method works with the show_library_item()
method below, and it returns libraries for which the received user has permission to
perform the received actions.  Here is an example call to this method to return all
libraries for which the received user has LIBRARY_ADD permission::
libraries = trans.app.security_agent.get_permitted_libraries( trans, user,
[ trans.app.security_agent.permitted_actions.LIBRARY_ADD ] )'

def get_permitted_libraries(self, trans, user, actions):

    all_libraries = trans.sa_session.query(trans.app.model.Library).filter((trans.app.model.Library.table.c.deleted == false())).order_by(trans.app.model.Library.name)
    roles = user.all_roles()
    actions_to_check = actions
    libraries = {}
    for library in all_libraries:
        (can_show, hidden_folder_ids) = self.show_library_item(self, roles, library, actions_to_check)
        if can_show:
            libraries[library] = hidden_folder_ids
    return libraries
