magpie.api.management.service.service_views¶
Attributes¶
Classes¶
Applicable Permission values (names) under certain Service and Resource. |
|
Applicable types of Permission according to context. |
Functions¶
|
Obtains the formatted permission representations after validation that each of their name is a known member of |
|
Syncs Magpie services by pushing updates to Phoenix. |
|
Invalidates any caching reference to the specified service name. |
|
Retrieve the specific service class from the provided database service entry. |
|
List all available service types. |
List all registered services from a specific type. |
|
|
List all registered services. |
|
Generates services response format from request conditions. |
|
Registers a new service. |
|
Update service information. |
|
Get service information. |
|
Unregister a service. |
List all applicable permissions for a service. |
|
Get resource information under a service. |
|
Unregister a resource. |
|
List all resources registered under a service. |
|
Register a new resource directly under a service or under one of its children resources. |
|
List details of resource types supported under a specific service type. |
|
List all resource types supported under a specific service type. |
Module Contents¶
- class magpie.api.management.service.service_views.Permission[source]¶
Bases:
magpie.utils.ExtendedEnumApplicable Permission values (names) under certain Service and Resource.
- READ = 'read'¶
- WRITE = 'write'¶
- ACCESS = 'access'¶
- BROWSE = 'browse'¶
- GET_CAPABILITIES = 'getcapabilities'¶
- GET_MAP = 'getmap'¶
- GET_FEATURE_INFO = 'getfeatureinfo'¶
- GET_LEGEND_GRAPHIC = 'getlegendgraphic'¶
- GET_METADATA = 'getmetadata'¶
- GET_PROPERTY_VALUE = 'getpropertyvalue'¶
- GET_FEATURE = 'getfeature'¶
- GET_FEATURE_WITH_LOCK = 'getfeaturewithlock'¶
- GET_GML_OBJECT = 'getgmlobject'¶
- DESCRIBE_FEATURE_TYPE = 'describefeaturetype'¶
- DESCRIBE_LAYER = 'describelayer'¶
- DESCRIBE_PROCESS = 'describeprocess'¶
- EXECUTE = 'execute'¶
- LOCK_FEATURE = 'lockfeature'¶
- TRANSACTION = 'transaction'¶
- CREATE_STORED_QUERY = 'createstoredquery'¶
- DROP_STORED_QUERY = 'dropstoredquery'¶
- LIST_STORED_QUERIES = 'liststoredqueries'¶
- DESCRIBE_STORED_QUERIES = 'describestoredqueries'¶
- class magpie.api.management.service.service_views.PermissionType[source]¶
Bases:
magpie.utils.ExtendedEnumApplicable types of Permission according to context.
- ACCESS = 'access'¶
- ALLOWED = 'allowed'¶
- APPLIED = 'applied'¶
- DIRECT = 'direct'¶
- INHERITED = 'inherited'¶
- EFFECTIVE = 'effective'¶
- OWNED = 'owned'¶
- magpie.api.management.service.service_views.format_permissions(permissions: Collection[magpie.typedefs.AnyPermissionType] | None, permission_type: PermissionType | None = None, force_unique: bool = True) Dict[magpie.typedefs.Str, List[magpie.typedefs.Str] | magpie.typedefs.PermissionDict | magpie.typedefs.Str][source]¶
Obtains the formatted permission representations after validation that each of their name is a known member of
Permissionenum, and optionally with modifiers as defined byPermissionSet.The returned lists are sorted alphabetically by permission name, and then in order of resolution priority (from highest to lowest) for each subset or corresponding name.
The permissions are cleaned from any duplicate entries, unless
force_uniqueis specified to allow it. If no or emptypermissionsis provided, empty lists are returned.Note
Field
permission_namesprovides both the older implicit permission names and the newer explicit name representation. For this reason, there will be semantically “duplicate” permissions in that list, but there will not be any literal string duplicates. Implicit names are immediately followed by their explicit name, unless implicit names do not apply for the given permission (e.g.: whenAccess.DENYdid not exist). Only detailed and explicit JSON representations are provided in thepermissionslist.When
permission_typeis equal toPermissionType.ALLOWED, the collection of every applicablePermissionSetis automatically generated by expanding all combinations ofAccessandScopewith every providedPermissionname inpermissions. This allows more concise definition of allowed permissions undermagpie.services.Servicesand their children Resource by only definingPermissionnames without manually listing all variations ofPermissionSet.For other
permission_typevalues, which represent Applied Permission only explicitly providedpermissionsare returned, to effectively return the collection of active permissions.- Parameters:
permissions – multiple permissions of any implementation and type, to be rendered both as names and JSON.
permission_type – indication of the represented permissions to be formatted, for informative indication.
force_unique – whether to remove duplicate entries by association of name, access and scope or not.
- Returns:
JSON with the permissions listed as implicit+explicit names, as permission set objects, and their type.
- magpie.api.management.service.service_views.sync_services_phoenix(services: Iterable[magpie.models.Service] | magpie.typedefs.JSON, services_as_dicts: bool = False) bool[source]¶
Syncs Magpie services by pushing updates to Phoenix.
Services must be one of types specified in
magpie.register.SERVICES_PHOENIX_ALLOWED.- Parameters:
services –
An iterable of
models.Serviceby default, or a dictionary of{svc-name: {<service-info>}}JSON objects containing each service’s information ifservices_ad_dictsisTrue.where
<service-info>is defined as:{"public_url": <url>, "service_name": <name>, "service_type": <type>}
services_as_dicts – indicate if services must be parsed as JSON definitions.
- magpie.api.management.service.service_views.invalidate_service(service_name: magpie.typedefs.Str) None[source]¶
Invalidates any caching reference to the specified service name.
- magpie.api.management.service.service_views.service_factory(service: magpie.models.Service, request: pyramid.request.Request) ServiceInterface[source]¶
Retrieve the specific service class from the provided database service entry.
- magpie.api.management.service.service_views.get_service_types_view(request: pyramid.request.Request) magpie.typedefs.AnyResponseType[source]¶
List all available service types.
- magpie.api.management.service.service_views.get_services_by_type_view(request: pyramid.request.Request) magpie.typedefs.AnyResponseType[source]¶
List all registered services from a specific type.
- magpie.api.management.service.service_views.get_services_view(request: pyramid.request.Request) magpie.typedefs.AnyResponseType[source]¶
List all registered services.
- magpie.api.management.service.service_views.get_services_runner(request: pyramid.request.Request) magpie.typedefs.AnyResponseType[source]¶
Generates services response format from request conditions.
Obtains the full or filtered list of services categorized by type, or listed as flat list according to request path and query parameters.
- magpie.api.management.service.service_views.register_service_view(request: pyramid.request.Request) magpie.typedefs.AnyResponseType[source]¶
Registers a new service.
- magpie.api.management.service.service_views.update_service_view(request: pyramid.request.Request) magpie.typedefs.AnyResponseType[source]¶
Update service information.
- magpie.api.management.service.service_views.get_service_view(request: pyramid.request.Request) magpie.typedefs.AnyResponseType[source]¶
Get service information.
- magpie.api.management.service.service_views.unregister_service_view(request: pyramid.request.Request) magpie.typedefs.AnyResponseType[source]¶
Unregister a service.
- magpie.api.management.service.service_views.get_service_permissions_view(request: pyramid.request.Request) magpie.typedefs.AnyResponseType[source]¶
List all applicable permissions for a service.
- magpie.api.management.service.service_views.get_service_resource_view(request: pyramid.request.Request) magpie.typedefs.AnyResponseType[source]¶
Get resource information under a service.
- magpie.api.management.service.service_views.delete_service_resource_view(request: pyramid.request.Request) magpie.typedefs.AnyResponseType[source]¶
Unregister a resource.
- magpie.api.management.service.service_views.get_service_resources_view(request: pyramid.request.Request) magpie.typedefs.AnyResponseType[source]¶
List all resources registered under a service.
- magpie.api.management.service.service_views.create_service_resource_view(request: pyramid.request.Request) magpie.typedefs.AnyResponseType[source]¶
Register a new resource directly under a service or under one of its children resources.