Merge "Implement secure RBAC for services"
This commit is contained in:
commit
aa298c9a8c
@ -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 = 'service:%s'
|
||||
|
||||
DEPRECATED_REASON = """
|
||||
The service API now supports system scope and default roles.
|
||||
"""
|
||||
|
||||
deprecated_service_index = policy.DeprecatedRule(
|
||||
name=BASE_POLICY_NAME % 'index',
|
||||
check_str=base.RULE_ADMIN_API
|
||||
)
|
||||
deprecated_service_update = policy.DeprecatedRule(
|
||||
name=BASE_POLICY_NAME % 'update',
|
||||
check_str=base.RULE_ADMIN_API
|
||||
)
|
||||
|
||||
|
||||
service_policies = [
|
||||
policy.DocumentedRuleDefault(
|
||||
name=BASE_POLICY_NAME % 'index',
|
||||
check_str=base.RULE_ADMIN_API,
|
||||
check_str=base.SYSTEM_READER,
|
||||
scope_types=['system'],
|
||||
description="Return a list of all running services.",
|
||||
operations=[
|
||||
{
|
||||
@ -40,10 +55,15 @@ service_policies = [
|
||||
'method': 'GET',
|
||||
'path': '/services?{query}',
|
||||
}
|
||||
]),
|
||||
],
|
||||
deprecated_rule=deprecated_service_index,
|
||||
deprecated_reason=DEPRECATED_REASON,
|
||||
deprecated_since=versionutils.deprecated.WALLABY
|
||||
),
|
||||
policy.DocumentedRuleDefault(
|
||||
name=BASE_POLICY_NAME % 'update',
|
||||
check_str=base.RULE_ADMIN_API,
|
||||
check_str=base.SYSTEM_ADMIN,
|
||||
scope_types=['system'],
|
||||
description="Enable/Disable scheduling for a service.",
|
||||
operations=[
|
||||
{
|
||||
@ -62,7 +82,11 @@ service_policies = [
|
||||
'method': 'PUT',
|
||||
'path': '/services/enable',
|
||||
},
|
||||
]),
|
||||
],
|
||||
deprecated_rule=deprecated_service_update,
|
||||
deprecated_reason=DEPRECATED_REASON,
|
||||
deprecated_since=versionutils.deprecated.WALLABY
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user