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: Any | None = None, json: Any | None = 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.

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: bool | None = False) 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_list() List[str][source]

Returns the list of all Magpie usernames.

get_user_id_from_user_name(user_name: str) int[source]

Finds the id of a user from his username.

get_user_name_from_user_id(user_id: int) str[source]

Finds the name of a user from his user id.

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_user_names_by_group_name(grp_name: str) List[str][source]

Returns the list of Magpie usernames from a group.

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: str) None[source]
abstract user_deleted(user_name: str) None[source]
permission_created(permission: magpie.permissions.Permission) None[source]
permission_deleted(permission: magpie.permissions.Permission) None[source]
abstract resync() None[source]
create_permissions(permissions_data: List[cowbird.typedefs.PermissionConfigItemType]) 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: str | None = '', grp_name: str | None = '') 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) 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) 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 | None) 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.