magpie.api.management.resource.resource_formats

Module Contents

magpie.api.management.resource.resource_formats.format_resource(resource, permissions=None, basic_info=False)[source]

Formats the resource information into JSON.

magpie.api.management.resource.resource_formats.format_resource_tree(children, db_session, resources_perms_dict=None, internal_svc_res_perm_dict=None)[source]

Generates the formatted service/resource tree with all its children resources by calling :function:`format_resource` recursively.

Filters resource permissions with resources_perms_dict if provided.

Parameters:
  • children – service or resource for which to generate the formatted resource tree
  • db_session – connection to db
  • resources_perms_dict – any pre-established user- or group-specific permissions. Only those are shown if given.
  • internal_svc_res_perm_dictfor this function’s use only, avoid re-fetch of already obtained permissions for corresponding resources
Returns:

formatted resource tree

magpie.api.management.resource.resource_formats.get_resource_children(resource, db_session)[source]
magpie.api.management.resource.resource_formats.format_resource_with_children(resource, db_session)[source]