Address trivial TODOs
- Add share type access to type view builder - Remove unnecessary docstring TODO TrivialFix Change-Id: I856a3318f498800eab5932b7ad250621ccf4292f
This commit is contained in:
parent
4580938bab
commit
4435deb48f
|
@ -283,13 +283,7 @@ class ShareTypesController(wsgi.Controller):
|
|||
expl = _("Access list not available for public share types.")
|
||||
raise webob.exc.HTTPNotFound(explanation=expl)
|
||||
|
||||
# TODO(vponomaryov): move to views.
|
||||
rval = []
|
||||
for project_id in share_type['projects']:
|
||||
rval.append(
|
||||
{'share_type_id': share_type['id'], 'project_id': project_id}
|
||||
)
|
||||
return {'share_type_access': rval}
|
||||
return self._view_builder.share_type_access(req, share_type)
|
||||
|
||||
@wsgi.action('addProjectAccess')
|
||||
@wsgi.Controller.authorize('add_project_access')
|
||||
|
|
|
@ -88,6 +88,14 @@ class ViewBuilder(common.ViewBuilder):
|
|||
return dict(volume_types=share_types_list,
|
||||
share_types=share_types_list)
|
||||
|
||||
def share_type_access(self, request, share_type):
|
||||
"""Return a dictionary view of the projects with access to type."""
|
||||
projects = [
|
||||
{'share_type_id': share_type['id'], 'project_id': project_id}
|
||||
for project_id in share_type['projects']
|
||||
]
|
||||
return {'share_type_access': projects}
|
||||
|
||||
def _filter_extra_specs(self, extra_specs, valid_keys):
|
||||
return {key: value for key, value in extra_specs.items()
|
||||
if key in valid_keys}
|
||||
|
|
|
@ -54,7 +54,6 @@ def destroy(context, type_id):
|
|||
|
||||
def get_all(context, inactive=0, search_opts=None):
|
||||
"""Get all non-deleted share group types."""
|
||||
# TODO(ameade): Fix docstring
|
||||
search_opts = search_opts or {}
|
||||
filters = {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue