magpie.api.management.resource.resource_formats
¶
Module Contents¶
Functions¶
|
Formats the |
|
Generates the formatted resource tree under the provided children resources, with all of their children resources by |
|
Obtains the formatted Resource tree with all its formatted children hierarchy. |
-
magpie.api.management.resource.resource_formats.
format_resource
(resource: magpie.models.Resource, permissions: Optional[Collection[AnyPermissionType]] = None, permission_type: Optional[PermissionType] = None, basic_info: bool = False) → magpie.typedefs.JSON[source]¶ Formats the
resource
information into JSON.
-
magpie.api.management.resource.resource_formats.
format_resource_tree
(children: magpie.typedefs.ChildrenResourceNodes, db_session: sqlalchemy.orm.session.Session, resources_perms_dict: Optional[ResourcePermissionMap] = None, permission_type: Optional[PermissionType] = None) → magpie.typedefs.JSON[source]¶ Generates the formatted resource tree under the provided children resources, with all of their children resources by calling
format_resource()
recursively on them.Apply specific resource permissions as defined by
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 Applied Permissions to set to corresponding resources by ID. When provided, these will define the User, Group or both (i.e.: Inherited Permissions) actual permissions, or even the Effective Permissions, according to parent caller function’s context. Otherwise (
None
), defaults to extracting Allowed Permissions for the given Resource scoped under the corresponding root Service.
- Returns
formatted resource tree