cowbird.handlers.impl.magpie
Attributes
Exceptions
Exception related to http requests done by the Magpie handler. |
Classes
Complete the Magpie's webhook call by calling Magpie temporary urls. Also keep service-shared resources in sync when |
Module Contents
- 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.
- _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_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_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]
- 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.