cowbird.handlers.impl.magpie

Module Contents

Classes

Magpie

Complete the Magpie’s webhook call by calling Magpie temporary urls. Also keep service-shared resources in sync when

Attributes

LOGGER

COOKIES_TIMEOUT

WFS_READ_PERMISSIONS

WFS_WRITE_PERMISSIONS

WMS_READ_PERMISSIONS

WPS_READ_PERMISSIONS

WPS_WRITE_PERMISSIONS

GEOSERVER_READ_PERMISSIONS

GEOSERVER_WRITE_PERMISSIONS

cowbird.handlers.impl.magpie.LOGGER[source]
cowbird.handlers.impl.magpie.COOKIES_TIMEOUT = 60[source]
cowbird.handlers.impl.magpie.WFS_READ_PERMISSIONS[source]
cowbird.handlers.impl.magpie.WFS_WRITE_PERMISSIONS[source]
cowbird.handlers.impl.magpie.WMS_READ_PERMISSIONS[source]
cowbird.handlers.impl.magpie.WPS_READ_PERMISSIONS[source]
cowbird.handlers.impl.magpie.WPS_WRITE_PERMISSIONS[source]
cowbird.handlers.impl.magpie.GEOSERVER_READ_PERMISSIONS[source]
cowbird.handlers.impl.magpie.GEOSERVER_WRITE_PERMISSIONS[source]
class cowbird.handlers.impl.magpie.Magpie(settings: cowbird.typedefs.SettingsType, name: str, admin_user: str, admin_password: str, **kwargs: Any)[source]

Bases: cowbird.handlers.handler.Handler

Complete the Magpie’s webhook call by calling Magpie temporary urls. Also keep service-shared resources in sync when permissions are updated for one of them.

** Cowbird components diagram 1.2.0 needs to be updated since Magpie can handle permissions synchronisation directly on permission update events. No need to handle them explicitly in nginx, thredds and geoserver classes.

Create the magpie instance and instantiate the permission synchronizer that will handle the permission events.

Parameters
  • settings – Cowbird settings for convenience

  • name – Handler name

  • admin_user – Magpie admin username used for login.

  • admin_password – Magpie admin password used for login.

required_params[source]
_send_request(method: str, url: str, params: Optional[Any] = None, json: Optional[Any] = None)requests.Response[source]

Wrapping function to send requests to Magpie, which also handles login and cookies.

get_service_types()List[str][source]

Returns the list of service types available on Magpie.

abstract get_resource_id(resource_full_name: str)str[source]

Each handler must provide this implementation required by the permission synchronizer.

The function needs to find the resource id in Magpie from the resource full name using its knowledge of the service. If the resource doesn’t already exist, the function needs to create it, again using its knowledge of resource type and parent resource type if required.

get_services_by_type(service_type: str)Dict[str, cowbird.typedefs.JSON][source]
get_service_info(service_name: str)Dict[str, cowbird.typedefs.JSON][source]
get_resources_by_service(service_name: str)Dict[str, cowbird.typedefs.JSON][source]
get_parents_resource_tree(resource_id: int)List[cowbird.typedefs.JSON][source]

Returns the associated Magpie Resource object and all its parents in a list ordered from parent to child.

get_resource(resource_id: int)Dict[str, cowbird.typedefs.JSON][source]

Returns the associated Magpie Resource object.

get_geoserver_workspace_res_id(workspace_name: str, create_if_missing: Optional[bool] = False)Union[int, None][source]

Finds the resource id of a workspace resource from the geoserver type services.

get_geoserver_layer_res_id(workspace_name: str, layer_name: str, create_if_missing: bool = False)int[source]

Tries to get the resource id of a specific layer, on geoserver type services, and if requested, creates the resource and workspace if they do not exist yet.

get_user_permissions(user: str)Dict[str, cowbird.typedefs.JSON][source]

Gets all user resource permissions.

get_user_permissions_by_res_id(user: str, res_id: int, effective: bool = False)Dict[str, cowbird.typedefs.JSON][source]
get_group_permissions(grp: str)Dict[str, cowbird.typedefs.JSON][source]

Gets all group resource permissions.

get_group_permissions_by_res_id(grp: str, res_id: int, effective: bool = False)Dict[str, cowbird.typedefs.JSON][source]
abstract user_created(user_name)[source]
abstract user_deleted(user_name)[source]
permission_created(permission)[source]
permission_deleted(permission)[source]
create_permissions(permissions_data: List[Dict[str, str]])None[source]

Make sure that the specified permissions exist on Magpie.

create_permission_by_res_id(res_id: int, perm_name: str, perm_access: str, perm_scope: str, user_name: Optional[str] = '', grp_name: Optional[str] = '')Union[pyramid.response.Response, None][source]
create_permission_by_user_and_res_id(user_name: str, res_id: int, perm_name: str, perm_access: str, perm_scope: str)Union[pyramid.response.Response, None][source]
create_permission_by_grp_and_res_id(grp_name: str, res_id: int, perm_name: str, perm_access: str, perm_scope: str)Union[pyramid.response.Response, None][source]
delete_permission_by_user_and_res_id(user_name: str, res_id: int, permission_name: str)None[source]
delete_permission_by_grp_and_res_id(grp_name: str, res_id: int, permission_name: str)None[source]
delete_permission(permissions_data: List[Dict[str, str]])None[source]

Remove the specified permission from Magpie if it exists.

create_resource(resource_name: str, resource_type: str, parent_id: int)int[source]

Creates the specified resource in Magpie and returns the created resource id if successful.

delete_resource(resource_id: int)None[source]
login()requests.cookies.RequestsCookieJar[source]

Login to Magpie app using admin credentials.

exception cowbird.handlers.impl.magpie.MagpieHttpError[source]

Bases: Exception

Exception related to http requests done by the Magpie handler.

Initialize self. See help(type(self)) for accurate signature.