manila/manila/api
Goutham Pacha Ravi 2289cdd9e7 Add policy to create/update public shares
Public shares are visible across all keystone
projects and are "accessible" by all projects
within a multi-tenant cloud. More often than not,
only privileged users can create and manage shares
that EVERYONE on the cloud can really mount and use.

Manila deployers want a way to disable
unprivileged users from create public shares. Feedback
from deployers has been that public shares created on one
private tenant network (DHSS=True scenario) cannot
be used within another private tenant network belonging
to a different project. So, if users unintentionally create
public shares, they end up pollute the dashboards of users
in other projects. So, we need to make public share
creation a "privileged" feature. This can be achieved by
introducing a manila API policy that defaults to
only allowing the "admin" role. So, this commit will:
- Introduce two new policies:
    - share:create_public_share and
    - share:set_public_share
- Set the default check string for these policies
  to rule:admin_api. They will accept the default
  rule temporarily, and log a deprecation warning
  message.
- Remove some redundant policy checks in code
  and move the policy check up in the API so we
  can fail unauthorized requests faster.

When making an API change that potentially changes
the return code from being "successful" (HTTP 2xx)
to returning failure (in this case: HTTP 403,
NotAuthorized), we typically maintain API backwards
compatibility by failing the requests ONLY with newer
API microversions. Following this pattern for API
policy changes will introduce a security hole, i.e.,
users can always create public shares with previous
versions even when an administrator explicitly
sets up policy to disable the action. This is why
this change will not maintain API backwards
compatibility.

APIImpact
Closes-Bug: #1801763
Change-Id: Ib4fc9a82b6a3e5f8e50f0bc8a89d0445eecab028
2019-02-18 12:56:12 -08:00
..
contrib Port share type extensions to core API 2015-11-12 14:58:20 +00:00
middleware Fix UnicodeDecodeError when decode API input 2018-02-07 06:37:32 +00:00
openstack Allow configuring availability_zones in share types 2019-02-13 17:39:48 +00:00
v1 Add policy to create/update public shares 2019-02-18 12:56:12 -08:00
v2 Merge "Allow configuring availability_zones in share types" 2019-02-18 20:38:20 +00:00
views Separate APIs for share & replica export locations 2019-01-07 01:51:16 -08:00
__init__.py Remove enable_v1_api and enable_v2_api config opts 2016-08-23 08:27:22 +02:00
auth.py Remove log translations in api 1/5 2017-03-29 16:55:05 +08:00
common.py Add policy to create/update public shares 2019-02-18 12:56:12 -08:00
extensions.py Remove unused functions from api/extensions.py 2017-11-17 18:46:53 +08:00
urlmap.py Trivial: Remove unused logging import 2015-12-28 21:44:26 -05:00
versions.py [Trivialfix] Remove the useless parameter 'ext_mgr' 2018-06-09 22:39:24 +00:00