Allow optional sending/receiving request headers from reporting api to storage layer

Registered by Eric Pendergrass

In the case of role based authorization control it can be useful to have the http request information in the storage layer. For example, if fine-grained tenant grouping information is stored in the database, being able to retrieve metadata based on the user's role(s) would be necessary.

Propose that methods like MeterController.get_all check the storage layer's signature (already obtained from _query_to_kwargs) for presence of an optional parameter (like "request_headers"), and if it's present pass the request headers. It might look like this:

        if 'request_headers' in kwargs:
            return [Sample.from_db_model(e)
                    for e in pecan.request.storage_conn.get_samples(
                        f, request_headers=pecan.request.headers, limit=limit)]
        else:
            return [Sample.from_db_model(e)
                    for e in pecan.request.storage_conn.get_samples(
                        f, limit=limit)]

Since this is optional for every storage class, it would require no changes to any storage implementation classes. It would enable the flexibility to write storage drivers which use the request header information, or to extend existing drivers to do so.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
Eric Pendergrass
Direction:
Needs approval
Assignee:
Eric Pendergrass
Definition:
Obsolete
Series goal:
None
Implementation:
Unknown
Milestone target:
None
Completed by
gordon chung

Related branches

Sprints

Whiteboard

is this covered by RBAC policies? if so i'm going to close this. -- gordc (18.6.15)

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.