Implement secure RBAC for storage pool statistics
This commit updates the policies for storage pool statistics to understand scope checking and account for a read-only role. This is part of a broader series of changes across OpenStack to provide a consistent RBAC experience and improve security. Change-Id: I99af5f4f9bfc7e0718c618c95206b7051b724c73
This commit is contained in:
parent
46f65eafa9
commit
7f72147f17
@ -10,6 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import versionutils
|
||||
from oslo_policy import policy
|
||||
|
||||
from manila.policies import base
|
||||
@ -17,11 +18,25 @@ from manila.policies import base
|
||||
|
||||
BASE_POLICY_NAME = 'scheduler_stats:pools:%s'
|
||||
|
||||
DEPRECATED_REASON = """
|
||||
The storage pool statistics API now support system scope and default roles.
|
||||
"""
|
||||
|
||||
deprecated_pool_index = policy.DeprecatedRule(
|
||||
name=BASE_POLICY_NAME % 'index',
|
||||
check_str=base.RULE_ADMIN_API
|
||||
)
|
||||
deprecated_pool_detail = policy.DeprecatedRule(
|
||||
name=BASE_POLICY_NAME % 'detail',
|
||||
check_str=base.RULE_ADMIN_API
|
||||
)
|
||||
|
||||
|
||||
scheduler_stats_policies = [
|
||||
policy.DocumentedRuleDefault(
|
||||
name=BASE_POLICY_NAME % 'index',
|
||||
check_str=base.RULE_ADMIN_API,
|
||||
check_str=base.SYSTEM_READER,
|
||||
scope_types=['system'],
|
||||
description="Get information regarding backends "
|
||||
"(and storage pools) known to the scheduler.",
|
||||
operations=[
|
||||
@ -33,10 +48,15 @@ scheduler_stats_policies = [
|
||||
'method': 'GET',
|
||||
'path': '/scheduler-stats/pools?{query}'
|
||||
}
|
||||
]),
|
||||
],
|
||||
deprecated_rule=deprecated_pool_index,
|
||||
deprecated_reason=DEPRECATED_REASON,
|
||||
deprecated_since=versionutils.deprecated.WALLABY
|
||||
),
|
||||
policy.DocumentedRuleDefault(
|
||||
name=BASE_POLICY_NAME % 'detail',
|
||||
check_str=base.RULE_ADMIN_API,
|
||||
check_str=base.SYSTEM_READER,
|
||||
scope_types=['system'],
|
||||
description="Get detailed information regarding backends "
|
||||
"(and storage pools) known to the scheduler.",
|
||||
operations=[
|
||||
@ -48,7 +68,11 @@ scheduler_stats_policies = [
|
||||
'method': 'GET',
|
||||
'path': '/scheduler-stats/pools/detail'
|
||||
}
|
||||
]),
|
||||
],
|
||||
deprecated_rule=deprecated_pool_detail,
|
||||
deprecated_reason=DEPRECATED_REASON,
|
||||
deprecated_since=versionutils.deprecated.WALLABY
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user