magpie.api.management.service.service_formats

Module Contents

Functions

format_service(service: Service, permissions: Optional[List[Permission]] = None, show_private_url: bool = False, show_resources_allowed: bool = False) → JSON

Formats the service information into JSON.

format_service_resources(service: Service, db_session: Session, service_perms: Optional[List[Permission]] = None, resources_perms_dict: Optional[ResourcePermissionMap] = None, show_all_children: bool = False, show_private_url: bool = True) → JSON

Formats the service and its children resource tree as a JSON body.

format_service_resource_type(resource_class: Type[Resource], service_class: Type[ServiceInterface]) → JSON

magpie.api.management.service.service_formats.format_service(service: Service, permissions: Optional[List[Permission]] = None, show_private_url: bool = False, show_resources_allowed: bool = False) → JSON[source]

Formats the service information into JSON.

Note:

Automatically finds permissions of the service if not specified. To preserve empty permissions such as during listing of user/group resource permissions, an empty list should be specified.

magpie.api.management.service.service_formats.format_service_resources(service: Service, db_session: Session, service_perms: Optional[List[Permission]] = None, resources_perms_dict: Optional[ResourcePermissionMap] = None, show_all_children: bool = False, show_private_url: bool = True) → JSON[source]

Formats the service and its children resource tree as a JSON body.

Parameters
  • service – service for which to display details with sub-resources

  • db_session – database session

  • service_perms – If provided, sets Applied Permissions to display on the formatted service. Otherwise, sets the Allowed Permissions specific to the service’s type.

  • resources_perms_dict – If provided (not None), set the Applied Permissions on each specified resource matched by ID. If None, retrieve and set Allowed Permissions for the corresponding resources under the service. To set empty Applied Permissions (e.g.: User doesn’t have permissions on that resource), provide an explicit empty dictionary instead.

  • show_all_children – Display all children resources recursively, or only ones specified by ID with resources_perms_dict.

  • show_private_url – displays the

Returns

JSON body representation of the service resource tree

magpie.api.management.service.service_formats.format_service_resource_type(resource_class: Type[Resource], service_class: Type[ServiceInterface]) → JSON[source]